linux/drivers/rtc/rtc-core.h
Denis Osterland a0a1a1ba30 rtc: sysfs: facilitate attribute add to rtc device
This patches addresses following problem:
rtc_allocate_device
devm_device_add_group  <-- kernel oops / null pointer, because
			sysfs entry does not yet exist
rtc_register_device
rc = devm_device_add_group
if (rc)
	return rc;     <-- forbidden to return error code
			after device register

This patch adds rtc_add_group(s) functions.
The functions store the sum of attribute groups as device resource.

Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14 22:56:27 +02:00

63 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifdef CONFIG_RTC_INTF_DEV
extern void __init rtc_dev_init(void);
extern void __exit rtc_dev_exit(void);
extern void rtc_dev_prepare(struct rtc_device *rtc);
#else
static inline void rtc_dev_init(void)
{
}
static inline void rtc_dev_exit(void)
{
}
static inline void rtc_dev_prepare(struct rtc_device *rtc)
{
}
#endif
#ifdef CONFIG_RTC_INTF_PROC
extern void rtc_proc_add_device(struct rtc_device *rtc);
extern void rtc_proc_del_device(struct rtc_device *rtc);
#else
static inline void rtc_proc_add_device(struct rtc_device *rtc)
{
}
static inline void rtc_proc_del_device(struct rtc_device *rtc)
{
}
#endif
#ifdef CONFIG_RTC_INTF_SYSFS
const struct attribute_group **rtc_get_dev_attribute_groups(void);
int rtc_add_group(struct rtc_device *rtc, const struct attribute_group *grp);
int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps);
#else
static inline const struct attribute_group **rtc_get_dev_attribute_groups(void)
{
return NULL;
}
static inline
int rtc_add_group(struct rtc_device *rtc, const struct attribute_group *grp)
{
return 0;
}
static inline
int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps)
{
return 0;
}
#endif