aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/iop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/i2o/iop.c')
-rw-r--r--drivers/message/i2o/iop.c33
1 files changed, 12 insertions, 21 deletions
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);