lkml.org 
[lkml]   [2021]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] rtc: ds1307: set uie_unsupported if no interrupt is available
Date

For an RTC without an IRQ assigned rtc_update_irq_enable() should
return -EINVAL. It will, when uie_unsupported is set.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
drivers/rtc/rtc-ds1307.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index cd8e438bc9c4..b08a9736fa77 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1973,13 +1973,6 @@ static int ds1307_probe(struct i2c_client *client,
if (IS_ERR(ds1307->rtc))
return PTR_ERR(ds1307->rtc);

- if (ds1307_can_wakeup_device && !want_irq) {
- dev_info(ds1307->dev,
- "'wakeup-source' is set, request for an IRQ is disabled!\n");
- /* We cannot support UIE mode if we do not have an IRQ line */
- ds1307->rtc->uie_unsupported = 1;
- }
-
if (want_irq) {
err = devm_request_threaded_irq(ds1307->dev, client->irq, NULL,
chip->irq_handler ?: ds1307_irq,
@@ -1993,6 +1986,13 @@ static int ds1307_probe(struct i2c_client *client,
} else {
dev_dbg(ds1307->dev, "got IRQ %d\n", client->irq);
}
+ } else {
+ if (ds1307_can_wakeup_device)
+ dev_info(ds1307->dev,
+ "'wakeup-source' is set, request for an IRQ is disabled!\n");
+
+ /* We cannot support UIE mode if we do not have an IRQ line */
+ ds1307->rtc->uie_unsupported = 1;
}

ds1307->rtc->ops = chip->rtc_ops ?: &ds13xx_rtc_ops;
--
2.26.2
\
 
 \ /
  Last update: 2021-03-08 09:37    [W:0.099 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site