mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 07:31:29 +00:00
mcb: Correctly initialize the bus's device
The mcb bus' device member wasn't correctly initialized and thus wasn't placed correctly into the driver model. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bc46b45a42
commit
18d2881980
@ -187,6 +187,7 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier)
|
|||||||
{
|
{
|
||||||
struct mcb_bus *bus;
|
struct mcb_bus *bus;
|
||||||
int bus_nr;
|
int bus_nr;
|
||||||
|
int rc;
|
||||||
|
|
||||||
bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL);
|
bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL);
|
||||||
if (!bus)
|
if (!bus)
|
||||||
@ -194,14 +195,26 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier)
|
|||||||
|
|
||||||
bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL);
|
bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL);
|
||||||
if (bus_nr < 0) {
|
if (bus_nr < 0) {
|
||||||
kfree(bus);
|
rc = bus_nr;
|
||||||
return ERR_PTR(bus_nr);
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&bus->children);
|
|
||||||
bus->bus_nr = bus_nr;
|
bus->bus_nr = bus_nr;
|
||||||
bus->carrier = carrier;
|
bus->carrier = carrier;
|
||||||
|
|
||||||
|
device_initialize(&bus->dev);
|
||||||
|
bus->dev.parent = carrier;
|
||||||
|
bus->dev.bus = &mcb_bus_type;
|
||||||
|
|
||||||
|
dev_set_name(&bus->dev, "mcb:%d", bus_nr);
|
||||||
|
rc = device_add(&bus->dev);
|
||||||
|
if (rc)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
return bus;
|
return bus;
|
||||||
|
err_free:
|
||||||
|
kfree(bus);
|
||||||
|
return ERR_PTR(rc);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mcb_alloc_bus);
|
EXPORT_SYMBOL_GPL(mcb_alloc_bus);
|
||||||
|
|
||||||
|
@ -21,13 +21,12 @@ struct mcb_device;
|
|||||||
/**
|
/**
|
||||||
* struct mcb_bus - MEN Chameleon Bus
|
* struct mcb_bus - MEN Chameleon Bus
|
||||||
*
|
*
|
||||||
* @dev: pointer to carrier device
|
* @dev: bus device
|
||||||
* @children: the child busses
|
* @carrier: pointer to carrier device
|
||||||
* @bus_nr: mcb bus number
|
* @bus_nr: mcb bus number
|
||||||
* @get_irq: callback to get IRQ number
|
* @get_irq: callback to get IRQ number
|
||||||
*/
|
*/
|
||||||
struct mcb_bus {
|
struct mcb_bus {
|
||||||
struct list_head children;
|
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct device *carrier;
|
struct device *carrier;
|
||||||
int bus_nr;
|
int bus_nr;
|
||||||
|
Loading…
Reference in New Issue
Block a user