diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-21 18:44:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-22 14:05:43 -0400 |
commit | 94c9e6d665011a9926c5f6fd349a6c665093e721 (patch) | |
tree | 74e0a45de97b3d2d8faac39266944e7d4a285eab | |
parent | 729fb9d33fe239e350a7e33e9f6aec2767086bd4 (diff) |
w1: slaves: w1_ds2423: convert to use w1_family_ops.groups
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/w1/slaves/w1_ds2423.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/w1/slaves/w1_ds2423.c b/drivers/w1/slaves/w1_ds2423.c index 7f86aec74088..7e41b7d91fb5 100644 --- a/drivers/w1/slaves/w1_ds2423.c +++ b/drivers/w1/slaves/w1_ds2423.c | |||
@@ -40,14 +40,8 @@ | |||
40 | #define COUNTER_COUNT 4 | 40 | #define COUNTER_COUNT 4 |
41 | #define READ_BYTE_COUNT 42 | 41 | #define READ_BYTE_COUNT 42 |
42 | 42 | ||
43 | static ssize_t w1_counter_read(struct device *device, | 43 | static ssize_t w1_slave_show(struct device *device, |
44 | struct device_attribute *attr, char *buf); | 44 | struct device_attribute *attr, char *out_buf) |
45 | |||
46 | static struct device_attribute w1_counter_attr = | ||
47 | __ATTR(w1_slave, S_IRUGO, w1_counter_read, NULL); | ||
48 | |||
49 | static ssize_t w1_counter_read(struct device *device, | ||
50 | struct device_attribute *attr, char *out_buf) | ||
51 | { | 45 | { |
52 | struct w1_slave *sl = dev_to_w1_slave(device); | 46 | struct w1_slave *sl = dev_to_w1_slave(device); |
53 | struct w1_master *dev = sl->master; | 47 | struct w1_master *dev = sl->master; |
@@ -128,19 +122,16 @@ static ssize_t w1_counter_read(struct device *device, | |||
128 | return PAGE_SIZE - c; | 122 | return PAGE_SIZE - c; |
129 | } | 123 | } |
130 | 124 | ||
131 | static int w1_f1d_add_slave(struct w1_slave *sl) | 125 | static DEVICE_ATTR_RO(w1_slave); |
132 | { | ||
133 | return device_create_file(&sl->dev, &w1_counter_attr); | ||
134 | } | ||
135 | 126 | ||
136 | static void w1_f1d_remove_slave(struct w1_slave *sl) | 127 | static struct attribute *w1_f1d_attrs[] = { |
137 | { | 128 | &dev_attr_w1_slave.attr, |
138 | device_remove_file(&sl->dev, &w1_counter_attr); | 129 | NULL, |
139 | } | 130 | }; |
131 | ATTRIBUTE_GROUPS(w1_f1d); | ||
140 | 132 | ||
141 | static struct w1_family_ops w1_f1d_fops = { | 133 | static struct w1_family_ops w1_f1d_fops = { |
142 | .add_slave = w1_f1d_add_slave, | 134 | .groups = w1_f1d_groups, |
143 | .remove_slave = w1_f1d_remove_slave, | ||
144 | }; | 135 | }; |
145 | 136 | ||
146 | static struct w1_family w1_family_1d = { | 137 | static struct w1_family w1_family_1d = { |