From: <aot...@us...> - 2004-03-02 23:39:46
|
Update of /cvsroot/gc-linux/linux/drivers/exi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30330/drivers/exi Modified Files: exi-driver.c Log Message: Added match callback to do generic driver binding - exi_bus_match() Index: exi-driver.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/exi/exi-driver.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exi-driver.c 27 Feb 2004 12:26:02 -0000 1.1 +++ exi-driver.c 2 Mar 2004 23:27:37 -0000 1.2 @@ -40,9 +40,39 @@ driver_unregister(&drv->driver); } +/** + * exi_bus_match - attach a driver to a device. + * @dev: device structure to match. + * @drv: driver structure to match against. + * + * Attaches a driver to a device by matching the device IDs + * the driver claims to support with the actual device ID of + * a particular device. + * + * Returns 1 when driver is attached, 0 otherwise. + */ +static int exi_bus_match(struct device *dev, struct device_driver *drv) +{ + struct exi_dev *exi_dev = to_exi_dev(dev); + struct exi_driver *exi_drv = to_exi_driver(drv); + const struct exi_device_id *ids = exi_drv->id_table; + + if (!ids) + return 0; + + while (ids->dev_id) { + if (ids->dev_id == exi_dev->id) + return 1; + ids++; + } + + return 0; +} + struct bus_type exi_bus_type = { .name = "exi", + .match = exi_bus_match, }; static int __init exi_driver_init(void) |