Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1191394
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/3] RTC: switch wakealarm attribute to DEVICE_ATTR_RW |
| Date | 2015-07-24 01:10 +0200 |
| Message-ID | <pPxMJ-4tL-19@gated-at.bofh.it> (permalink) |
| References | <pPxMJ-4tL-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Instead of using older style DEVICE_ATTR for wakealarm attribute let's
switch to using DEVICE_ATTR_RW that ensures consistent across the kernel
permissions on the attribute.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/rtc/rtc-sysfs.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 2fbc11b..e3ce1dc 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -134,8 +134,7 @@ static struct attribute *rtc_attrs[] = {
ATTRIBUTE_GROUPS(rtc);
static ssize_t
-rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
- char *buf)
+wakealarm_show(struct device *dev, struct device_attribute *attr, char *buf)
{
ssize_t retval;
unsigned long alarm;
@@ -159,7 +158,7 @@ rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
}
static ssize_t
-rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
+wakealarm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t n)
{
ssize_t retval;
@@ -221,8 +220,7 @@ rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
retval = rtc_set_alarm(rtc, &alm);
return (retval < 0) ? retval : n;
}
-static DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR,
- rtc_sysfs_show_wakealarm, rtc_sysfs_set_wakealarm);
+static DEVICE_ATTR_RW(wakealarm);
/* The reason to trigger an alarm with no process watching it (via sysfs)
--
2.5.0.rc2.392.g76e840b
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 1/3] RTC: make rtc_does_wakealarm() return boolean Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-07-24 01:10 +0200 [PATCH v2 2/3] RTC: switch wakealarm attribute to DEVICE_ATTR_RW Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-07-24 01:10 +0200 [PATCH v2 3/3] RTC: switch to using is_visible() to control sysfs attributes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-07-24 01:10 +0200
csiph-web