bus: Make struct device a pointer
struct bus_type contains an embedded struct device_d which is quite a big structure. Dynamically allocate this instead to save the space in the binary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
7a76f0607b
commit
1a66a77567
|
@ -30,10 +30,11 @@ int bus_register(struct bus_type *bus)
|
||||||
if (get_bus_by_name(bus->name))
|
if (get_bus_by_name(bus->name))
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
strcpy(bus->dev.name, bus->name);
|
bus->dev = xzalloc(sizeof(*bus->dev));
|
||||||
bus->dev.id = DEVICE_ID_SINGLE;
|
strcpy(bus->dev->name, bus->name);
|
||||||
|
bus->dev->id = DEVICE_ID_SINGLE;
|
||||||
|
|
||||||
ret = register_device(&bus->dev);
|
ret = register_device(bus->dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ int register_device(struct device_d *new_device)
|
||||||
|
|
||||||
if (new_device->bus) {
|
if (new_device->bus) {
|
||||||
if (!new_device->parent)
|
if (!new_device->parent)
|
||||||
new_device->parent = &new_device->bus->dev;
|
new_device->parent = new_device->bus->dev;
|
||||||
|
|
||||||
list_add_tail(&new_device->bus_list, &new_device->bus->device_list);
|
list_add_tail(&new_device->bus_list, &new_device->bus->device_list);
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ struct bus_type {
|
||||||
int (*probe)(struct device_d *dev);
|
int (*probe)(struct device_d *dev);
|
||||||
void (*remove)(struct device_d *dev);
|
void (*remove)(struct device_d *dev);
|
||||||
|
|
||||||
struct device_d dev;
|
struct device_d *dev;
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct list_head device_list;
|
struct list_head device_list;
|
||||||
|
|
Loading…
Reference in New Issue