diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2017-01-05 11:55:05 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-01-11 11:23:06 -0500 |
commit | 8bc57e7f11971665b4a7886305dffcd27213d718 (patch) | |
tree | 8e76735d0af7e67ff700dcd54a7e1af67ab5b86b | |
parent | a734cc9ba37188f074f8b81125db05ca00d71d00 (diff) |
rtc: constify rtc_class_ops structures
Declare rtc_class_ops structures as const as they are only passed
as an argument to the function devm_rtc_device_register. This argument
is of type const struct rtc_class_ops *, so rtc_class_ops structures
having this property can be declared const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct rtc_class_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
@@
devm_rtc_device_register(...,&i@p,...)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct rtc_class_ops i;
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | drivers/rtc/rtc-au1xxx.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-bfin.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-dm355evm.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-imxdi.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-ls1x.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-mxc.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-sh.c | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-au1xxx.c b/drivers/rtc/rtc-au1xxx.c index 84d6e026784d..2ba44ccb9c3a 100644 --- a/drivers/rtc/rtc-au1xxx.c +++ b/drivers/rtc/rtc-au1xxx.c | |||
@@ -56,7 +56,7 @@ static int au1xtoy_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | static struct rtc_class_ops au1xtoy_rtc_ops = { | 59 | static const struct rtc_class_ops au1xtoy_rtc_ops = { |
60 | .read_time = au1xtoy_rtc_read_time, | 60 | .read_time = au1xtoy_rtc_read_time, |
61 | .set_time = au1xtoy_rtc_set_time, | 61 | .set_time = au1xtoy_rtc_set_time, |
62 | }; | 62 | }; |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 535a5f9338d0..15344b7c07c5 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -333,7 +333,7 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq) | |||
333 | #undef yesno | 333 | #undef yesno |
334 | } | 334 | } |
335 | 335 | ||
336 | static struct rtc_class_ops bfin_rtc_ops = { | 336 | static const struct rtc_class_ops bfin_rtc_ops = { |
337 | .read_time = bfin_rtc_read_time, | 337 | .read_time = bfin_rtc_read_time, |
338 | .set_time = bfin_rtc_set_time, | 338 | .set_time = bfin_rtc_set_time, |
339 | .read_alarm = bfin_rtc_read_alarm, | 339 | .read_alarm = bfin_rtc_read_alarm, |
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c index 94067f8eeb10..f225cd873ff6 100644 --- a/drivers/rtc/rtc-dm355evm.c +++ b/drivers/rtc/rtc-dm355evm.c | |||
@@ -116,7 +116,7 @@ static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
118 | 118 | ||
119 | static struct rtc_class_ops dm355evm_rtc_ops = { | 119 | static const struct rtc_class_ops dm355evm_rtc_ops = { |
120 | .read_time = dm355evm_rtc_read_time, | 120 | .read_time = dm355evm_rtc_read_time, |
121 | .set_time = dm355evm_rtc_set_time, | 121 | .set_time = dm355evm_rtc_set_time, |
122 | }; | 122 | }; |
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index f7c772167a2d..6b54f6c24c5f 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
@@ -666,7 +666,7 @@ static int dryice_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
666 | return 0; | 666 | return 0; |
667 | } | 667 | } |
668 | 668 | ||
669 | static struct rtc_class_ops dryice_rtc_ops = { | 669 | static const struct rtc_class_ops dryice_rtc_ops = { |
670 | .read_time = dryice_rtc_read_time, | 670 | .read_time = dryice_rtc_read_time, |
671 | .set_mmss = dryice_rtc_set_mmss, | 671 | .set_mmss = dryice_rtc_set_mmss, |
672 | .alarm_irq_enable = dryice_rtc_alarm_irq_enable, | 672 | .alarm_irq_enable = dryice_rtc_alarm_irq_enable, |
diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c index 22a9ec4f2b83..e04ca54f21e2 100644 --- a/drivers/rtc/rtc-ls1x.c +++ b/drivers/rtc/rtc-ls1x.c | |||
@@ -138,7 +138,7 @@ err: | |||
138 | return ret; | 138 | return ret; |
139 | } | 139 | } |
140 | 140 | ||
141 | static struct rtc_class_ops ls1x_rtc_ops = { | 141 | static const struct rtc_class_ops ls1x_rtc_ops = { |
142 | .read_time = ls1x_rtc_read_time, | 142 | .read_time = ls1x_rtc_read_time, |
143 | .set_time = ls1x_rtc_set_time, | 143 | .set_time = ls1x_rtc_set_time, |
144 | }; | 144 | }; |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 359876a88ac8..77319122642a 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
@@ -353,7 +353,7 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | /* RTC layer */ | 355 | /* RTC layer */ |
356 | static struct rtc_class_ops mxc_rtc_ops = { | 356 | static const struct rtc_class_ops mxc_rtc_ops = { |
357 | .release = mxc_rtc_release, | 357 | .release = mxc_rtc_release, |
358 | .read_time = mxc_rtc_read_time, | 358 | .read_time = mxc_rtc_read_time, |
359 | .set_mmss64 = mxc_rtc_set_mmss, | 359 | .set_mmss64 = mxc_rtc_set_mmss, |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 17b6235d67a5..c626e43a9cbb 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -535,7 +535,7 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | static struct rtc_class_ops sh_rtc_ops = { | 538 | static const struct rtc_class_ops sh_rtc_ops = { |
539 | .read_time = sh_rtc_read_time, | 539 | .read_time = sh_rtc_read_time, |
540 | .set_time = sh_rtc_set_time, | 540 | .set_time = sh_rtc_set_time, |
541 | .read_alarm = sh_rtc_read_alarm, | 541 | .read_alarm = sh_rtc_read_alarm, |