* [PATCH] dmaengine: ioatdma: constify dcs_ops structures
@ 2015-11-13 10:31 Julia Lawall
2015-11-13 11:46 ` [PATCH v2] dmaengine: ioatdma: constify dca_ops structures Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2015-11-13 10:31 UTC (permalink / raw)
To: Dan Williams; +Cc: kernel-janitors, linux-kernel, Vinod Koul, dmaengine
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>
---
drivers/dca/dca-core.c | 3 ++-
drivers/dma/ioat/dca.c | 2 +-
include/linux/dca.h | 5 +++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index 819dfda..7afbb28 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -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;
diff --git a/include/linux/dca.h b/include/linux/dca.h
index d27a7a0..ad956c2 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -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;
};
@@ -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);
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index 2cb7c30..0b9b6b0 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -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,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] dmaengine: ioatdma: constify dca_ops structures
2015-11-13 10:31 [PATCH] dmaengine: ioatdma: constify dcs_ops structures Julia Lawall
@ 2015-11-13 11:46 ` Julia Lawall
2015-11-13 16:38 ` Dan Williams
2015-11-16 3:58 ` Vinod Koul
0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2015-11-13 11:46 UTC (permalink / raw)
To: Dan Williams; +Cc: kernel-janitors, linux-kernel, Vinod Koul, dmaengine
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>
---
v2: Fixed typo in subject line
drivers/dca/dca-core.c | 3 ++-
drivers/dma/ioat/dca.c | 2 +-
include/linux/dca.h | 5 +++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index 819dfda..7afbb28 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -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;
diff --git a/include/linux/dca.h b/include/linux/dca.h
index d27a7a0..ad956c2 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -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;
};
@@ -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);
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index 2cb7c30..0b9b6b0 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -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,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dmaengine: ioatdma: constify dca_ops structures
2015-11-13 11:46 ` [PATCH v2] dmaengine: ioatdma: constify dca_ops structures Julia Lawall
@ 2015-11-13 16:38 ` Dan Williams
2015-11-16 3:58 ` Vinod Koul
1 sibling, 0 replies; 4+ messages in thread
From: Dan Williams @ 2015-11-13 16:38 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, linux-kernel@vger.kernel.org, Vinod Koul,
dmaengine@vger.kernel.org
On Fri, Nov 13, 2015 at 3:46 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> 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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dmaengine: ioatdma: constify dca_ops structures
2015-11-13 11:46 ` [PATCH v2] dmaengine: ioatdma: constify dca_ops structures Julia Lawall
2015-11-13 16:38 ` Dan Williams
@ 2015-11-16 3:58 ` Vinod Koul
1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2015-11-16 3:58 UTC (permalink / raw)
To: Julia Lawall; +Cc: Dan Williams, kernel-janitors, linux-kernel, dmaengine
On Fri, Nov 13, 2015 at 12:46:00PM +0100, Julia Lawall wrote:
> The dca_ops structure is never modified, so declare it as const.
>
> Done with the help of Coccinelle.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-16 3:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13 10:31 [PATCH] dmaengine: ioatdma: constify dcs_ops structures Julia Lawall
2015-11-13 11:46 ` [PATCH v2] dmaengine: ioatdma: constify dca_ops structures Julia Lawall
2015-11-13 16:38 ` Dan Williams
2015-11-16 3:58 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox