rtc: add const to rtc_class_ops structures
PATCH 1/1 rtc: add const to 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;
---
Compilation was terminated while compiling the .o files for all the changed .c files. Therefore file size details of the .o files could not be obtained.
drivers/rtc/rtc-au1xxx.c | 2 +- drivers/rtc/rtc-bfin.c | 2 +- drivers/rtc/rtc-ls1x.c | 2 +- drivers/rtc/rtc-sh.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/rtc/rtc-au1xxx.c +1 -1
@@ -56,7 +56,7 @@ static int au1xtoy_rtc_set_time(struct device *dev, struct rtc_time *tm)return 0 ; } -static struct rtc_class_ops au1xtoy_rtc_ops = { +static const struct rtc_class_ops au1xtoy_rtc_ops = { .read_time = au1xtoy_rtc_read_time, .set_time = au1xtoy_rtc_set_time, };
drivers/rtc/rtc-bfin.c +1 -1
@@ -333,7 +333,7 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)#undef yesno } -static struct rtc_class_ops bfin_rtc_ops = { +static const struct rtc_class_ops bfin_rtc_ops = { .read_time = bfin_rtc_read_time, .set_time = bfin_rtc_set_time, .read_alarm = bfin_rtc_read_alarm,
drivers/rtc/rtc-ls1x.c +1 -1
@@ -138,7 +138,7 @@ static int ls1x_rtc_set_time(struct device *dev, struct rtc_time *rtm)return ret; } -static struct rtc_class_ops ls1x_rtc_ops = { +static const struct rtc_class_ops ls1x_rtc_ops = { .read_time = ls1x_rtc_read_time, .set_time = ls1x_rtc_set_time, };
drivers/rtc/rtc-sh.c +1 -1
@@ -535,7 +535,7 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)return 0 ; } -static struct rtc_class_ops sh_rtc_ops = { +static const struct rtc_class_ops sh_rtc_ops = { .read_time = sh_rtc_read_time, .set_time = sh_rtc_set_time, .read_alarm = sh_rtc_read_alarm,
Signature · 11 lines
1.9.1 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
Quoted 36 lines · Bhumika Goyal
Declare
rtc_class_opsstructures as const as they are only passed as an argument to the functiondevm_rtc_device_register. This argument is of type const structrtc_class_ops*, sortc_class_opsstructures having this property can be declared const.
Done using Coccinelle:@r1 disable
optional_qualifier@
identifier i;
position p;
@@
static structrtc_class_opsi@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
structrtc_class_opsi;Signed-off-by Bhumika Goyal <[email protected]>---
Compilation was terminated while compiling the .o files for all the changed .c files. Therefore file size details of the .o files could not be obtained.
Quoted 6 lines
drivers/rtc/rtc-au1xxx.c | 2 +- drivers/rtc/rtc-bfin.c | 2 +- drivers/rtc/rtc-ls1x.c | 2 +- drivers/rtc/rtc-sh.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
Applied and squashed in the previous one.
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.