aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/message/i2o/core.h3
-rw-r--r--drivers/message/i2o/device.c71
-rw-r--r--drivers/message/i2o/driver.c3
-rw-r--r--drivers/message/i2o/iop.c10
4 files changed, 17 insertions, 70 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/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 */
148static 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 */
160static ssize_t i2o_device_class_show_class_id(struct class_device *cd, 149static 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 */
176static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf) 166static 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
184static struct class_device_attribute i2o_device_class_attrs[] = { 176struct 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 */
191static 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 */
608int 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 */
618void i2o_device_exit(void)
619{
620 class_unregister(&i2o_device_class);
621}
622
623EXPORT_SYMBOL(i2o_device_claim); 578EXPORT_SYMBOL(i2o_device_claim);
624EXPORT_SYMBOL(i2o_device_claim_release); 579EXPORT_SYMBOL(i2o_device_claim_release);
625EXPORT_SYMBOL(i2o_parm_field_get); 580EXPORT_SYMBOL(i2o_parm_field_get);
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 739bfdef0c6d..0079a4be0af2 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -58,9 +58,12 @@ static int i2o_bus_match(struct device *dev, struct device_driver *drv)
58}; 58};
59 59
60/* I2O bus type */ 60/* I2O bus type */
61extern struct device_attribute i2o_device_attrs[];
62
61struct bus_type i2o_bus_type = { 63struct bus_type i2o_bus_type = {
62 .name = "i2o", 64 .name = "i2o",
63 .match = i2o_bus_match, 65 .match = i2o_bus_match,
66 .dev_attrs = i2o_device_attrs,
64}; 67};
65 68
66/** 69/**
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 15deb45ce995..176fb573ea26 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -1243,14 +1243,10 @@ static int __init i2o_iop_init(void)
1243 1243
1244 printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); 1244 printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
1245 1245
1246 rc = i2o_device_init();
1247 if (rc)
1248 goto exit;
1249
1250 i2o_controller_class = class_create(THIS_MODULE, "i2o_controller"); 1246 i2o_controller_class = class_create(THIS_MODULE, "i2o_controller");
1251 if (IS_ERR(i2o_controller_class)) { 1247 if (IS_ERR(i2o_controller_class)) {
1252 osm_err("can't register class i2o_controller\n"); 1248 osm_err("can't register class i2o_controller\n");
1253 goto device_exit; 1249 goto exit;
1254 } 1250 }
1255 1251
1256 if ((rc = i2o_driver_init())) 1252 if ((rc = i2o_driver_init()))
@@ -1273,9 +1269,6 @@ static int __init i2o_iop_init(void)
1273 class_exit: 1269 class_exit:
1274 class_destroy(i2o_controller_class); 1270 class_destroy(i2o_controller_class);
1275 1271
1276 device_exit:
1277 i2o_device_exit();
1278
1279 exit: 1272 exit:
1280 return rc; 1273 return rc;
1281} 1274}
@@ -1291,7 +1284,6 @@ static void __exit i2o_iop_exit(void)
1291 i2o_exec_exit(); 1284 i2o_exec_exit();
1292 i2o_driver_exit(); 1285 i2o_driver_exit();
1293 class_destroy(i2o_controller_class); 1286 class_destroy(i2o_controller_class);
1294 i2o_device_exit();
1295}; 1287};
1296 1288
1297module_init(i2o_iop_init); 1289module_init(i2o_iop_init);