static void rtc_sysfs_remove_device(struct class_device *class_dev, struct class_interface *class_intf) { if (rtc_does_wakealarm(class_dev)) class_device_remove_file(class_dev, &class_device_attr_wakealarm); #ifdef CONFIG_RTC_WAKERS if (rtc_does_wakealarm(class_dev)) wakers_unregister(class_dev); #endif sysfs_remove_group(&class_dev->kobj, &rtc_attr_group); }
static int rtc_sysfs_add_device(struct class_device *class_dev, struct class_interface *class_intf) { int err; dev_dbg(class_dev->dev, "rtc intf: sysfs\n"); err = sysfs_create_group(&class_dev->kobj, &rtc_attr_group); if (err) dev_err(class_dev->dev, "failed to create %s\n", "sysfs attributes"); else if (rtc_does_wakealarm(class_dev)) { /* not all RTCs support both alarms and wakeup */ err = class_device_create_file(class_dev, &class_device_attr_wakealarm); if (err) { dev_err(class_dev->dev, "failed to create %s\n", "alarm attribute"); sysfs_remove_group(&class_dev->kobj, &rtc_attr_group); } #ifdef CONFIG_RTC_WAKERS err = wakers_register(class_dev); if (err) { dev_err(class_dev->dev, "failed to create %s\n", "alarm attribute"); sysfs_remove_group(&class_dev->kobj, &rtc_attr_group); } #endif } return err; }
void rtc_sysfs_add_device(struct rtc_device *rtc) { int err; /* not all RTCs support both alarms and wakeup */ if (!rtc_does_wakealarm(rtc)) return; err = device_create_file(&rtc->dev, &dev_attr_wakealarm); if (err) dev_err(rtc->dev.parent, "failed to create alarm attribute, %d\n", err); }
static umode_t rtc_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) { struct device *dev = container_of(kobj, struct device, kobj); struct rtc_device *rtc = to_rtc_device(dev); umode_t mode = attr->mode; if (attr == &dev_attr_wakealarm.attr) { if (!rtc_does_wakealarm(rtc)) mode = 0; } else if (attr == &dev_attr_offset.attr) { if (!rtc->ops->set_offset) mode = 0; } return mode; }
void rtc_sysfs_add_device(struct rtc_device *rtc) { int err1; int err2; /* not all RTCs support both alarms and wakeup */ if (!rtc_does_wakealarm(rtc)) return; err1 = device_create_file(&rtc->dev, &dev_attr_wakealarm) ; if (err1) dev_err(rtc->dev.parent, "failed to create alarm attribute, %d\n", err1); ///***linda add****/// err2 = device_create_file(&rtc->dev, &dev_attr_wakeup_enable) ; if (err2) dev_err(rtc->dev.parent, "failed to create alarm attribute, %d\n", err2); }
void rtc_sysfs_del_device(struct rtc_device *rtc) { /* REVISIT did we add it successfully? */ if (rtc_does_wakealarm(rtc)) device_remove_file(&rtc->dev, &dev_attr_wakealarm); }
void rtc_sysfs_del_device(struct rtc_device *rtc) { if (rtc_does_wakealarm(rtc)) device_remove_file(&rtc->dev, &dev_attr_wakealarm); }