Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151486
b: refs/heads/master
c: e41f8d7
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Jun 5, 2009
1 parent cd056b7 commit 901422f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3b2988841ac6215e137e34e38b71acc915d1f00
refs/heads/master: e41f8d709c31b42129a34305a99d29c38aff75c4
22 changes: 16 additions & 6 deletions trunk/drivers/firewire/fw-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ EXPORT_SYMBOL(fw_csr_iterator_next);

static int is_fw_unit(struct device *dev);

static int match_unit_directory(u32 *directory,
static int match_unit_directory(u32 *directory, u32 match_flags,
const struct ieee1394_device_id *id)
{
struct fw_csr_iterator ci;
Expand All @@ -77,21 +77,31 @@ static int match_unit_directory(u32 *directory,
match |= IEEE1394_MATCH_VERSION;
}

return (match & id->match_flags) == id->match_flags;
return (match & match_flags) == match_flags;
}

static int fw_unit_match(struct device *dev, struct device_driver *drv)
{
struct fw_unit *unit = fw_unit(dev);
struct fw_driver *driver = fw_driver(drv);
int i;
struct fw_device *device;
const struct ieee1394_device_id *id;

/* We only allow binding to fw_units. */
if (!is_fw_unit(dev))
return 0;

for (i = 0; driver->id_table[i].match_flags != 0; i++) {
if (match_unit_directory(unit->directory, &driver->id_table[i]))
device = fw_device(unit->device.parent);

for (id = fw_driver(drv)->id_table; id->match_flags != 0; id++) {
if (match_unit_directory(unit->directory, id->match_flags, id))
return 1;

/* Also check vendor ID in the root directory. */
if ((id->match_flags & IEEE1394_MATCH_VENDOR_ID) &&
match_unit_directory(&device->config_rom[5],
IEEE1394_MATCH_VENDOR_ID, id) &&
match_unit_directory(unit->directory, id->match_flags
& ~IEEE1394_MATCH_VENDOR_ID, id))
return 1;
}

Expand Down

0 comments on commit 901422f

Please sign in to comment.