diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 11:02:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 11:02:58 -0700 |
commit | bb93109e1544e2a4d12c2c35bf1af84c25a2699d (patch) | |
tree | e60cd9bc1efbaa9500a4ae59cf4f6186eb4ef29e /drivers/firewire/core-device.c | |
parent | 23e3a1d971f6658de5aa423011c153765f28fe26 (diff) | |
parent | bcabcfd2e09ceb8599a33001e812e7cbad00fc4d (diff) |
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Stefan Richter:
"Make struct ieee1394_device_id.driver_data actually avaliable to 1394
protocol drivers. This is especially useful to 1394 audio drivers for
model-specific parameters and methods"
* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: remove support of fw_driver.driver.probe and .remove methods
firewire: introduce fw_driver.probe and .remove methods
Diffstat (limited to 'drivers/firewire/core-device.c')
-rw-r--r-- | drivers/firewire/core-device.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 664a6ff0a82..de4aa409abe 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -165,25 +165,44 @@ static bool match_ids(const struct ieee1394_device_id *id_table, int *id) return (match & id_table->match_flags) == id_table->match_flags; } -static bool is_fw_unit(struct device *dev); - -static int fw_unit_match(struct device *dev, struct device_driver *drv) +static const struct ieee1394_device_id *unit_match(struct device *dev, + struct device_driver *drv) { const struct ieee1394_device_id *id_table = container_of(drv, struct fw_driver, driver)->id_table; int id[] = {0, 0, 0, 0}; - /* We only allow binding to fw_units. */ - if (!is_fw_unit(dev)) - return 0; - get_modalias_ids(fw_unit(dev), id); for (; id_table->match_flags != 0; id_table++) if (match_ids(id_table, id)) - return 1; + return id_table; - return 0; + return NULL; +} + +static bool is_fw_unit(struct device *dev); + +static int fw_unit_match(struct device *dev, struct device_driver *drv) +{ + /* We only allow binding to fw_units. */ + return is_fw_unit(dev) && unit_match(dev, drv) != NULL; +} + +static int fw_unit_probe(struct device *dev) +{ + struct fw_driver *driver = + container_of(dev->driver, struct fw_driver, driver); + + return driver->probe(fw_unit(dev), unit_match(dev, dev->driver)); +} + +static int fw_unit_remove(struct device *dev) +{ + struct fw_driver *driver = + container_of(dev->driver, struct fw_driver, driver); + + return driver->remove(fw_unit(dev)), 0; } static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) @@ -213,6 +232,8 @@ static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) struct bus_type fw_bus_type = { .name = "firewire", .match = fw_unit_match, + .probe = fw_unit_probe, + .remove = fw_unit_remove, }; EXPORT_SYMBOL(fw_bus_type); |