diff options
Diffstat (limited to 'drivers/message/i2o/device.c')
-rw-r--r-- | drivers/message/i2o/device.c | 71 |
1 files changed, 13 insertions, 58 deletions
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c index 551d582e2887..d9879965eb50 100644 --- a/drivers/message/i2o/device.c +++ b/drivers/message/i2o/device.c | |||
@@ -138,17 +138,6 @@ static void i2o_device_release(struct device *dev) | |||
138 | kfree(i2o_dev); | 138 | kfree(i2o_dev); |
139 | } | 139 | } |
140 | 140 | ||
141 | /** | ||
142 | * i2o_device_class_release - I2O class device release function | ||
143 | * @cd: I2O class device which is added to the I2O device class | ||
144 | * | ||
145 | * The function is just a stub - memory will be freed when | ||
146 | * associated I2O device is released. | ||
147 | */ | ||
148 | static void i2o_device_class_release(struct class_device *cd) | ||
149 | { | ||
150 | /* empty */ | ||
151 | } | ||
152 | 141 | ||
153 | /** | 142 | /** |
154 | * i2o_device_class_show_class_id - Displays class id of I2O device | 143 | * i2o_device_class_show_class_id - Displays class id of I2O device |
@@ -157,12 +146,13 @@ static void i2o_device_class_release(struct class_device *cd) | |||
157 | * | 146 | * |
158 | * Returns the number of bytes which are printed into the buffer. | 147 | * Returns the number of bytes which are printed into the buffer. |
159 | */ | 148 | */ |
160 | static ssize_t i2o_device_class_show_class_id(struct class_device *cd, | 149 | static ssize_t i2o_device_show_class_id(struct device *dev, |
161 | char *buf) | 150 | struct device_attribute *attr, |
151 | char *buf) | ||
162 | { | 152 | { |
163 | struct i2o_device *dev = to_i2o_device(cd->dev); | 153 | struct i2o_device *i2o_dev = to_i2o_device(dev); |
164 | 154 | ||
165 | sprintf(buf, "0x%03x\n", dev->lct_data.class_id); | 155 | sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id); |
166 | return strlen(buf) + 1; | 156 | return strlen(buf) + 1; |
167 | } | 157 | } |
168 | 158 | ||
@@ -173,27 +163,22 @@ static ssize_t i2o_device_class_show_class_id(struct class_device *cd, | |||
173 | * | 163 | * |
174 | * Returns the number of bytes which are printed into the buffer. | 164 | * Returns the number of bytes which are printed into the buffer. |
175 | */ | 165 | */ |
176 | static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf) | 166 | static ssize_t i2o_device_show_tid(struct device *dev, |
167 | struct device_attribute *attr, | ||
168 | char *buf) | ||
177 | { | 169 | { |
178 | struct i2o_device *dev = to_i2o_device(cd->dev); | 170 | struct i2o_device *i2o_dev = to_i2o_device(dev); |
179 | 171 | ||
180 | sprintf(buf, "0x%03x\n", dev->lct_data.tid); | 172 | sprintf(buf, "0x%03x\n", i2o_dev->lct_data.tid); |
181 | return strlen(buf) + 1; | 173 | return strlen(buf) + 1; |
182 | } | 174 | } |
183 | 175 | ||
184 | static struct class_device_attribute i2o_device_class_attrs[] = { | 176 | struct device_attribute i2o_device_attrs[] = { |
185 | __ATTR(class_id, S_IRUGO, i2o_device_class_show_class_id, NULL), | 177 | __ATTR(class_id, S_IRUGO, i2o_device_show_class_id, NULL), |
186 | __ATTR(tid, S_IRUGO, i2o_device_class_show_tid, NULL), | 178 | __ATTR(tid, S_IRUGO, i2o_device_show_tid, NULL), |
187 | __ATTR_NULL | 179 | __ATTR_NULL |
188 | }; | 180 | }; |
189 | 181 | ||
190 | /* I2O device class */ | ||
191 | static struct class i2o_device_class = { | ||
192 | .name = "i2o_device", | ||
193 | .release = i2o_device_class_release, | ||
194 | .class_dev_attrs = i2o_device_class_attrs, | ||
195 | }; | ||
196 | |||
197 | /** | 182 | /** |
198 | * i2o_device_alloc - Allocate a I2O device and initialize it | 183 | * i2o_device_alloc - Allocate a I2O device and initialize it |
199 | * | 184 | * |
@@ -217,8 +202,6 @@ static struct i2o_device *i2o_device_alloc(void) | |||
217 | 202 | ||
218 | dev->device.bus = &i2o_bus_type; | 203 | dev->device.bus = &i2o_bus_type; |
219 | dev->device.release = &i2o_device_release; | 204 | dev->device.release = &i2o_device_release; |
220 | dev->classdev.class = &i2o_device_class; | ||
221 | dev->classdev.dev = &dev->device; | ||
222 | 205 | ||
223 | return dev; | 206 | return dev; |
224 | } | 207 | } |
@@ -311,17 +294,12 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c, | |||
311 | snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit, | 294 | snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit, |
312 | dev->lct_data.tid); | 295 | dev->lct_data.tid); |
313 | 296 | ||
314 | snprintf(dev->classdev.class_id, BUS_ID_SIZE, "%d:%03x", c->unit, | ||
315 | dev->lct_data.tid); | ||
316 | |||
317 | dev->device.parent = &c->device; | 297 | dev->device.parent = &c->device; |
318 | 298 | ||
319 | device_register(&dev->device); | 299 | device_register(&dev->device); |
320 | 300 | ||
321 | list_add_tail(&dev->list, &c->devices); | 301 | list_add_tail(&dev->list, &c->devices); |
322 | 302 | ||
323 | class_device_register(&dev->classdev); | ||
324 | |||
325 | i2o_setup_sysfs_links(dev); | 303 | i2o_setup_sysfs_links(dev); |
326 | 304 | ||
327 | i2o_driver_notify_device_add_all(dev); | 305 | i2o_driver_notify_device_add_all(dev); |
@@ -343,7 +321,6 @@ void i2o_device_remove(struct i2o_device *i2o_dev) | |||
343 | { | 321 | { |
344 | i2o_driver_notify_device_remove_all(i2o_dev); | 322 | i2o_driver_notify_device_remove_all(i2o_dev); |
345 | i2o_remove_sysfs_links(i2o_dev); | 323 | i2o_remove_sysfs_links(i2o_dev); |
346 | class_device_unregister(&i2o_dev->classdev); | ||
347 | list_del(&i2o_dev->list); | 324 | list_del(&i2o_dev->list); |
348 | device_unregister(&i2o_dev->device); | 325 | device_unregister(&i2o_dev->device); |
349 | } | 326 | } |
@@ -598,28 +575,6 @@ int i2o_parm_table_get(struct i2o_device *dev, int oper, int group, | |||
598 | return size; | 575 | return size; |
599 | } | 576 | } |
600 | 577 | ||
601 | /** | ||
602 | * i2o_device_init - Initialize I2O devices | ||
603 | * | ||
604 | * Registers the I2O device class. | ||
605 | * | ||
606 | * Returns 0 on success or negative error code on failure. | ||
607 | */ | ||
608 | int i2o_device_init(void) | ||
609 | { | ||
610 | return class_register(&i2o_device_class); | ||
611 | } | ||
612 | |||
613 | /** | ||
614 | * i2o_device_exit - I2O devices exit function | ||
615 | * | ||
616 | * Unregisters the I2O device class. | ||
617 | */ | ||
618 | void i2o_device_exit(void) | ||
619 | { | ||
620 | class_unregister(&i2o_device_class); | ||
621 | } | ||
622 | |||
623 | EXPORT_SYMBOL(i2o_device_claim); | 578 | EXPORT_SYMBOL(i2o_device_claim); |
624 | EXPORT_SYMBOL(i2o_device_claim_release); | 579 | EXPORT_SYMBOL(i2o_device_claim_release); |
625 | EXPORT_SYMBOL(i2o_parm_field_get); | 580 | EXPORT_SYMBOL(i2o_parm_field_get); |