Skip to content

Commit 7bd7b09

Browse files
Dmitry Torokhovgregkh
authored andcommitted
[PATCH] I2O: remove i2o_device_class
I2O: cleanup - remove i2o_device_class I2O devices reside on their own bus so there should be no reason to also have i2c_device class that mirros i2o bus. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 607cf4d commit 7bd7b09

5 files changed

Lines changed: 17 additions & 72 deletions

File tree

‎drivers/message/i2o/core.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ extern void __exit i2o_pci_exit(void);
3636
extern void i2o_device_remove(struct i2o_device *);
3737
extern int i2o_device_parse_lct(struct i2o_controller *);
3838

39-
extern int i2o_device_init(void);
40-
extern void i2o_device_exit(void);
41-
4239
/* IOP */
4340
extern struct i2o_controller *i2o_iop_alloc(void);
4441
extern void i2o_iop_free(struct i2o_controller *);

‎drivers/message/i2o/device.c‎

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,6 @@ static void i2o_device_release(struct device *dev)
138138
kfree(i2o_dev);
139139
}
140140

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-
*/
148-
static void i2o_device_class_release(struct class_device *cd)
149-
{
150-
/* empty */
151-
}
152141

153142
/**
154143
* 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)
157146
*
158147
* Returns the number of bytes which are printed into the buffer.
159148
*/
160-
static ssize_t i2o_device_class_show_class_id(struct class_device *cd,
161-
char *buf)
149+
static ssize_t i2o_device_show_class_id(struct device *dev,
150+
struct device_attribute *attr,
151+
char *buf)
162152
{
163-
struct i2o_device *dev = to_i2o_device(cd->dev);
153+
struct i2o_device *i2o_dev = to_i2o_device(dev);
164154

165-
sprintf(buf, "0x%03x\n", dev->lct_data.class_id);
155+
sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id);
166156
return strlen(buf) + 1;
167157
}
168158

@@ -173,27 +163,22 @@ static ssize_t i2o_device_class_show_class_id(struct class_device *cd,
173163
*
174164
* Returns the number of bytes which are printed into the buffer.
175165
*/
176-
static ssize_t i2o_device_class_show_tid(struct class_device *cd, char *buf)
166+
static ssize_t i2o_device_show_tid(struct device *dev,
167+
struct device_attribute *attr,
168+
char *buf)
177169
{
178-
struct i2o_device *dev = to_i2o_device(cd->dev);
170+
struct i2o_device *i2o_dev = to_i2o_device(dev);
179171

180-
sprintf(buf, "0x%03x\n", dev->lct_data.tid);
172+
sprintf(buf, "0x%03x\n", i2o_dev->lct_data.tid);
181173
return strlen(buf) + 1;
182174
}
183175

184-
static struct class_device_attribute i2o_device_class_attrs[] = {
185-
__ATTR(class_id, S_IRUGO, i2o_device_class_show_class_id, NULL),
186-
__ATTR(tid, S_IRUGO, i2o_device_class_show_tid, NULL),
176+
struct device_attribute i2o_device_attrs[] = {
177+
__ATTR(class_id, S_IRUGO, i2o_device_show_class_id, NULL),
178+
__ATTR(tid, S_IRUGO, i2o_device_show_tid, NULL),
187179
__ATTR_NULL
188180
};
189181

190-
/* I2O device class */
191-
static 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-
197182
/**
198183
* i2o_device_alloc - Allocate a I2O device and initialize it
199184
*
@@ -217,8 +202,6 @@ static struct i2o_device *i2o_device_alloc(void)
217202

218203
dev->device.bus = &i2o_bus_type;
219204
dev->device.release = &i2o_device_release;
220-
dev->classdev.class = &i2o_device_class;
221-
dev->classdev.dev = &dev->device;
222205

223206
return dev;
224207
}
@@ -311,17 +294,12 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
311294
snprintf(dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit,
312295
dev->lct_data.tid);
313296

314-
snprintf(dev->classdev.class_id, BUS_ID_SIZE, "%d:%03x", c->unit,
315-
dev->lct_data.tid);
316-
317297
dev->device.parent = &c->device;
318298

319299
device_register(&dev->device);
320300

321301
list_add_tail(&dev->list, &c->devices);
322302

323-
class_device_register(&dev->classdev);
324-
325303
i2o_setup_sysfs_links(dev);
326304

327305
i2o_driver_notify_device_add_all(dev);
@@ -343,7 +321,6 @@ void i2o_device_remove(struct i2o_device *i2o_dev)
343321
{
344322
i2o_driver_notify_device_remove_all(i2o_dev);
345323
i2o_remove_sysfs_links(i2o_dev);
346-
class_device_unregister(&i2o_dev->classdev);
347324
list_del(&i2o_dev->list);
348325
device_unregister(&i2o_dev->device);
349326
}
@@ -598,28 +575,6 @@ int i2o_parm_table_get(struct i2o_device *dev, int oper, int group,
598575
return size;
599576
}
600577

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-
*/
608-
int 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-
*/
618-
void i2o_device_exit(void)
619-
{
620-
class_unregister(&i2o_device_class);
621-
}
622-
623578
EXPORT_SYMBOL(i2o_device_claim);
624579
EXPORT_SYMBOL(i2o_device_claim_release);
625580
EXPORT_SYMBOL(i2o_parm_field_get);

‎drivers/message/i2o/driver.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ static int i2o_bus_match(struct device *dev, struct device_driver *drv)
5858
};
5959

6060
/* I2O bus type */
61+
extern struct device_attribute i2o_device_attrs[];
62+
6163
struct bus_type i2o_bus_type = {
6264
.name = "i2o",
6365
.match = i2o_bus_match,
66+
.dev_attrs = i2o_device_attrs,
6467
};
6568

6669
/**

‎drivers/message/i2o/iop.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,14 +1243,10 @@ static int __init i2o_iop_init(void)
12431243

12441244
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
12451245

1246-
rc = i2o_device_init();
1247-
if (rc)
1248-
goto exit;
1249-
12501246
i2o_controller_class = class_create(THIS_MODULE, "i2o_controller");
12511247
if (IS_ERR(i2o_controller_class)) {
12521248
osm_err("can't register class i2o_controller\n");
1253-
goto device_exit;
1249+
goto exit;
12541250
}
12551251

12561252
if ((rc = i2o_driver_init()))
@@ -1273,9 +1269,6 @@ static int __init i2o_iop_init(void)
12731269
class_exit:
12741270
class_destroy(i2o_controller_class);
12751271

1276-
device_exit:
1277-
i2o_device_exit();
1278-
12791272
exit:
12801273
return rc;
12811274
}
@@ -1291,7 +1284,6 @@ static void __exit i2o_iop_exit(void)
12911284
i2o_exec_exit();
12921285
i2o_driver_exit();
12931286
class_destroy(i2o_controller_class);
1294-
i2o_device_exit();
12951287
};
12961288

12971289
module_init(i2o_iop_init);

‎include/linux/i2o.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ struct i2o_device {
6666
struct device device;
6767

6868
struct semaphore lock; /* device lock */
69-
70-
struct class_device classdev; /* i2o device class */
7169
};
7270

7371
/*

0 commit comments

Comments
 (0)