]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rtc: constify rtc_class_ops structures
authorBhumika Goyal <bhumirks@gmail.com>
Thu, 5 Jan 2017 16:55:05 +0000 (22:25 +0530)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 11 Jan 2017 16:23:06 +0000 (17:23 +0100)
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>
drivers/rtc/rtc-au1xxx.c
drivers/rtc/rtc-bfin.c
drivers/rtc/rtc-dm355evm.c
drivers/rtc/rtc-imxdi.c
drivers/rtc/rtc-ls1x.c
drivers/rtc/rtc-mxc.c
drivers/rtc/rtc-sh.c

index 84d6e026784daad1d793e6d10ff7da5c0fa239fe..2ba44ccb9c3a3fe00e3e9bf2c740845001011b79 100644 (file)
@@ -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,
 };
index 535a5f9338d026ec8f433fb4960dc7227728ddf6..15344b7c07c599330366def14638236e093dbe6b 100644 (file)
@@ -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,
index 94067f8eeb103c1ff424ab17a69bf3833f02fd18..f225cd873ff6c29be6636b82a6506d77c6088b76 100644 (file)
@@ -116,7 +116,7 @@ static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm)
        return 0;
 }
 
-static struct rtc_class_ops dm355evm_rtc_ops = {
+static const struct rtc_class_ops dm355evm_rtc_ops = {
        .read_time      = dm355evm_rtc_read_time,
        .set_time       = dm355evm_rtc_set_time,
 };
index f7c772167a2d09a8edabd5d781aa417b2e3c2155..6b54f6c24c5fb0e3e3cd1972dbaa41a3a5a2ca78 100644 (file)
@@ -666,7 +666,7 @@ static int dryice_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
        return 0;
 }
 
-static struct rtc_class_ops dryice_rtc_ops = {
+static const struct rtc_class_ops dryice_rtc_ops = {
        .read_time              = dryice_rtc_read_time,
        .set_mmss               = dryice_rtc_set_mmss,
        .alarm_irq_enable       = dryice_rtc_alarm_irq_enable,
index 22a9ec4f2b836c53585880ec6cd65b222ed522df..e04ca54f21e20791fbf393de0154f4168b3c6026 100644 (file)
@@ -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,
 };
index 359876a88ac860c06304bc9738f42f1ce406c044..77319122642ab51c491655ef5ffc94a9fc8c7745 100644 (file)
@@ -353,7 +353,7 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 }
 
 /* RTC layer */
-static struct rtc_class_ops mxc_rtc_ops = {
+static const struct rtc_class_ops mxc_rtc_ops = {
        .release                = mxc_rtc_release,
        .read_time              = mxc_rtc_read_time,
        .set_mmss64             = mxc_rtc_set_mmss,
index 17b6235d67a588e9dff65f1c4689c923d939d8ff..c626e43a9cbb48f6c254517dc858dd1451c550d3 100644 (file)
@@ -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,