drivers: misc: mic: constify cosm_hw_ops structures
PATCH 1/1 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 <[email protected]>
--- 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(-)
drivers/misc/mic/bus/cosm_bus.c +1 -1
@@ -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;
drivers/misc/mic/bus/cosm_bus.h +2 -2
@@ -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);
drivers/misc/mic/host/mic_boot.c +1 -1
@@ -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 ,
drivers/misc/mic/host/mic_device.h +1 -1
@@ -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.
Signature · 1 line
1.9.1