diff options
Diffstat (limited to 'drivers/message/i2o/iop.c')
-rw-r--r-- | drivers/message/i2o/iop.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 42f8b810d6e5..361da8d1d5e7 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -833,6 +833,7 @@ void i2o_iop_remove(struct i2o_controller *c) | |||
833 | list_for_each_entry_safe(dev, tmp, &c->devices, list) | 833 | list_for_each_entry_safe(dev, tmp, &c->devices, list) |
834 | i2o_device_remove(dev); | 834 | i2o_device_remove(dev); |
835 | 835 | ||
836 | class_device_unregister(c->classdev); | ||
836 | device_del(&c->device); | 837 | device_del(&c->device); |
837 | 838 | ||
838 | /* Ask the IOP to switch to RESET state */ | 839 | /* Ask the IOP to switch to RESET state */ |
@@ -1077,9 +1078,7 @@ static void i2o_iop_release(struct device *dev) | |||
1077 | }; | 1078 | }; |
1078 | 1079 | ||
1079 | /* I2O controller class */ | 1080 | /* I2O controller class */ |
1080 | static struct class i2o_controller_class = { | 1081 | static struct class *i2o_controller_class; |
1081 | .name = "i2o_controller", | ||
1082 | }; | ||
1083 | 1082 | ||
1084 | /** | 1083 | /** |
1085 | * i2o_iop_alloc - Allocate and initialize a i2o_controller struct | 1084 | * i2o_iop_alloc - Allocate and initialize a i2o_controller struct |
@@ -1110,14 +1109,10 @@ struct i2o_controller *i2o_iop_alloc(void) | |||
1110 | sprintf(c->name, "iop%d", c->unit); | 1109 | sprintf(c->name, "iop%d", c->unit); |
1111 | 1110 | ||
1112 | device_initialize(&c->device); | 1111 | device_initialize(&c->device); |
1113 | class_device_initialize(&c->classdev); | ||
1114 | 1112 | ||
1115 | c->device.release = &i2o_iop_release; | 1113 | c->device.release = &i2o_iop_release; |
1116 | c->classdev.class = &i2o_controller_class; | ||
1117 | c->classdev.dev = &c->device; | ||
1118 | 1114 | ||
1119 | snprintf(c->device.bus_id, BUS_ID_SIZE, "iop%d", c->unit); | 1115 | 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 | 1116 | ||
1122 | #if BITS_PER_LONG == 64 | 1117 | #if BITS_PER_LONG == 64 |
1123 | spin_lock_init(&c->context_list_lock); | 1118 | spin_lock_init(&c->context_list_lock); |
@@ -1146,7 +1141,9 @@ int i2o_iop_add(struct i2o_controller *c) | |||
1146 | goto iop_reset; | 1141 | goto iop_reset; |
1147 | } | 1142 | } |
1148 | 1143 | ||
1149 | if ((rc = class_device_add(&c->classdev))) { | 1144 | c->classdev = class_device_create(i2o_controller_class, NULL, MKDEV(0,0), |
1145 | &c->device, "iop%d", c->unit); | ||
1146 | if (IS_ERR(c->classdev)) { | ||
1150 | osm_err("%s: could not add controller class\n", c->name); | 1147 | osm_err("%s: could not add controller class\n", c->name); |
1151 | goto device_del; | 1148 | goto device_del; |
1152 | } | 1149 | } |
@@ -1184,7 +1181,7 @@ int i2o_iop_add(struct i2o_controller *c) | |||
1184 | return 0; | 1181 | return 0; |
1185 | 1182 | ||
1186 | class_del: | 1183 | class_del: |
1187 | class_device_del(&c->classdev); | 1184 | class_device_unregister(c->classdev); |
1188 | 1185 | ||
1189 | device_del: | 1186 | device_del: |
1190 | device_del(&c->device); | 1187 | device_del(&c->device); |
@@ -1246,13 +1243,10 @@ static int __init i2o_iop_init(void) | |||
1246 | 1243 | ||
1247 | printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); | 1244 | printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); |
1248 | 1245 | ||
1249 | rc = i2o_device_init(); | 1246 | i2o_controller_class = class_create(THIS_MODULE, "i2o_controller"); |
1250 | if (rc) | 1247 | 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"); | 1248 | osm_err("can't register class i2o_controller\n"); |
1255 | goto device_exit; | 1249 | goto exit; |
1256 | } | 1250 | } |
1257 | 1251 | ||
1258 | if ((rc = i2o_driver_init())) | 1252 | if ((rc = i2o_driver_init())) |
@@ -1273,10 +1267,7 @@ static int __init i2o_iop_init(void) | |||
1273 | i2o_driver_exit(); | 1267 | i2o_driver_exit(); |
1274 | 1268 | ||
1275 | class_exit: | 1269 | class_exit: |
1276 | class_unregister(&i2o_controller_class); | 1270 | class_destroy(i2o_controller_class); |
1277 | |||
1278 | device_exit: | ||
1279 | i2o_device_exit(); | ||
1280 | 1271 | ||
1281 | exit: | 1272 | exit: |
1282 | return rc; | 1273 | return rc; |
@@ -1292,8 +1283,7 @@ static void __exit i2o_iop_exit(void) | |||
1292 | i2o_pci_exit(); | 1283 | i2o_pci_exit(); |
1293 | i2o_exec_exit(); | 1284 | i2o_exec_exit(); |
1294 | i2o_driver_exit(); | 1285 | i2o_driver_exit(); |
1295 | class_unregister(&i2o_controller_class); | 1286 | class_destroy(i2o_controller_class); |
1296 | i2o_device_exit(); | ||
1297 | }; | 1287 | }; |
1298 | 1288 | ||
1299 | module_init(i2o_iop_init); | 1289 | module_init(i2o_iop_init); |