aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 14:37:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 14:37:15 -0400
commit542a086ac72fb193cbc1b996963a572269e57743 (patch)
treeb137c08037cca4ffc8a156a891a01113b3b8edce /drivers/rtc
parent1d1fdd95df681f0c065d90ffaafa215a0e8825e2 (diff)
parent1eeeef153c02f5856ec109fa532eb5f31c39f85c (diff)
Merge tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core patches from Greg KH: "Here's the big driver core pull request for 3.12-rc1. Lots of tiny changes here fixing up the way sysfs attributes are created, to try to make drivers simpler, and fix a whole class race conditions with creations of device attributes after the device was announced to userspace. All the various pieces are acked by the different subsystem maintainers" * tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (119 commits) firmware loader: fix pending_fw_head list corruption drivers/base/memory.c: introduce help macro to_memory_block dynamic debug: line queries failing due to uninitialized local variable sysfs: sysfs_create_groups returns a value. debugfs: provide debugfs_create_x64() when disabled rbd: convert bus code to use bus_groups firmware: dcdbas: use binary attribute groups sysfs: add sysfs_create/remove_groups for when SYSFS is not enabled driver core: add #include <linux/sysfs.h> to core files. HID: convert bus code to use dev_groups Input: serio: convert bus code to use drv_groups Input: gameport: convert bus code to use drv_groups driver core: firmware: use __ATTR_RW() driver core: core: use DEVICE_ATTR_RO driver core: bus: use DRIVER_ATTR_WO() driver core: create write-only attribute macros for devices and drivers sysfs: create __ATTR_WO() driver-core: platform: convert bus code to use dev_groups workqueue: convert bus code to use dev_groups MEI: convert bus code to use dev_groups ...
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sysfs.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 4b26f8672b2d..babd43bf3ddc 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -25,15 +25,14 @@
25 */ 25 */
26 26
27static ssize_t 27static ssize_t
28rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, 28name_show(struct device *dev, struct device_attribute *attr, char *buf)
29 char *buf)
30{ 29{
31 return sprintf(buf, "%s\n", to_rtc_device(dev)->name); 30 return sprintf(buf, "%s\n", to_rtc_device(dev)->name);
32} 31}
32static DEVICE_ATTR_RO(name);
33 33
34static ssize_t 34static ssize_t
35rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, 35date_show(struct device *dev, struct device_attribute *attr, char *buf)
36 char *buf)
37{ 36{
38 ssize_t retval; 37 ssize_t retval;
39 struct rtc_time tm; 38 struct rtc_time tm;
@@ -46,10 +45,10 @@ rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr,
46 45
47 return retval; 46 return retval;
48} 47}
48static DEVICE_ATTR_RO(date);
49 49
50static ssize_t 50static ssize_t
51rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, 51time_show(struct device *dev, struct device_attribute *attr, char *buf)
52 char *buf)
53{ 52{
54 ssize_t retval; 53 ssize_t retval;
55 struct rtc_time tm; 54 struct rtc_time tm;
@@ -62,10 +61,10 @@ rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr,
62 61
63 return retval; 62 return retval;
64} 63}
64static DEVICE_ATTR_RO(time);
65 65
66static ssize_t 66static ssize_t
67rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, 67since_epoch_show(struct device *dev, struct device_attribute *attr, char *buf)
68 char *buf)
69{ 68{
70 ssize_t retval; 69 ssize_t retval;
71 struct rtc_time tm; 70 struct rtc_time tm;
@@ -79,16 +78,16 @@ rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr,
79 78
80 return retval; 79 return retval;
81} 80}
81static DEVICE_ATTR_RO(since_epoch);
82 82
83static ssize_t 83static ssize_t
84rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr, 84max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf)
85 char *buf)
86{ 85{
87 return sprintf(buf, "%d\n", to_rtc_device(dev)->max_user_freq); 86 return sprintf(buf, "%d\n", to_rtc_device(dev)->max_user_freq);
88} 87}
89 88
90static ssize_t 89static ssize_t
91rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr, 90max_user_freq_store(struct device *dev, struct device_attribute *attr,
92 const char *buf, size_t n) 91 const char *buf, size_t n)
93{ 92{
94 struct rtc_device *rtc = to_rtc_device(dev); 93 struct rtc_device *rtc = to_rtc_device(dev);
@@ -101,6 +100,7 @@ rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
101 100
102 return n; 101 return n;
103} 102}
103static DEVICE_ATTR_RW(max_user_freq);
104 104
105/** 105/**
106 * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time 106 * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time
@@ -109,8 +109,7 @@ rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
109 * boot or resume event. 109 * boot or resume event.
110 */ 110 */
111static ssize_t 111static ssize_t
112rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr, 112hctosys_show(struct device *dev, struct device_attribute *attr, char *buf)
113 char *buf)
114{ 113{
115#ifdef CONFIG_RTC_HCTOSYS_DEVICE 114#ifdef CONFIG_RTC_HCTOSYS_DEVICE
116 if (rtc_hctosys_ret == 0 && 115 if (rtc_hctosys_ret == 0 &&
@@ -121,17 +120,18 @@ rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr,
121#endif 120#endif
122 return sprintf(buf, "0\n"); 121 return sprintf(buf, "0\n");
123} 122}
124 123static DEVICE_ATTR_RO(hctosys);
125static struct device_attribute rtc_attrs[] = { 124
126 __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), 125static struct attribute *rtc_attrs[] = {
127 __ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL), 126 &dev_attr_name.attr,
128 __ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL), 127 &dev_attr_date.attr,
129 __ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL), 128 &dev_attr_time.attr,
130 __ATTR(max_user_freq, S_IRUGO | S_IWUSR, rtc_sysfs_show_max_user_freq, 129 &dev_attr_since_epoch.attr,
131 rtc_sysfs_set_max_user_freq), 130 &dev_attr_max_user_freq.attr,
132 __ATTR(hctosys, S_IRUGO, rtc_sysfs_show_hctosys, NULL), 131 &dev_attr_hctosys.attr,
133 { }, 132 NULL,
134}; 133};
134ATTRIBUTE_GROUPS(rtc);
135 135
136static ssize_t 136static ssize_t
137rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr, 137rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
@@ -261,5 +261,5 @@ void rtc_sysfs_del_device(struct rtc_device *rtc)
261 261
262void __init rtc_sysfs_init(struct class *rtc_class) 262void __init rtc_sysfs_init(struct class *rtc_class)
263{ 263{
264 rtc_class->dev_attrs = rtc_attrs; 264 rtc_class->dev_groups = rtc_groups;
265} 265}