diff mbox

[2/2] WIP: Provide has_alarm method

Message ID 20210317081936.26583-2-l.stelmach@samsung.com
State Rejected
Headers show

Commit Message

Łukasz Stelmach March 17, 2021, 8:19 a.m. UTC
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
 drivers/rtc/rtc-ds1307.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b21e06583bd5..dee60f459a3e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -387,6 +387,13 @@  static int ds1307_set_time(struct device *dev, struct rtc_time *t)
 	return 0;
 }
 
+static int ds1307_has_alarm(struct device *dev)
+{
+	struct ds1307 *ds1307 = dev_get_drvdata(dev);
+
+	return test_bit(HAS_ALARM, &ds1307->flags);
+}
+
 static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 {
 	struct ds1307		*ds1307 = dev_get_drvdata(dev);
@@ -1201,6 +1208,7 @@  static const struct rtc_class_ops ds13xx_rtc_ops = {
 	.read_alarm	= ds1337_read_alarm,
 	.set_alarm	= ds1337_set_alarm,
 	.alarm_irq_enable = ds1307_alarm_irq_enable,
+	.has_alarm	= ds1307_has_alarm,
 };
 
 static ssize_t frequency_test_store(struct device *dev,