rtc: ds1685: drop no_irq
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 9 Mar 2022 16:22:33 +0000 (17:22 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 23 Mar 2022 18:58:38 +0000 (19:58 +0100)
No platforms are currently setting no_irq. Anyway, letting platform_get_irq
fail is fine as this means that there is no IRQ. In that case, clear
RTC_FEATURE_ALARM so the core knows there are no alarms.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-2-alexandre.belloni@bootlin.com
drivers/rtc/rtc-ds1685.c
include/linux/rtc/ds1685.h

index 0ec1e44e3431ae01b18fa4c1d559e9c81569c64e..a24331ba8a5fc9bbce488b3e0f2810a6a6f90c2b 100644 (file)
@@ -1285,13 +1285,10 @@ ds1685_rtc_probe(struct platform_device *pdev)
         * there won't be an automatic way of notifying the kernel about it,
         * unless ctrlc is explicitly polled.
         */
-       if (!pdata->no_irq) {
-               ret = platform_get_irq(pdev, 0);
-               if (ret <= 0)
-                       return ret;
-
-               rtc->irq_num = ret;
-
+       rtc->irq_num = platform_get_irq(pdev, 0);
+       if (rtc->irq_num <= 0) {
+               clear_bit(RTC_FEATURE_ALARM, rtc_dev->features);
+       } else {
                /* Request an IRQ. */
                ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_num,
                                       NULL, ds1685_rtc_irq_handler,
@@ -1305,7 +1302,6 @@ ds1685_rtc_probe(struct platform_device *pdev)
                        rtc->irq_num = 0;
                }
        }
-       rtc->no_irq = pdata->no_irq;
 
        /* Setup complete. */
        ds1685_rtc_switch_to_bank0(rtc);
@@ -1394,7 +1390,7 @@ ds1685_rtc_poweroff(struct platform_device *pdev)
                 * have been taken care of by the shutdown scripts and this
                 * is the final function call.
                 */
-               if (!rtc->no_irq)
+               if (rtc->irq_num)
                        disable_irq_nosync(rtc->irq_num);
 
                /* Oscillator must be on and the countdown chain enabled. */
index 67ee9d20cc5aa76aaefaab949010e4afc67e76e2..5a41c3bbcbe3821ebc854976e3bfeea685689ee9 100644 (file)
@@ -46,7 +46,6 @@ struct ds1685_priv {
        u32 regstep;
        int irq_num;
        bool bcd_mode;
-       bool no_irq;
        u8 (*read)(struct ds1685_priv *, int);
        void (*write)(struct ds1685_priv *, int, u8);
        void (*prepare_poweroff)(void);