Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: ioatdma: constify dca_ops structures

The dca_ops structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Julia Lawall and committed by
Vinod Koul
2bb129eb d3cd63f9

+6 -4
+2 -1
drivers/dca/dca-core.c
··· 321 321 * @ops - pointer to struct of dca operation function pointers 322 322 * @priv_size - size of extra mem to be added for provider's needs 323 323 */ 324 - struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size) 324 + struct dca_provider *alloc_dca_provider(const struct dca_ops *ops, 325 + int priv_size) 325 326 { 326 327 struct dca_provider *dca; 327 328 int alloc_size;
+1 -1
drivers/dma/ioat/dca.c
··· 224 224 return tag; 225 225 } 226 226 227 - static struct dca_ops ioat_dca_ops = { 227 + static const struct dca_ops ioat_dca_ops = { 228 228 .add_requester = ioat_dca_add_requester, 229 229 .remove_requester = ioat_dca_remove_requester, 230 230 .get_tag = ioat_dca_get_tag,
+3 -2
include/linux/dca.h
··· 34 34 35 35 struct dca_provider { 36 36 struct list_head node; 37 - struct dca_ops *ops; 37 + const struct dca_ops *ops; 38 38 struct device *cd; 39 39 int id; 40 40 }; ··· 53 53 int (*dev_managed) (struct dca_provider *, struct device *); 54 54 }; 55 55 56 - struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); 56 + struct dca_provider *alloc_dca_provider(const struct dca_ops *ops, 57 + int priv_size); 57 58 void free_dca_provider(struct dca_provider *dca); 58 59 int register_dca_provider(struct dca_provider *dca, struct device *dev); 59 60 void unregister_dca_provider(struct dca_provider *dca, struct device *dev);