diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-26 21:05:17 -0400 |
commit | d98259cbf9f1c86e921caa1241aa8d229249e0b8 (patch) | |
tree | 0fea31092914363f7d4920faec84be6e8bd4df13 /drivers/isdn | |
parent | 34da5e6770ac06df770a0355b417155e6e84e263 (diff) |
ISDN: 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 mISDN class code to use the
correct field.
Acked-by: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/mISDN/core.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c index da30c5cb9609..faf505462a4f 100644 --- a/drivers/isdn/mISDN/core.c +++ b/drivers/isdn/mISDN/core.c | |||
@@ -37,8 +37,8 @@ static void mISDN_dev_release(struct device *dev) | |||
37 | /* nothing to do: the device is part of its parent's data structure */ | 37 | /* nothing to do: the device is part of its parent's data structure */ |
38 | } | 38 | } |
39 | 39 | ||
40 | static ssize_t _show_id(struct device *dev, | 40 | static ssize_t id_show(struct device *dev, |
41 | struct device_attribute *attr, char *buf) | 41 | struct device_attribute *attr, char *buf) |
42 | { | 42 | { |
43 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 43 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
44 | 44 | ||
@@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *dev, | |||
46 | return -ENODEV; | 46 | return -ENODEV; |
47 | return sprintf(buf, "%d\n", mdev->id); | 47 | return sprintf(buf, "%d\n", mdev->id); |
48 | } | 48 | } |
49 | static DEVICE_ATTR_RO(id); | ||
49 | 50 | ||
50 | static ssize_t _show_nrbchan(struct device *dev, | 51 | static ssize_t nrbchan_show(struct device *dev, |
51 | struct device_attribute *attr, char *buf) | 52 | struct device_attribute *attr, char *buf) |
52 | { | 53 | { |
53 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 54 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
54 | 55 | ||
@@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct device *dev, | |||
56 | return -ENODEV; | 57 | return -ENODEV; |
57 | return sprintf(buf, "%d\n", mdev->nrbchan); | 58 | return sprintf(buf, "%d\n", mdev->nrbchan); |
58 | } | 59 | } |
60 | static DEVICE_ATTR_RO(nrbchan); | ||
59 | 61 | ||
60 | static ssize_t _show_d_protocols(struct device *dev, | 62 | static ssize_t d_protocols_show(struct device *dev, |
61 | struct device_attribute *attr, char *buf) | 63 | struct device_attribute *attr, char *buf) |
62 | { | 64 | { |
63 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 65 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
64 | 66 | ||
@@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct device *dev, | |||
66 | return -ENODEV; | 68 | return -ENODEV; |
67 | return sprintf(buf, "%d\n", mdev->Dprotocols); | 69 | return sprintf(buf, "%d\n", mdev->Dprotocols); |
68 | } | 70 | } |
71 | static DEVICE_ATTR_RO(d_protocols); | ||
69 | 72 | ||
70 | static ssize_t _show_b_protocols(struct device *dev, | 73 | static ssize_t b_protocols_show(struct device *dev, |
71 | struct device_attribute *attr, char *buf) | 74 | struct device_attribute *attr, char *buf) |
72 | { | 75 | { |
73 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 76 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
74 | 77 | ||
@@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct device *dev, | |||
76 | return -ENODEV; | 79 | return -ENODEV; |
77 | return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); | 80 | return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); |
78 | } | 81 | } |
82 | static DEVICE_ATTR_RO(b_protocols); | ||
79 | 83 | ||
80 | static ssize_t _show_protocol(struct device *dev, | 84 | static ssize_t protocol_show(struct device *dev, |
81 | struct device_attribute *attr, char *buf) | 85 | struct device_attribute *attr, char *buf) |
82 | { | 86 | { |
83 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 87 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
84 | 88 | ||
@@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct device *dev, | |||
86 | return -ENODEV; | 90 | return -ENODEV; |
87 | return sprintf(buf, "%d\n", mdev->D.protocol); | 91 | return sprintf(buf, "%d\n", mdev->D.protocol); |
88 | } | 92 | } |
93 | static DEVICE_ATTR_RO(protocol); | ||
89 | 94 | ||
90 | static ssize_t _show_name(struct device *dev, | 95 | static ssize_t name_show(struct device *dev, |
91 | struct device_attribute *attr, char *buf) | 96 | struct device_attribute *attr, char *buf) |
92 | { | 97 | { |
93 | strcpy(buf, dev_name(dev)); | 98 | strcpy(buf, dev_name(dev)); |
94 | return strlen(buf); | 99 | return strlen(buf); |
95 | } | 100 | } |
101 | static DEVICE_ATTR_RO(name); | ||
96 | 102 | ||
97 | #if 0 /* hangs */ | 103 | #if 0 /* hangs */ |
98 | static ssize_t _set_name(struct device *dev, struct device_attribute *attr, | 104 | static ssize_t name_set(struct device *dev, struct device_attribute *attr, |
99 | const char *buf, size_t count) | 105 | const char *buf, size_t count) |
100 | { | 106 | { |
101 | int err = 0; | 107 | int err = 0; |
102 | char *out = kmalloc(count + 1, GFP_KERNEL); | 108 | char *out = kmalloc(count + 1, GFP_KERNEL); |
@@ -113,10 +119,11 @@ static ssize_t _set_name(struct device *dev, struct device_attribute *attr, | |||
113 | 119 | ||
114 | return (err < 0) ? err : count; | 120 | return (err < 0) ? err : count; |
115 | } | 121 | } |
122 | static DEVICE_ATTR_RW(name); | ||
116 | #endif | 123 | #endif |
117 | 124 | ||
118 | static ssize_t _show_channelmap(struct device *dev, | 125 | static ssize_t channelmap_show(struct device *dev, |
119 | struct device_attribute *attr, char *buf) | 126 | struct device_attribute *attr, char *buf) |
120 | { | 127 | { |
121 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 128 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
122 | char *bp = buf; | 129 | char *bp = buf; |
@@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct device *dev, | |||
127 | 134 | ||
128 | return bp - buf; | 135 | return bp - buf; |
129 | } | 136 | } |
130 | 137 | static DEVICE_ATTR_RO(channelmap); | |
131 | static struct device_attribute mISDN_dev_attrs[] = { | 138 | |
132 | __ATTR(id, S_IRUGO, _show_id, NULL), | 139 | static struct attribute *mISDN_attrs[] = { |
133 | __ATTR(d_protocols, S_IRUGO, _show_d_protocols, NULL), | 140 | &dev_attr_id.attr, |
134 | __ATTR(b_protocols, S_IRUGO, _show_b_protocols, NULL), | 141 | &dev_attr_d_protocols.attr, |
135 | __ATTR(protocol, S_IRUGO, _show_protocol, NULL), | 142 | &dev_attr_b_protocols.attr, |
136 | __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), | 143 | &dev_attr_protocol.attr, |
137 | __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), | 144 | &dev_attr_channelmap.attr, |
138 | __ATTR(name, S_IRUGO, _show_name, NULL), | 145 | &dev_attr_nrbchan.attr, |
139 | /* __ATTR(name, S_IRUGO | S_IWUSR, _show_name, _set_name), */ | 146 | &dev_attr_name.attr, |
140 | {} | 147 | NULL, |
141 | }; | 148 | }; |
149 | ATTRIBUTE_GROUPS(mISDN); | ||
142 | 150 | ||
143 | static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) | 151 | static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) |
144 | { | 152 | { |
@@ -162,7 +170,7 @@ static struct class mISDN_class = { | |||
162 | .name = "mISDN", | 170 | .name = "mISDN", |
163 | .owner = THIS_MODULE, | 171 | .owner = THIS_MODULE, |
164 | .dev_uevent = mISDN_uevent, | 172 | .dev_uevent = mISDN_uevent, |
165 | .dev_attrs = mISDN_dev_attrs, | 173 | .dev_groups = mISDN_groups, |
166 | .dev_release = mISDN_dev_release, | 174 | .dev_release = mISDN_dev_release, |
167 | .class_release = mISDN_class_release, | 175 | .class_release = mISDN_class_release, |
168 | }; | 176 | }; |