rtc: s5m: enable wakeup only when available
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 4 Aug 2021 10:41:31 +0000 (12:41 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 6 Aug 2021 08:31:59 +0000 (10:31 +0200)
Call device_init_wakeup() only when alarms are available and the RTC is
actually able to wake up the system.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210804104133.5158-3-alexandre.belloni@bootlin.com
drivers/rtc/rtc-s5m.c

index ee19569..87df797 100644 (file)
@@ -786,8 +786,6 @@ static int s5m_rtc_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       device_init_wakeup(&pdev->dev, 1);
-
        info->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(info->rtc_dev))
                return PTR_ERR(info->rtc_dev);
@@ -805,6 +803,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
                                info->irq, ret);
                        return ret;
                }
+               device_init_wakeup(&pdev->dev, 1);
        }
 
        return devm_rtc_register_device(info->rtc_dev);