Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: m41t80: constify m41t80_rtc_ops

Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210110231752.1418816-12-alexandre.belloni@bootlin.com

+7 -7
+7 -7
drivers/rtc/rtc-m41t80.c
··· 397 397 return 0; 398 398 } 399 399 400 - static struct rtc_class_ops m41t80_rtc_ops = { 400 + static const struct rtc_class_ops m41t80_rtc_ops = { 401 401 .read_time = m41t80_rtc_read_time, 402 402 .set_time = m41t80_rtc_set_time, 403 403 .proc = m41t80_rtc_proc, 404 + .read_alarm = m41t80_read_alarm, 405 + .set_alarm = m41t80_set_alarm, 406 + .alarm_irq_enable = m41t80_alarm_irq_enable, 404 407 }; 405 408 406 409 #ifdef CONFIG_PM_SLEEP ··· 916 913 wakeup_source = false; 917 914 } 918 915 } 919 - if (client->irq > 0 || wakeup_source) { 920 - m41t80_rtc_ops.read_alarm = m41t80_read_alarm; 921 - m41t80_rtc_ops.set_alarm = m41t80_set_alarm; 922 - m41t80_rtc_ops.alarm_irq_enable = m41t80_alarm_irq_enable; 923 - /* Enable the wakealarm */ 916 + if (client->irq > 0 || wakeup_source) 924 917 device_init_wakeup(&client->dev, true); 925 - } 918 + else 919 + clear_bit(RTC_FEATURE_ALARM, m41t80_data->rtc->features); 926 920 927 921 m41t80_data->rtc->ops = &m41t80_rtc_ops; 928 922 m41t80_data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;