linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bhumika Goyal <bhumirks@gmail.com>
To: julia.lawall@lip6.fr, sudeep.dutt@intel.com,
	ashutosh.dixit@intel.com, vinod.koul@intel.com,
	dan.j.williams@intel.com, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Bhumika Goyal <bhumirks@gmail.com>
Subject: [PATCH] drivers: misc: mic: constify mbus_hw_ops structures
Date: Tue, 20 Dec 2016 16:26:17 +0530	[thread overview]
Message-ID: <1482231377-25864-1-git-send-email-bhumirks@gmail.com> (raw)

The fields of structure mbus_hw_ops are never modified after
initialization, so declare these structures as const. Add a const
annotation to all its initializations and uses like function arguments
and pointers.
Used Coccinelle to find all the occurences.

Size details:

File size before:
text    data     bss     dec     hex filename
 1401    1752     232    3385     d39 drivers/misc/mic/card/mic_x100.o
 4116     584       0    4700    125c drivers/misc/mic/host/mic_boot.o

File size after:
text    data     bss     dec    hex filename
 1432    1728     232    3392    d40 drivers/misc/mic/card/mic_x100.o
 4148    552       0    4700    125c drivers/misc/mic/host/mic_boot.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/dma/mic_x100_dma.h       | 2 +-
 drivers/misc/mic/bus/mic_bus.c   | 2 +-
 drivers/misc/mic/card/mic_x100.c | 2 +-
 drivers/misc/mic/host/mic_boot.c | 2 +-
 include/linux/mic_bus.h          | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/mic_x100_dma.h b/drivers/dma/mic_x100_dma.h
index d899820..3cf3f99 100644
--- a/drivers/dma/mic_x100_dma.h
+++ b/drivers/dma/mic_x100_dma.h
@@ -165,7 +165,7 @@ static inline struct mbus_device *to_mbus_device(struct mic_dma_chan *ch)
 	return to_mic_dma_dev(ch)->mbdev;
 }
 
-static inline struct mbus_hw_ops *to_mbus_hw_ops(struct mic_dma_chan *ch)
+static inline const struct mbus_hw_ops *to_mbus_hw_ops(struct mic_dma_chan *ch)
 {
 	return to_mbus_device(ch)->hw_ops;
 }
diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c
index be37890..df0c156 100644
--- a/drivers/misc/mic/bus/mic_bus.c
+++ b/drivers/misc/mic/bus/mic_bus.c
@@ -144,7 +144,7 @@ static void mbus_release_dev(struct device *d)
 
 struct mbus_device *
 mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
-		     struct mbus_hw_ops *hw_ops, int index,
+		     const struct mbus_hw_ops *hw_ops, int index,
 		     void __iomem *mmio_va)
 {
 	int ret;
diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c
index b9f0710..5ec6c35 100644
--- a/drivers/misc/mic/card/mic_x100.c
+++ b/drivers/misc/mic/card/mic_x100.c
@@ -234,7 +234,7 @@ static void _mic_ack_interrupt(struct mbus_device *mbdev, int num)
 	mic_ack_interrupt(&mbdev_to_mdrv(mbdev)->mdev);
 }
 
-static struct mbus_hw_ops mbus_hw_ops = {
+static const struct mbus_hw_ops mbus_hw_ops = {
 	.request_threaded_irq = _mic_request_threaded_irq,
 	.free_irq = _mic_free_irq,
 	.ack_interrupt = _mic_ack_interrupt,
diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
index 9599d73..5d86e75 100644
--- a/drivers/misc/mic/host/mic_boot.c
+++ b/drivers/misc/mic/host/mic_boot.c
@@ -371,7 +371,7 @@ static void _mic_ack_interrupt(struct mbus_device *mbdev, int num)
 	mdev->ops->intr_workarounds(mdev);
 }
 
-static struct mbus_hw_ops mbus_hw_ops = {
+static const struct mbus_hw_ops mbus_hw_ops = {
 	.request_threaded_irq = _mic_request_threaded_irq,
 	.free_irq = _mic_free_irq,
 	.ack_interrupt = _mic_ack_interrupt,
diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h
index 27d7c95..722f3f9 100644
--- a/include/linux/mic_bus.h
+++ b/include/linux/mic_bus.h
@@ -49,7 +49,7 @@ struct mbus_device_id {
  */
 struct mbus_device {
 	void __iomem *mmio_va;
-	struct mbus_hw_ops *hw_ops;
+	const struct mbus_hw_ops *hw_ops;
 	struct mbus_device_id id;
 	struct device dev;
 	int index;
@@ -91,7 +91,7 @@ struct mbus_hw_ops {
 
 struct mbus_device *
 mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
-		     struct mbus_hw_ops *hw_ops, int index,
+		     const struct mbus_hw_ops *hw_ops, int index,
 		     void __iomem *mmio_va);
 void mbus_unregister_device(struct mbus_device *mbdev);
 
-- 
1.9.1

             reply	other threads:[~2016-12-20 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 10:56 Bhumika Goyal [this message]
2017-01-02  5:10 ` [PATCH] drivers: misc: mic: constify mbus_hw_ops structures Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482231377-25864-1-git-send-email-bhumirks@gmail.com \
    --to=bhumirks@gmail.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.dutt@intel.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).