* [PATCH] rtc: st-lpc: Constify st_rtc_ops
@ 2020-09-13 12:26 Rikard Falkeborn
2020-09-15 9:21 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2020-09-13 12:26 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: Patrice Chotard, linux-arm-kernel, linux-rtc, linux-kernel,
Rikard Falkeborn
The only usage of st_rtc_ops is to assign its address to the ops field
in the rtc_device struct. which is a const pointer. Make it const to
allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/rtc/rtc-st-lpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
index 51041dc08af4..0c65448b85ee 100644
--- a/drivers/rtc/rtc-st-lpc.c
+++ b/drivers/rtc/rtc-st-lpc.c
@@ -173,7 +173,7 @@ static int st_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t)
return 0;
}
-static struct rtc_class_ops st_rtc_ops = {
+static const struct rtc_class_ops st_rtc_ops = {
.read_time = st_rtc_read_time,
.set_time = st_rtc_set_time,
.read_alarm = st_rtc_read_alarm,
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: st-lpc: Constify st_rtc_ops
2020-09-13 12:26 [PATCH] rtc: st-lpc: Constify st_rtc_ops Rikard Falkeborn
@ 2020-09-15 9:21 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-09-15 9:21 UTC (permalink / raw)
To: Rikard Falkeborn, Alessandro Zummo
Cc: Alexandre Belloni, linux-rtc, linux-kernel, Patrice Chotard,
linux-arm-kernel
On Sun, 13 Sep 2020 14:26:44 +0200, Rikard Falkeborn wrote:
> The only usage of st_rtc_ops is to assign its address to the ops field
> in the rtc_device struct. which is a const pointer. Make it const to
> allow the compiler to put it in read-only memory.
Applied, thanks!
[1/1] rtc: st-lpc: Constify st_rtc_ops
commit: d0a3b65052f041852c855ea1135659770ba0bc09
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-15 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13 12:26 [PATCH] rtc: st-lpc: Constify st_rtc_ops Rikard Falkeborn
2020-09-15 9:21 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).