summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-03-06 20:03:50 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-14 08:42:24 +0100
commit1a66a775674e3ae940e68c95e42dbad75af77523 (patch)
treea173a07320e49344cb72fc8989e95069891ccd39 /drivers/base
parent7a76f0607bef50e4439d162e577007aa74f51a5f (diff)
downloadbarebox-1a66a775674e3ae940e68c95e42dbad75af77523.tar.gz
barebox-1a66a775674e3ae940e68c95e42dbad75af77523.tar.xz
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/bus.c7
-rw-r--r--drivers/base/driver.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index e2204da4a4..5251be6b2e 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -30,10 +30,11 @@ int bus_register(struct bus_type *bus)
if (get_bus_by_name(bus->name))
return -EEXIST;
- strcpy(bus->dev.name, bus->name);
- bus->dev.id = DEVICE_ID_SINGLE;
+ bus->dev = xzalloc(sizeof(*bus->dev));
+ strcpy(bus->dev->name, bus->name);
+ bus->dev->id = DEVICE_ID_SINGLE;
- ret = register_device(&bus->dev);
+ ret = register_device(bus->dev);
if (ret)
return ret;
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index fa30c68059..487f478d69 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -135,7 +135,7 @@ int register_device(struct device_d *new_device)
if (new_device->bus) {
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);