Move the alarm callbacks in mv_rtc_ops and clear RTC_FEATURE_ALARM to
signal that alarms are not available instead of having a supplementary
struct rtc_class_ops.

Signed-off-by: Alexandre Belloni <alexandre.bell...@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index f8e2ecea1d8d..6c526e2ec56d 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -200,11 +200,6 @@ static irqreturn_t mv_rtc_interrupt(int irq, void *data)
 static const struct rtc_class_ops mv_rtc_ops = {
        .read_time      = mv_rtc_read_time,
        .set_time       = mv_rtc_set_time,
-};
-
-static const struct rtc_class_ops mv_rtc_alarm_ops = {
-       .read_time      = mv_rtc_read_time,
-       .set_time       = mv_rtc_set_time,
        .read_alarm     = mv_rtc_read_alarm,
        .set_alarm      = mv_rtc_set_alarm,
        .alarm_irq_enable = mv_rtc_alarm_irq_enable,
@@ -268,13 +263,12 @@ static int __init mv_rtc_probe(struct platform_device 
*pdev)
                }
        }
 
-       if (pdata->irq >= 0) {
+       if (pdata->irq >= 0)
                device_init_wakeup(&pdev->dev, 1);
-               pdata->rtc->ops = &mv_rtc_alarm_ops;
-       } else {
-               pdata->rtc->ops = &mv_rtc_ops;
-       }
+       else
+               clear_bit(RTC_FEATURE_ALARM, pdata->rtc->features);
 
+       pdata->rtc->ops = &mv_rtc_ops;
        pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
        pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
 
-- 
2.29.2

Reply via email to