diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-29 16:10:58 -0400 |
commit | f21e683508ead3ad8db7ffef3d8b5802c3b43e9a (patch) | |
tree | 3bffbc80126b5be447869cb5fd9b1acc64f11153 /drivers/rtc | |
parent | b78b6b3a9af239549ea863e085223d1d4f65a608 (diff) |
rtc: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead. This converts the rtc class code to use the
correct field.
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-sysfs.c | 48 |
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 | ||
27 | static ssize_t | 27 | static ssize_t |
28 | rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, | 28 | name_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 | } |
32 | static DEVICE_ATTR_RO(name); | ||
33 | 33 | ||
34 | static ssize_t | 34 | static ssize_t |
35 | rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, | 35 | date_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 | } |
48 | static DEVICE_ATTR_RO(date); | ||
49 | 49 | ||
50 | static ssize_t | 50 | static ssize_t |
51 | rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, | 51 | time_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 | } |
64 | static DEVICE_ATTR_RO(time); | ||
65 | 65 | ||
66 | static ssize_t | 66 | static ssize_t |
67 | rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, | 67 | since_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 | } |
81 | static DEVICE_ATTR_RO(since_epoch); | ||
82 | 82 | ||
83 | static ssize_t | 83 | static ssize_t |
84 | rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr, | 84 | max_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 | ||
90 | static ssize_t | 89 | static ssize_t |
91 | rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr, | 90 | max_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 | } |
103 | static 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 | */ |
111 | static ssize_t | 111 | static ssize_t |
112 | rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr, | 112 | hctosys_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 | 123 | static DEVICE_ATTR_RO(hctosys); | |
125 | static struct device_attribute rtc_attrs[] = { | 124 | |
126 | __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), | 125 | static 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 | }; |
134 | ATTRIBUTE_GROUPS(rtc); | ||
135 | 135 | ||
136 | static ssize_t | 136 | static ssize_t |
137 | rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr, | 137 | rtc_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 | ||
262 | void __init rtc_sysfs_init(struct class *rtc_class) | 262 | void __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 | } |