diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-07-12 00:23:28 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-15 10:08:10 +0200 |
commit | 7bc400d14ccfeae112de106ffe6c3ba57e41b11e (patch) | |
tree | 48fa8ab81cdcb38325143d0ddcf281c64553eb64 /drivers | |
parent | 10920b6fe283b1d4c57b09597ad888bfdfdd663e (diff) | |
download | barebox-7bc400d14ccfeae112de106ffe6c3ba57e41b11e.tar.gz barebox-7bc400d14ccfeae112de106ffe6c3ba57e41b11e.tar.xz |
base: Transform "platform_match" into "device_match" and make this function public
This change will allow reuse this function for other buses.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/bus.c | 24 | ||||
-rw-r--r-- | drivers/base/platform.c | 26 |
2 files changed, 25 insertions, 25 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 5251be6b2e..4357020241 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -46,3 +46,27 @@ int bus_register(struct bus_type *bus) return 0; } + +int device_match(struct device_d *dev, struct driver_d *drv) +{ + if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node && + drv->of_compatible) + return of_match(dev, drv); + + if (!strcmp(dev->name, drv->name)) + return 0; + + if (drv->id_table) { + struct platform_device_id *id = drv->id_table; + + while (id->name) { + if (!strcmp(id->name, dev->name)) { + dev->id_entry = id; + return 0; + } + id++; + } + } + + return -1; +} diff --git a/drivers/base/platform.c b/drivers/base/platform.c index e1a8472ff5..34a79b2caa 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -21,30 +21,6 @@ #include <errno.h> #include <init.h> -static int platform_match(struct device_d *dev, struct driver_d *drv) -{ - if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node && - drv->of_compatible) - return of_match(dev, drv); - - if (!strcmp(dev->name, drv->name)) - return 0; - - if (drv->id_table) { - struct platform_device_id *id = drv->id_table; - - while (id->name) { - if (!strcmp(id->name, dev->name)) { - dev->id_entry = id; - return 0; - } - id++; - } - } - - return -1; -} - static int platform_probe(struct device_d *dev) { return dev->driver->probe(dev); @@ -71,7 +47,7 @@ int platform_device_register(struct device_d *new_device) struct bus_type platform_bus = { .name = "platform", - .match = platform_match, + .match = device_match, .probe = platform_probe, .remove = platform_remove, }; |