summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-09-23 10:31:33 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-05-23 16:41:09 +0100
commitbc24295f9a91e7b67b3f088e471acc9629143fec (patch)
tree7ec5f4d77652c4d89a0e8855a70195c56a177d6c
parent13eda90f1d106a82541c38ea3e0c2a1224f3491e (diff)
rtc: pre-register hook
Add a pre-register hook to allow RTC drivers to adjust the default set_offset_nsec value. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/rtc/class.c3
-rw-r--r--include/linux/rtc.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 3c8eec2218df..afb1f0e0e818 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -410,6 +410,9 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc)
if (!err && !rtc_valid_tm(&alrm.time))
rtc_initialize_alarm(rtc, &alrm);
+ if (rtc->ops->pre_register)
+ rtc->ops->pre_register(rtc);
+
rtc_dev_prepare(rtc);
err = cdev_device_add(&rtc->char_dev, &rtc->dev);
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 1fd9c6a21ebe..14241f985ad0 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -44,6 +44,8 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
extern struct class *rtc_class;
+struct rtc_device;
+
/*
* For these RTC methods the device parameter is the physical device
* on whatever bus holds the hardware (I2C, Platform, SPI, etc), which
@@ -68,6 +70,7 @@ struct rtc_class_ops {
int (*set_offset)(struct device *, long offset);
int (*param_get)(struct device *, struct rtc_param *param);
int (*param_set)(struct device *, struct rtc_param *param);
+ void (*pre_register)(struct rtc_device *);
};
struct rtc_device;