Skip to content

Commit 2bb129e

Browse files
JuliaLawallVinod Koul
authored andcommitted
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>
1 parent d3cd63f commit 2bb129e

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/dca/dca-core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ EXPORT_SYMBOL_GPL(dca_get_tag);
321321
* @ops - pointer to struct of dca operation function pointers
322322
* @priv_size - size of extra mem to be added for provider's needs
323323
*/
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)
325326
{
326327
struct dca_provider *dca;
327328
int alloc_size;

‎drivers/dma/ioat/dca.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static u8 ioat_dca_get_tag(struct dca_provider *dca,
224224
return tag;
225225
}
226226

227-
static struct dca_ops ioat_dca_ops = {
227+
static const struct dca_ops ioat_dca_ops = {
228228
.add_requester = ioat_dca_add_requester,
229229
.remove_requester = ioat_dca_remove_requester,
230230
.get_tag = ioat_dca_get_tag,

‎include/linux/dca.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void dca_unregister_notify(struct notifier_block *nb);
3434

3535
struct dca_provider {
3636
struct list_head node;
37-
struct dca_ops *ops;
37+
const struct dca_ops *ops;
3838
struct device *cd;
3939
int id;
4040
};
@@ -53,7 +53,8 @@ struct dca_ops {
5353
int (*dev_managed) (struct dca_provider *, struct device *);
5454
};
5555

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);
5758
void free_dca_provider(struct dca_provider *dca);
5859
int register_dca_provider(struct dca_provider *dca, struct device *dev);
5960
void unregister_dca_provider(struct dca_provider *dca, struct device *dev);

0 commit comments

Comments
 (0)