From 8bc57e7f11971665b4a7886305dffcd27213d718 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Thu, 5 Jan 2017 22:25:05 +0530 Subject: 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 Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/rtc/rtc-mxc.c') 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) } /* 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, -- cgit v1.2.3