diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-07-06 11:42:00 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-07-07 13:14:10 +0200 |
commit | 3068a254d5519cd5116f61297462da6d1aa84c20 (patch) | |
tree | 996896001b788c362f3de5e63c5ed9141f661754 /include/linux/rtc.h | |
parent | b91336df8ac2f5d15a2132074ba596580526db1d (diff) | |
download | linux-3068a254d5519cd5116f61297462da6d1aa84c20.tar.gz linux-3068a254d5519cd5116f61297462da6d1aa84c20.tar.bz2 linux-3068a254d5519cd5116f61297462da6d1aa84c20.zip |
rtc: introduce new registration method
Introduce rtc_register_device() to register an already allocated and
initialized struct rtc_device. It automatically sets up the owner and the
two steps allocation/registration will allow to remove race conditions in
the IRQ handling of some driver. It also allows to properly extend the core
without adding more arguments to rtc_device_register().
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'include/linux/rtc.h')
-rw-r--r-- | include/linux/rtc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index d354f56e0cf5..8e4a5f44f59e 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -142,6 +142,8 @@ struct rtc_device { /* Some hardware can't support UIE mode */ int uie_unsupported; + bool registered; + #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL struct work_struct uie_task; struct timer_list uie_timer; @@ -163,6 +165,8 @@ extern struct rtc_device *devm_rtc_device_register(struct device *dev, const char *name, const struct rtc_class_ops *ops, struct module *owner); +struct rtc_device *devm_rtc_allocate_device(struct device *dev); +int __rtc_register_device(struct module *owner, struct rtc_device *rtc); extern void rtc_device_unregister(struct rtc_device *rtc); extern void devm_rtc_device_unregister(struct device *dev, struct rtc_device *rtc); @@ -218,6 +222,9 @@ static inline bool is_leap_year(unsigned int year) return (!(year % 4) && (year % 100)) || !(year % 400); } +#define rtc_register_device(device) \ + __rtc_register_device(THIS_MODULE, device) + #ifdef CONFIG_RTC_HCTOSYS_DEVICE extern int rtc_hctosys_ret; #else |