[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1482235941-22945-1-git-send-email-bhumirks@gmail.com>
Date: Tue, 20 Dec 2016 17:42:21 +0530
From: Bhumika Goyal <bhumirks@...il.com>
To: julia.lawall@...6.fr, sudeep.dutt@...el.com,
ashutosh.dixit@...el.com, linux-kernel@...r.kernel.org
Cc: Bhumika Goyal <bhumirks@...il.com>
Subject: [PATCH] drivers: misc: mic: constify cosm_hw_ops structures
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@...il.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
Powered by blists - more mailing lists