diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-02-15 17:12:34 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-06-05 10:26:17 -0400 |
commit | b3b2988841ac6215e137e34e38b71acc915d1f00 (patch) | |
tree | a79df9327881a789f22f97ccebb4618008bf8529 /drivers | |
parent | 0210b66dd88a2a1e451901b00378a2068b6ccb35 (diff) |
firewire: share device ID table type with ieee1394
That way, the new firedtv driver will be able to use a single ID table
in builds against ieee1394 core and/or against firewire core.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-device.c | 16 | ||||
-rw-r--r-- | drivers/firewire/fw-device.h | 19 | ||||
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 5 |
3 files changed, 15 insertions, 25 deletions
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 551588342898..47b5b422616b 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/jiffies.h> | 26 | #include <linux/jiffies.h> |
27 | #include <linux/kobject.h> | 27 | #include <linux/kobject.h> |
28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
29 | #include <linux/mod_devicetable.h> | ||
29 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
30 | #include <linux/rwsem.h> | 31 | #include <linux/rwsem.h> |
31 | #include <linux/semaphore.h> | 32 | #include <linux/semaphore.h> |
@@ -57,7 +58,8 @@ EXPORT_SYMBOL(fw_csr_iterator_next); | |||
57 | 58 | ||
58 | static int is_fw_unit(struct device *dev); | 59 | static int is_fw_unit(struct device *dev); |
59 | 60 | ||
60 | static int match_unit_directory(u32 * directory, const struct fw_device_id *id) | 61 | static int match_unit_directory(u32 *directory, |
62 | const struct ieee1394_device_id *id) | ||
61 | { | 63 | { |
62 | struct fw_csr_iterator ci; | 64 | struct fw_csr_iterator ci; |
63 | int key, value, match; | 65 | int key, value, match; |
@@ -65,14 +67,14 @@ static int match_unit_directory(u32 * directory, const struct fw_device_id *id) | |||
65 | match = 0; | 67 | match = 0; |
66 | fw_csr_iterator_init(&ci, directory); | 68 | fw_csr_iterator_init(&ci, directory); |
67 | while (fw_csr_iterator_next(&ci, &key, &value)) { | 69 | while (fw_csr_iterator_next(&ci, &key, &value)) { |
68 | if (key == CSR_VENDOR && value == id->vendor) | 70 | if (key == CSR_VENDOR && value == id->vendor_id) |
69 | match |= FW_MATCH_VENDOR; | 71 | match |= IEEE1394_MATCH_VENDOR_ID; |
70 | if (key == CSR_MODEL && value == id->model) | 72 | if (key == CSR_MODEL && value == id->model_id) |
71 | match |= FW_MATCH_MODEL; | 73 | match |= IEEE1394_MATCH_MODEL_ID; |
72 | if (key == CSR_SPECIFIER_ID && value == id->specifier_id) | 74 | if (key == CSR_SPECIFIER_ID && value == id->specifier_id) |
73 | match |= FW_MATCH_SPECIFIER_ID; | 75 | match |= IEEE1394_MATCH_SPECIFIER_ID; |
74 | if (key == CSR_VERSION && value == id->version) | 76 | if (key == CSR_VERSION && value == id->version) |
75 | match |= FW_MATCH_VERSION; | 77 | match |= IEEE1394_MATCH_VERSION; |
76 | } | 78 | } |
77 | 79 | ||
78 | return (match & id->match_flags) == id->match_flags; | 80 | return (match & id->match_flags) == id->match_flags; |
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 892dd5916276..e973c4361f48 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/idr.h> | 24 | #include <linux/idr.h> |
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/mod_devicetable.h> | ||
27 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
28 | #include <linux/rwsem.h> | 29 | #include <linux/rwsem.h> |
29 | #include <linux/sysfs.h> | 30 | #include <linux/sysfs.h> |
@@ -172,25 +173,11 @@ void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); | |||
172 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, | 173 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, |
173 | int *key, int *value); | 174 | int *key, int *value); |
174 | 175 | ||
175 | #define FW_MATCH_VENDOR 0x0001 | ||
176 | #define FW_MATCH_MODEL 0x0002 | ||
177 | #define FW_MATCH_SPECIFIER_ID 0x0004 | ||
178 | #define FW_MATCH_VERSION 0x0008 | ||
179 | |||
180 | struct fw_device_id { | ||
181 | u32 match_flags; | ||
182 | u32 vendor; | ||
183 | u32 model; | ||
184 | u32 specifier_id; | ||
185 | u32 version; | ||
186 | void *driver_data; | ||
187 | }; | ||
188 | |||
189 | struct fw_driver { | 176 | struct fw_driver { |
190 | struct device_driver driver; | 177 | struct device_driver driver; |
191 | /* Called when the parent device sits through a bus reset. */ | 178 | /* Called when the parent device sits through a bus reset. */ |
192 | void (*update) (struct fw_unit *unit); | 179 | void (*update)(struct fw_unit *unit); |
193 | const struct fw_device_id *id_table; | 180 | const struct ieee1394_device_id *id_table; |
194 | }; | 181 | }; |
195 | 182 | ||
196 | static inline struct fw_driver *fw_driver(struct device_driver *drv) | 183 | static inline struct fw_driver *fw_driver(struct device_driver *drv) |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 2bcf51557c72..2a707754532b 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -1259,9 +1259,10 @@ static void sbp2_update(struct fw_unit *unit) | |||
1259 | #define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e | 1259 | #define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e |
1260 | #define SBP2_SW_VERSION_ENTRY 0x00010483 | 1260 | #define SBP2_SW_VERSION_ENTRY 0x00010483 |
1261 | 1261 | ||
1262 | static const struct fw_device_id sbp2_id_table[] = { | 1262 | static const struct ieee1394_device_id sbp2_id_table[] = { |
1263 | { | 1263 | { |
1264 | .match_flags = FW_MATCH_SPECIFIER_ID | FW_MATCH_VERSION, | 1264 | .match_flags = IEEE1394_MATCH_SPECIFIER_ID | |
1265 | IEEE1394_MATCH_VERSION, | ||
1265 | .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY, | 1266 | .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY, |
1266 | .version = SBP2_SW_VERSION_ENTRY, | 1267 | .version = SBP2_SW_VERSION_ENTRY, |
1267 | }, | 1268 | }, |