diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 01:25:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:51 -0400 |
commit | 607cf4d9aa1d766890f42fc892d39d48cf6d6c16 (patch) | |
tree | c2cf3566c79d9879270a6f0a3c119065785183dc | |
parent | 4f5ca09e0b854a29b17401f59487664ae3b21aa4 (diff) |
[PATCH] I2O: Clean up some pretty bad driver model abuses in the i2o code
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/message/i2o/iop.c | 22 | ||||
-rw-r--r-- | include/linux/i2o.h | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 42f8b810d6e5..15deb45ce995 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, 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); |
@@ -1250,7 +1247,8 @@ static int __init i2o_iop_init(void) | |||
1250 | if (rc) | 1247 | if (rc) |
1251 | goto exit; | 1248 | goto exit; |
1252 | 1249 | ||
1253 | if ((rc = class_register(&i2o_controller_class))) { | 1250 | i2o_controller_class = class_create(THIS_MODULE, "i2o_controller"); |
1251 | if (IS_ERR(i2o_controller_class)) { | ||
1254 | osm_err("can't register class i2o_controller\n"); | 1252 | osm_err("can't register class i2o_controller\n"); |
1255 | goto device_exit; | 1253 | goto device_exit; |
1256 | } | 1254 | } |
@@ -1273,7 +1271,7 @@ static int __init i2o_iop_init(void) | |||
1273 | i2o_driver_exit(); | 1271 | i2o_driver_exit(); |
1274 | 1272 | ||
1275 | class_exit: | 1273 | class_exit: |
1276 | class_unregister(&i2o_controller_class); | 1274 | class_destroy(i2o_controller_class); |
1277 | 1275 | ||
1278 | device_exit: | 1276 | device_exit: |
1279 | i2o_device_exit(); | 1277 | i2o_device_exit(); |
@@ -1292,7 +1290,7 @@ static void __exit i2o_iop_exit(void) | |||
1292 | i2o_pci_exit(); | 1290 | i2o_pci_exit(); |
1293 | i2o_exec_exit(); | 1291 | i2o_exec_exit(); |
1294 | i2o_driver_exit(); | 1292 | i2o_driver_exit(); |
1295 | class_unregister(&i2o_controller_class); | 1293 | class_destroy(i2o_controller_class); |
1296 | i2o_device_exit(); | 1294 | i2o_device_exit(); |
1297 | }; | 1295 | }; |
1298 | 1296 | ||
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index bdc286ec947c..694ea298d4bc 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -194,7 +194,7 @@ struct i2o_controller { | |||
194 | struct resource mem_resource; /* Mem resource allocated to the IOP */ | 194 | struct resource mem_resource; /* Mem resource allocated to the IOP */ |
195 | 195 | ||
196 | struct device device; | 196 | struct device device; |
197 | struct class_device classdev; /* I2O controller class */ | 197 | struct class_device *classdev; /* I2O controller class device */ |
198 | struct i2o_device *exec; /* Executive */ | 198 | struct i2o_device *exec; /* Executive */ |
199 | #if BITS_PER_LONG == 64 | 199 | #if BITS_PER_LONG == 64 |
200 | spinlock_t context_list_lock; /* lock for context_list */ | 200 | spinlock_t context_list_lock; /* lock for context_list */ |