aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/i2o/core.h3
-rw-r--r--drivers/message/i2o/debug.c2
-rw-r--r--drivers/message/i2o/device.c274
-rw-r--r--drivers/message/i2o/driver.c6
-rw-r--r--drivers/message/i2o/exec-osm.c4
-rw-r--r--drivers/message/i2o/iop.c33
6 files changed, 133 insertions, 189 deletions
diff --git a/drivers/message/i2o/core.h b/drivers/message/i2o/core.h
index c5bcfd70f711..9eefedb16211 100644
--- a/drivers/message/i2o/core.h
+++ b/drivers/message/i2o/core.h
@@ -36,9 +36,6 @@ extern void __exit i2o_pci_exit(void);
36extern void i2o_device_remove(struct i2o_device *); 36extern void i2o_device_remove(struct i2o_device *);
37extern int i2o_device_parse_lct(struct i2o_controller *); 37extern int i2o_device_parse_lct(struct i2o_controller *);
38 38
39extern int i2o_device_init(void);
40extern void i2o_device_exit(void);
41
42/* IOP */ 39/* IOP */
43extern struct i2o_controller *i2o_iop_alloc(void); 40extern struct i2o_controller *i2o_iop_alloc(void);
44extern void i2o_iop_free(struct i2o_controller *); 41extern void i2o_iop_free(struct i2o_controller *);
diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c
index 018ca887ca85..40d4ea898dbc 100644
--- a/drivers/message/i2o/debug.c
+++ b/drivers/message/i2o/debug.c
@@ -90,7 +90,7 @@ static void i2o_report_fail_status(u8 req_status, u32 * msg)
90 }; 90 };
91 91
92 if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) 92 if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE)
93 printk(KERN_DEBUG "TRANSPORT_UNKNOWN_FAILURE (%0#2x)\n.", 93 printk(KERN_DEBUG "TRANSPORT_UNKNOWN_FAILURE (%0#2x).\n",
94 req_status); 94 req_status);
95 else 95 else
96 printk(KERN_DEBUG "TRANSPORT_%s.\n", 96 printk(KERN_DEBUG "TRANSPORT_%s.\n",
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index 21f16ba3ac38..8eb50cdb8ae1 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -16,6 +16,8 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/i2o.h> 17#include <linux/i2o.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/string.h>
20#include <linux/slab.h>
19#include "core.h" 21#include "core.h"
20 22
21/** 23/**
@@ -45,10 +47,10 @@ static inline int i2o_device_issue_claim(struct i2o_device *dev, u32 cmd,
45 writel(type, &msg->body[0]); 47 writel(type, &msg->body[0]);
46 48
47 return i2o_msg_post_wait(dev->iop, m, 60); 49 return i2o_msg_post_wait(dev->iop, m, 60);
48}; 50}
49 51
50/** 52/**
51 * i2o_device_claim - claim a device for use by an OSM 53 * i2o_device_claim - claim a device for use by an OSM
52 * @dev: I2O device to claim 54 * @dev: I2O device to claim
53 * @drv: I2O driver which wants to claim the device 55 * @drv: I2O driver which wants to claim the device
54 * 56 *
@@ -73,7 +75,7 @@ int i2o_device_claim(struct i2o_device *dev)
73 up(&dev->lock); 75 up(&dev->lock);
74 76
75 return rc; 77 return rc;
76}; 78}
77 79
78/** 80/**
79 * i2o_device_claim_release - release a device that the OSM is using 81 * i2o_device_claim_release - release a device that the OSM is using
@@ -119,7 +121,8 @@ int i2o_device_claim_release(struct i2o_device *dev)
119 up(&dev->lock); 121 up(&dev->lock);
120 122
121 return rc; 123 return rc;
122}; 124}
125
123 126
124/** 127/**
125 * i2o_device_release - release the memory for a I2O device 128 * i2o_device_release - release the memory for a I2O device
@@ -135,39 +138,47 @@ static void i2o_device_release(struct device *dev)
135 pr_debug("i2o: device %s released\n", dev->bus_id); 138 pr_debug("i2o: device %s released\n", dev->bus_id);
136 139
137 kfree(i2o_dev); 140 kfree(i2o_dev);
138}; 141}
142
139 143
140/** 144/**
141 * i2o_device_class_release - Remove I2O device attributes 145 * i2o_device_class_show_class_id - Displays class id of I2O device
142 * @cd: I2O class device which is added to the I2O device class 146 * @cd: class device of which the class id should be displayed
147 * @buf: buffer into which the class id should be printed
143 * 148 *
144 * Removes attributes from the I2O device again. Also search each device 149 * Returns the number of bytes which are printed into the buffer.
145 * on the controller for I2O devices which refert to this device as parent
146 * or user and remove this links also.
147 */ 150 */
148static void i2o_device_class_release(struct class_device *cd) 151static ssize_t i2o_device_show_class_id(struct device *dev,
152 struct device_attribute *attr,
153 char *buf)
149{ 154{
150 struct i2o_device *i2o_dev, *tmp; 155 struct i2o_device *i2o_dev = to_i2o_device(dev);
151 struct i2o_controller *c;
152 156
153 i2o_dev = to_i2o_device(cd->dev); 157 sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id);
154 c = i2o_dev->iop; 158 return strlen(buf) + 1;
159}
155 160
156 sysfs_remove_link(&i2o_dev->device.kobj, "parent"); 161/**
157 sysfs_remove_link(&i2o_dev->device.kobj, "user"); 162 * i2o_device_class_show_tid - Displays TID of I2O device
163 * @cd: class device of which the TID should be displayed
164 * @buf: buffer into which the class id should be printed
165 *
166 * Returns the number of bytes which are printed into the buffer.
167 */
168static ssize_t i2o_device_show_tid(struct device *dev,
169 struct device_attribute *attr,
170 char *buf)
171{
172 struct i2o_device *i2o_dev = to_i2o_device(dev);
158 173
159 list_for_each_entry(tmp, &c->devices, list) { 174 sprintf(buf, "0x%03x\n", i2o_dev->lct_data.tid);
160 if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid) 175 return strlen(buf) + 1;
161 sysfs_remove_link(&tmp->device.kobj, "parent"); 176}
162 if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
163 sysfs_remove_link(&tmp->device.kobj, "user");
164 }
165};
166 177
167/* I2O device class */ 178struct device_attribute i2o_device_attrs[] = {
168static struct class i2o_device_class = { 179 __ATTR(class_id, S_IRUGO, i2o_device_show_class_id, NULL),
169 .name = "i2o_device", 180 __ATTR(tid, S_IRUGO, i2o_device_show_tid, NULL),
170 .release = i2o_device_class_release 181 __ATTR_NULL
171}; 182};
172 183
173/** 184/**
@@ -193,11 +204,69 @@ static struct i2o_device *i2o_device_alloc(void)
193 204
194 dev->device.bus = &i2o_bus_type; 205 dev->device.bus = &i2o_bus_type;
195 dev->device.release = &i2o_device_release; 206 dev->device.release = &i2o_device_release;
196 dev->classdev.class = &i2o_device_class;
197 dev->classdev.dev = &dev->device;
198 207
199 return dev; 208 return dev;
200}; 209}
210
211/**
212 * i2o_setup_sysfs_links - Adds attributes to the I2O device
213 * @cd: I2O class device which is added to the I2O device class
214 *
215 * This function get called when a I2O device is added to the class. It
216 * creates the attributes for each device and creates user/parent symlink
217 * if necessary.
218 *
219 * Returns 0 on success or negative error code on failure.
220 */
221static void i2o_setup_sysfs_links(struct i2o_device *i2o_dev)
222{
223 struct i2o_controller *c = i2o_dev->iop;
224 struct i2o_device *tmp;
225
226 /* create user entries for this device */
227 tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.user_tid);
228 if (tmp && tmp != i2o_dev)
229 sysfs_create_link(&i2o_dev->device.kobj,
230 &tmp->device.kobj, "user");
231
232 /* create user entries refering to this device */
233 list_for_each_entry(tmp, &c->devices, list)
234 if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid &&
235 tmp != i2o_dev)
236 sysfs_create_link(&tmp->device.kobj,
237 &i2o_dev->device.kobj, "user");
238
239 /* create parent entries for this device */
240 tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.parent_tid);
241 if (tmp && tmp != i2o_dev)
242 sysfs_create_link(&i2o_dev->device.kobj,
243 &tmp->device.kobj, "parent");
244
245 /* create parent entries refering to this device */
246 list_for_each_entry(tmp, &c->devices, list)
247 if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid &&
248 tmp != i2o_dev)
249 sysfs_create_link(&tmp->device.kobj,
250 &i2o_dev->device.kobj, "parent");
251}
252
253static void i2o_remove_sysfs_links(struct i2o_device *i2o_dev)
254{
255 struct i2o_controller *c = i2o_dev->iop;
256 struct i2o_device *tmp;
257
258 sysfs_remove_link(&i2o_dev->device.kobj, "parent");
259 sysfs_remove_link(&i2o_dev->device.kobj, "user");
260
261 list_for_each_entry(tmp, &c->devices, list) {
262 if (tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
263 sysfs_remove_link(&tmp->device.kobj, "parent");
264 if (tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
265 sysfs_remove_link(&tmp->device.kobj, "user");
266 }
267}
268
269
201 270
202/** 271/**
203 * i2o_device_add - allocate a new I2O device and add it to the IOP 272 * i2o_device_add - allocate a new I2O device and add it to the IOP
@@ -222,28 +291,25 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
222 } 291 }
223 292
224 dev->lct_data = *entry; 293 dev->lct_data = *entry;
294 dev->iop = c;
225 295
226 snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit, 296 snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit,
227 dev->lct_data.tid); 297 dev->lct_data.tid);
228 298
229 snprintf(dev->classdev.class_id, BUS_ID_SIZE, "%d:%03x", c->unit,
230 dev->lct_data.tid);
231
232 dev->iop = c;
233 dev->device.parent = &c->device; 299 dev->device.parent = &c->device;
234 300
235 device_register(&dev->device); 301 device_register(&dev->device);
236 302
237 list_add_tail(&dev->list, &c->devices); 303 list_add_tail(&dev->list, &c->devices);
238 304
239 class_device_register(&dev->classdev); 305 i2o_setup_sysfs_links(dev);
240 306
241 i2o_driver_notify_device_add_all(dev); 307 i2o_driver_notify_device_add_all(dev);
242 308
243 pr_debug("i2o: device %s added\n", dev->device.bus_id); 309 pr_debug("i2o: device %s added\n", dev->device.bus_id);
244 310
245 return dev; 311 return dev;
246}; 312}
247 313
248/** 314/**
249 * i2o_device_remove - remove an I2O device from the I2O core 315 * i2o_device_remove - remove an I2O device from the I2O core
@@ -256,10 +322,10 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
256void i2o_device_remove(struct i2o_device *i2o_dev) 322void i2o_device_remove(struct i2o_device *i2o_dev)
257{ 323{
258 i2o_driver_notify_device_remove_all(i2o_dev); 324 i2o_driver_notify_device_remove_all(i2o_dev);
259 class_device_unregister(&i2o_dev->classdev); 325 i2o_remove_sysfs_links(i2o_dev);
260 list_del(&i2o_dev->list); 326 list_del(&i2o_dev->list);
261 device_unregister(&i2o_dev->device); 327 device_unregister(&i2o_dev->device);
262}; 328}
263 329
264/** 330/**
265 * i2o_device_parse_lct - Parse a previously fetched LCT and create devices 331 * i2o_device_parse_lct - Parse a previously fetched LCT and create devices
@@ -337,99 +403,8 @@ int i2o_device_parse_lct(struct i2o_controller *c)
337 up(&c->lct_lock); 403 up(&c->lct_lock);
338 404
339 return 0; 405 return 0;
340}; 406}
341
342/**
343 * i2o_device_class_show_class_id - Displays class id of I2O device
344 * @cd: class device of which the class id should be displayed
345 * @buf: buffer into which the class id should be printed
346 *
347 * Returns the number of bytes which are printed into the buffer.
348 */
349static ssize_t i2o_device_class_show_class_id(struct class_device *cd,
350 char *buf)
351{
352 struct i2o_device *dev = to_i2o_device(cd->dev);
353
354 sprintf(buf, "0x%03x\n", dev->lct_data.class_id);
355 return strlen(buf) + 1;
356};
357
358/**
359 * i2o_device_class_show_tid - Displays TID of I2O device
360 * @cd: class device of which the TID should be displayed
361 * @buf: buffer into which the class id should be printed
362 *
363 * Returns the number of bytes which are printed into the buffer.
364 */
365static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf)
366{
367 struct i2o_device *dev = to_i2o_device(cd->dev);
368
369 sprintf(buf, "0x%03x\n", dev->lct_data.tid);
370 return strlen(buf) + 1;
371};
372
373/* I2O device class attributes */
374static CLASS_DEVICE_ATTR(class_id, S_IRUGO, i2o_device_class_show_class_id,
375 NULL);
376static CLASS_DEVICE_ATTR(tid, S_IRUGO, i2o_device_class_show_tid, NULL);
377
378/**
379 * i2o_device_class_add - Adds attributes to the I2O device
380 * @cd: I2O class device which is added to the I2O device class
381 *
382 * This function get called when a I2O device is added to the class. It
383 * creates the attributes for each device and creates user/parent symlink
384 * if necessary.
385 *
386 * Returns 0 on success or negative error code on failure.
387 */
388static int i2o_device_class_add(struct class_device *cd)
389{
390 struct i2o_device *i2o_dev, *tmp;
391 struct i2o_controller *c;
392
393 i2o_dev = to_i2o_device(cd->dev);
394 c = i2o_dev->iop;
395
396 class_device_create_file(cd, &class_device_attr_class_id);
397 class_device_create_file(cd, &class_device_attr_tid);
398
399 /* create user entries for this device */
400 tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.user_tid);
401 if (tmp && (tmp != i2o_dev))
402 sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
403 "user");
404
405 /* create user entries refering to this device */
406 list_for_each_entry(tmp, &c->devices, list)
407 if ((tmp->lct_data.user_tid == i2o_dev->lct_data.tid)
408 && (tmp != i2o_dev))
409 sysfs_create_link(&tmp->device.kobj,
410 &i2o_dev->device.kobj, "user");
411
412 /* create parent entries for this device */
413 tmp = i2o_iop_find_device(i2o_dev->iop, i2o_dev->lct_data.parent_tid);
414 if (tmp && (tmp != i2o_dev))
415 sysfs_create_link(&i2o_dev->device.kobj, &tmp->device.kobj,
416 "parent");
417
418 /* create parent entries refering to this device */
419 list_for_each_entry(tmp, &c->devices, list)
420 if ((tmp->lct_data.parent_tid == i2o_dev->lct_data.tid)
421 && (tmp != i2o_dev))
422 sysfs_create_link(&tmp->device.kobj,
423 &i2o_dev->device.kobj, "parent");
424
425 return 0;
426};
427 407
428/* I2O device class interface */
429static struct class_interface i2o_device_class_interface = {
430 .class = &i2o_device_class,
431 .add = i2o_device_class_add
432};
433 408
434/* 409/*
435 * Run time support routines 410 * Run time support routines
@@ -553,11 +528,11 @@ int i2o_parm_field_get(struct i2o_device *i2o_dev, int group, int field,
553} 528}
554 529
555/* 530/*
556 * if oper == I2O_PARAMS_TABLE_GET, get from all rows 531 * if oper == I2O_PARAMS_TABLE_GET, get from all rows
557 * if fieldcount == -1 return all fields 532 * if fieldcount == -1 return all fields
558 * ibuf and ibuflen are unused (use NULL, 0) 533 * ibuf and ibuflen are unused (use NULL, 0)
559 * else return specific fields 534 * else return specific fields
560 * ibuf contains fieldindexes 535 * ibuf contains fieldindexes
561 * 536 *
562 * if oper == I2O_PARAMS_LIST_GET, get from specific rows 537 * if oper == I2O_PARAMS_LIST_GET, get from specific rows
563 * if fieldcount == -1 return all fields 538 * if fieldcount == -1 return all fields
@@ -602,35 +577,6 @@ int i2o_parm_table_get(struct i2o_device *dev, int oper, int group,
602 return size; 577 return size;
603} 578}
604 579
605/**
606 * i2o_device_init - Initialize I2O devices
607 *
608 * Registers the I2O device class.
609 *
610 * Returns 0 on success or negative error code on failure.
611 */
612int i2o_device_init(void)
613{
614 int rc;
615
616 rc = class_register(&i2o_device_class);
617 if (rc)
618 return rc;
619
620 return class_interface_register(&i2o_device_class_interface);
621};
622
623/**
624 * i2o_device_exit - I2O devices exit function
625 *
626 * Unregisters the I2O device class.
627 */
628void i2o_device_exit(void)
629{
630 class_interface_register(&i2o_device_class_interface);
631 class_unregister(&i2o_device_class);
632};
633
634EXPORT_SYMBOL(i2o_device_claim); 580EXPORT_SYMBOL(i2o_device_claim);
635EXPORT_SYMBOL(i2o_device_claim_release); 581EXPORT_SYMBOL(i2o_device_claim_release);
636EXPORT_SYMBOL(i2o_parm_field_get); 582EXPORT_SYMBOL(i2o_parm_field_get);
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 739bfdef0c6d..0fb9c4e2ad4c 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -17,6 +17,9 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/rwsem.h> 18#include <linux/rwsem.h>
19#include <linux/i2o.h> 19#include <linux/i2o.h>
20#include <linux/workqueue.h>
21#include <linux/string.h>
22#include <linux/slab.h>
20#include "core.h" 23#include "core.h"
21 24
22#define OSM_NAME "i2o" 25#define OSM_NAME "i2o"
@@ -58,9 +61,12 @@ static int i2o_bus_match(struct device *dev, struct device_driver *drv)
58}; 61};
59 62
60/* I2O bus type */ 63/* I2O bus type */
64extern struct device_attribute i2o_device_attrs[];
65
61struct bus_type i2o_bus_type = { 66struct bus_type i2o_bus_type = {
62 .name = "i2o", 67 .name = "i2o",
63 .match = i2o_bus_match, 68 .match = i2o_bus_match,
69 .dev_attrs = i2o_device_attrs,
64}; 70};
65 71
66/** 72/**
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index bda2c62648ba..b675b4ebbebd 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -30,6 +30,10 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/i2o.h> 31#include <linux/i2o.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/workqueue.h>
34#include <linux/string.h>
35#include <linux/slab.h>
36#include <asm/param.h> /* HZ */
33#include "core.h" 37#include "core.h"
34 38
35#define OSM_NAME "exec-osm" 39#define OSM_NAME "exec-osm"
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 42f8b810d6e5..61b837de4b6a 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -28,6 +28,7 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/i2o.h> 29#include <linux/i2o.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/sched.h>
31#include "core.h" 32#include "core.h"
32 33
33#define OSM_NAME "i2o" 34#define OSM_NAME "i2o"
@@ -833,6 +834,7 @@ void i2o_iop_remove(struct i2o_controller *c)
833 list_for_each_entry_safe(dev, tmp, &c->devices, list) 834 list_for_each_entry_safe(dev, tmp, &c->devices, list)
834 i2o_device_remove(dev); 835 i2o_device_remove(dev);
835 836
837 class_device_unregister(c->classdev);
836 device_del(&c->device); 838 device_del(&c->device);
837 839
838 /* Ask the IOP to switch to RESET state */ 840 /* Ask the IOP to switch to RESET state */
@@ -1077,9 +1079,7 @@ static void i2o_iop_release(struct device *dev)
1077}; 1079};
1078 1080
1079/* I2O controller class */ 1081/* I2O controller class */
1080static struct class i2o_controller_class = { 1082static struct class *i2o_controller_class;
1081 .name = "i2o_controller",
1082};
1083 1083
1084/** 1084/**
1085 * i2o_iop_alloc - Allocate and initialize a i2o_controller struct 1085 * i2o_iop_alloc - Allocate and initialize a i2o_controller struct
@@ -1110,14 +1110,10 @@ struct i2o_controller *i2o_iop_alloc(void)
1110 sprintf(c->name, "iop%d", c->unit); 1110 sprintf(c->name, "iop%d", c->unit);
1111 1111
1112 device_initialize(&c->device); 1112 device_initialize(&c->device);
1113 class_device_initialize(&c->classdev);
1114 1113
1115 c->device.release = &i2o_iop_release; 1114 c->device.release = &i2o_iop_release;
1116 c->classdev.class = &i2o_controller_class;
1117 c->classdev.dev = &c->device;
1118 1115
1119 snprintf(c->device.bus_id, BUS_ID_SIZE, "iop%d", c->unit); 1116 snprintf(c->device.bus_id, BUS_ID_SIZE, "iop%d", c->unit);
1120 snprintf(c->classdev.class_id, BUS_ID_SIZE, "iop%d", c->unit);
1121 1117
1122#if BITS_PER_LONG == 64 1118#if BITS_PER_LONG == 64
1123 spin_lock_init(&c->context_list_lock); 1119 spin_lock_init(&c->context_list_lock);
@@ -1146,7 +1142,9 @@ int i2o_iop_add(struct i2o_controller *c)
1146 goto iop_reset; 1142 goto iop_reset;
1147 } 1143 }
1148 1144
1149 if ((rc = class_device_add(&c->classdev))) { 1145 c->classdev = class_device_create(i2o_controller_class, NULL, MKDEV(0,0),
1146 &c->device, "iop%d", c->unit);
1147 if (IS_ERR(c->classdev)) {
1150 osm_err("%s: could not add controller class\n", c->name); 1148 osm_err("%s: could not add controller class\n", c->name);
1151 goto device_del; 1149 goto device_del;
1152 } 1150 }
@@ -1184,7 +1182,7 @@ int i2o_iop_add(struct i2o_controller *c)
1184 return 0; 1182 return 0;
1185 1183
1186 class_del: 1184 class_del:
1187 class_device_del(&c->classdev); 1185 class_device_unregister(c->classdev);
1188 1186
1189 device_del: 1187 device_del:
1190 device_del(&c->device); 1188 device_del(&c->device);
@@ -1246,13 +1244,10 @@ static int __init i2o_iop_init(void)
1246 1244
1247 printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); 1245 printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
1248 1246
1249 rc = i2o_device_init(); 1247 i2o_controller_class = class_create(THIS_MODULE, "i2o_controller");
1250 if (rc) 1248 if (IS_ERR(i2o_controller_class)) {
1251 goto exit;
1252
1253 if ((rc = class_register(&i2o_controller_class))) {
1254 osm_err("can't register class i2o_controller\n"); 1249 osm_err("can't register class i2o_controller\n");
1255 goto device_exit; 1250 goto exit;
1256 } 1251 }
1257 1252
1258 if ((rc = i2o_driver_init())) 1253 if ((rc = i2o_driver_init()))
@@ -1273,10 +1268,7 @@ static int __init i2o_iop_init(void)
1273 i2o_driver_exit(); 1268 i2o_driver_exit();
1274 1269
1275 class_exit: 1270 class_exit:
1276 class_unregister(&i2o_controller_class); 1271 class_destroy(i2o_controller_class);
1277
1278 device_exit:
1279 i2o_device_exit();
1280 1272
1281 exit: 1273 exit:
1282 return rc; 1274 return rc;
@@ -1292,8 +1284,7 @@ static void __exit i2o_iop_exit(void)
1292 i2o_pci_exit(); 1284 i2o_pci_exit();
1293 i2o_exec_exit(); 1285 i2o_exec_exit();
1294 i2o_driver_exit(); 1286 i2o_driver_exit();
1295 class_unregister(&i2o_controller_class); 1287 class_destroy(i2o_controller_class);
1296 i2o_device_exit();
1297}; 1288};
1298 1289
1299module_init(i2o_iop_init); 1290module_init(i2o_iop_init);