mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bhumika Goyal <bhumirks@gmail.com>
To: julia.lawall@lip6.fr, sudeep.dutt@intel.com,
	ashutosh.dixit@intel.com, linux-kernel@vger.kernel.org
Cc: Bhumika Goyal <bhumirks@gmail.com>
Subject: [PATCH] drivers: misc: mic: constify cosm_hw_ops structures
Date: Tue, 20 Dec 2016 17:42:21 +0530	[thread overview]
Message-ID: <1482235941-22945-1-git-send-email-bhumirks@gmail.com> (raw)

The fields of cosm_hw_ops structures are never modified after getting
initialized, so declare these structures as const. Also add const 
annotation to all its uses like pointers, extern declaration and function 
arguments.
Used Coccinelle to find occurences.

File size before:
   text	   data	    bss	    dec	    hex	filename
   4116	    584	      0	   4700	   125c	drivers/misc/mic/host/mic_boot.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   4212	    488	      0	   4700	   125c	drivers/misc/mic/host/mic_boot.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/misc/mic/bus/cosm_bus.c    | 2 +-
 drivers/misc/mic/bus/cosm_bus.h    | 4 ++--
 drivers/misc/mic/host/mic_boot.c   | 2 +-
 drivers/misc/mic/host/mic_device.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/mic/bus/cosm_bus.c b/drivers/misc/mic/bus/cosm_bus.c
index d31d6c6..85f28ca 100644
--- a/drivers/misc/mic/bus/cosm_bus.c
+++ b/drivers/misc/mic/bus/cosm_bus.c
@@ -69,7 +69,7 @@ static inline void cosm_release_dev(struct device *d)
 }
 
 struct cosm_device *
-cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
+cosm_register_device(struct device *pdev, const struct cosm_hw_ops *hw_ops)
 {
 	struct cosm_device *cdev;
 	int ret;
diff --git a/drivers/misc/mic/bus/cosm_bus.h b/drivers/misc/mic/bus/cosm_bus.h
index 8b63418..fc0c0905 100644
--- a/drivers/misc/mic/bus/cosm_bus.h
+++ b/drivers/misc/mic/bus/cosm_bus.h
@@ -69,7 +69,7 @@ struct cosm_device {
 	void *log_buf_addr;
 	int *log_buf_len;
 	struct kernfs_node *state_sysfs;
-	struct cosm_hw_ops *hw_ops;
+	const struct cosm_hw_ops *hw_ops;
 	struct device dev;
 	int index;
 	struct dentry *dbg_dir;
@@ -118,7 +118,7 @@ struct cosm_hw_ops {
 };
 
 struct cosm_device *
-cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops);
+cosm_register_device(struct device *pdev, const struct cosm_hw_ops *hw_ops);
 void cosm_unregister_device(struct cosm_device *dev);
 int cosm_register_driver(struct cosm_driver *drv);
 void cosm_unregister_driver(struct cosm_driver *drv);
diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
index 9599d73..34534ad 100644
--- a/drivers/misc/mic/host/mic_boot.c
+++ b/drivers/misc/mic/host/mic_boot.c
@@ -586,7 +586,7 @@ static struct mic_mw *_mic_aper(struct cosm_device *cdev)
 	return &mdev->aper;
 }
 
-struct cosm_hw_ops cosm_hw_ops = {
+const struct cosm_hw_ops cosm_hw_ops = {
 	.reset = _mic_reset,
 	.force_reset = _mic_reset,
 	.post_reset = NULL,
diff --git a/drivers/misc/mic/host/mic_device.h b/drivers/misc/mic/host/mic_device.h
index 52b12b2..87a92b7 100644
--- a/drivers/misc/mic/host/mic_device.h
+++ b/drivers/misc/mic/host/mic_device.h
@@ -43,7 +43,7 @@ enum mic_stepping {
 	MIC_C0_STEP = 0x20,
 };
 
-extern struct cosm_hw_ops cosm_hw_ops;
+extern const struct cosm_hw_ops cosm_hw_ops;
 
 /**
  * struct mic_device -  MIC device information for each card.
-- 
1.9.1

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

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1482235941-22945-1-git-send-email-bhumirks@gmail.com \
    --to=bhumirks@gmail.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.dutt@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

all inboxes | Powered by JetHome®