[PATCH] scsi: ibmvscsi: constify dev_pm_ops structures
Bhumika Goyal
bhumirks at gmail.com
Sun Jan 15 15:53:17 AEDT 2017
Declare dev_pm_ops structures as const as they are only stored in the pm
field of a vio_driver structure. This field is of type const, so
dev_pm_ops structures having similar properties can be declared const.
Done using Coccinelle:
@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct dev_pm_ops i at p={...};
@ok@
identifier r1.i;
position p;
struct vio_driver x;
@@
x.pm=&i at p;
@bad@
position p!={r1.p,ok.p};
identifier r1.i;
@@
i at p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct dev_pm_ops i;
File sizes after cross compiling the .o files for powerpc architecture.
File size before:
text data bss dec hex filename
57893 5665 20 63578 f85a drivers/scsi/ibmvscsi/ibmvfc.o
File size after:
text data bss dec hex filename
58077 5481 20 63578 f85a drivers/scsi/ibmvscsi/ibmvfc.o
File size before:
text data bss dec hex filenam
20990 2816 80 23886 5d4e drivers/scsi/ibmvscsi/ibmvscsi.o
File size after:
text data bss dec hex filename
21174 2632 80 23886 5d4e drivers/scsi/ibmvscsi/ibmvscsi.o
Signed-off-by: Bhumika Goyal <bhumirks at gmail.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 2 +-
drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 78b72c2..1e1b343 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4940,7 +4940,7 @@ static unsigned long ibmvfc_get_desired_dma(struct vio_dev *vdev)
};
MODULE_DEVICE_TABLE(vio, ibmvfc_device_table);
-static struct dev_pm_ops ibmvfc_pm_ops = {
+static const struct dev_pm_ops ibmvfc_pm_ops = {
.resume = ibmvfc_resume
};
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 50cd011..b94e7b1 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -2335,7 +2335,7 @@ static int ibmvscsi_resume(struct device *dev)
};
MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table);
-static struct dev_pm_ops ibmvscsi_pm_ops = {
+static const struct dev_pm_ops ibmvscsi_pm_ops = {
.resume = ibmvscsi_resume
};
--
1.9.1
More information about the Linuxppc-dev
mailing list