diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-05-26 15:06:53 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-05-30 12:18:27 +0200 |
commit | 73b0d228e5b00365e7289e9c258acb8de3f716b3 (patch) | |
tree | b17c82b3a4f33d52fdd26c52086e1fa7eaac97a3 /drivers/base | |
parent | 4a4f2f20b8873224983ab9b78173f9bc0564fa33 (diff) | |
download | barebox-73b0d228e5b00365e7289e9c258acb8de3f716b3.tar.gz barebox-73b0d228e5b00365e7289e9c258acb8de3f716b3.tar.xz |
driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/driver.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 30a4bc5e58..c8856304f5 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -201,15 +201,6 @@ struct driver_d *get_driver_by_name(const char *name) return NULL; } -static void noinfo(struct device_d *dev) -{ - printf("no info available for %s\n", dev_name(dev)); -} - -static void noshortinfo(struct device_d *dev) -{ -} - int register_driver(struct driver_d *drv) { struct device_d *dev = NULL; @@ -221,11 +212,6 @@ int register_driver(struct driver_d *drv) list_add_tail(&drv->list, &driver_list); list_add_tail(&drv->bus_list, &drv->bus->driver_list); - if (!drv->info) - drv->info = noinfo; - if (!drv->shortinfo) - drv->shortinfo = noshortinfo; - bus_for_each_device(drv->bus, dev) match(drv, dev); @@ -489,8 +475,8 @@ static int do_devinfo(int argc, char *argv[]) printf("bus: %s\n\n", dev->bus ? dev->bus->name : "none"); - if (dev->driver) - dev->driver->info(dev); + if (dev->info) + dev->info(dev); printf("%s\n", list_empty(&dev->parameters) ? "no parameters available" : "Parameters:"); |