Skip to content

Commit

Permalink
dmaengine: ioatdma: constify dca_ops structures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JuliaLawall authored and Vinod Koul committed Nov 16, 2015
1 parent d3cd63f commit 2bb129e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion drivers/dca/dca-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ EXPORT_SYMBOL_GPL(dca_get_tag);
* @ops - pointer to struct of dca operation function pointers
* @priv_size - size of extra mem to be added for provider's needs
*/
struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size)
struct dca_provider *alloc_dca_provider(const struct dca_ops *ops,
int priv_size)
{
struct dca_provider *dca;
int alloc_size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/ioat/dca.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static u8 ioat_dca_get_tag(struct dca_provider *dca,
return tag;
}

static struct dca_ops ioat_dca_ops = {
static const struct dca_ops ioat_dca_ops = {
.add_requester = ioat_dca_add_requester,
.remove_requester = ioat_dca_remove_requester,
.get_tag = ioat_dca_get_tag,
Expand Down
5 changes: 3 additions & 2 deletions include/linux/dca.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void dca_unregister_notify(struct notifier_block *nb);

struct dca_provider {
struct list_head node;
struct dca_ops *ops;
const struct dca_ops *ops;
struct device *cd;
int id;
};
Expand All @@ -53,7 +53,8 @@ struct dca_ops {
int (*dev_managed) (struct dca_provider *, struct device *);
};

struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size);
struct dca_provider *alloc_dca_provider(const struct dca_ops *ops,
int priv_size);
void free_dca_provider(struct dca_provider *dca);
int register_dca_provider(struct dca_provider *dca, struct device *dev);
void unregister_dca_provider(struct dca_provider *dca, struct device *dev);
Expand Down

0 comments on commit 2bb129e

Please sign in to comment.