ieee1394: constify device ID tables
PATCH 1/1 ieee1394: constify device ID tables
Signed-off-by Stefan Richter <[email protected]>
--- drivers/ieee1394/dv1394.c | 2 +- drivers/ieee1394/eth1394.c | 2 +- drivers/ieee1394/nodemgr.c | 4 ++-- drivers/ieee1394/nodemgr.h | 2 +- drivers/ieee1394/raw1394.c | 2 +- drivers/ieee1394/sbp2.c | 2 +- drivers/ieee1394/video1394.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-)
drivers/ieee1394/dv1394.c +1 -1
@@ -2175,7 +2175,7 @@ static const struct file_operations dv13* Export information about protocols/devices supported by this driver. */ #ifdef MODULE -static struct ieee1394_device_id dv1394_id_table[] = { +static const struct ieee1394_device_id dv1394_id_table[] = { { .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION, .specifier_id = AVC_UNIT_SPEC_ID_ENTRY & 0xffffff,
drivers/ieee1394/eth1394.c +1 -1
@@ -438,7 +438,7 @@ static int eth1394_update(struct unit_direturn eth1394_new_node (hi, ud); } -static struct ieee1394_device_id eth1394_id_table[] = { +static const struct ieee1394_device_id eth1394_id_table[] = { { .match_flags = (IEEE1394_MATCH_SPECIFIER_ID |IEEE1394_MATCH_VERSION ),
drivers/ieee1394/nodemgr.c +2 -2
@@ -484,7 +484,7 @@ static struct device_attribute *const fwstatic ssize_t fw_show_drv_device_ids (struct device_driver *drv,char *buf) {struct hpsb_protocol_driver *driver; -struct ieee1394_device_id *id; +const struct ieee1394_device_id *id;int length =0 ;char *scratch = buf;
@@ -658,7 +658,7 @@ static int nodemgr_bus_match(struct devi {struct hpsb_protocol_driver *driver;struct unit_directory *ud; -struct ieee1394_device_id *id; +const struct ieee1394_device_id *id;/* We only match unit directories */ if (dev->platform_data != &nodemgr_ud_platform_data)
drivers/ieee1394/nodemgr.h +1 -1
@@ -125,7 +125,7 @@ struct hpsb_protocol_driver {* probe function below can implement further protocol * dependent or vendor dependent checking. */ -struct ieee1394_device_id *id_table; +const struct ieee1394_device_id *id_table;/* * The update function is called when the node has just
drivers/ieee1394/raw1394.c +1 -1
@@ -2982,7 +2982,7 @@ static int raw1394_release(struct inode* Export information about protocols/devices supported by this driver. */ #ifdef MODULE -static struct ieee1394_device_id raw1394_id_table[] = { +static const struct ieee1394_device_id raw1394_id_table[] = { { .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION, .specifier_id = AVC_UNIT_SPEC_ID_ENTRY & 0xffffff,
drivers/ieee1394/sbp2.c +1 -1
@@ -285,7 +285,7 @@ static const struct hpsb_address_ops sbp/* * Interface to driver core and IEEE 1394 core */ -static struct ieee1394_device_id sbp2_id_table[] = { +static const struct ieee1394_device_id sbp2_id_table[] = { { .match_flags =IEEE1394_MATCH_SPECIFIER_ID |IEEE1394_MATCH_VERSION , .specifier_id =SBP2_UNIT_SPEC_ID_ENTRY &0xffffff ,
drivers/ieee1394/video1394.c +1 -1
@@ -1294,7 +1294,7 @@ static const struct file_operations vide* Export information about protocols/devices supported by this driver. */ #ifdef MODULE -static struct ieee1394_device_id video1394_id_table[] = { +static const struct ieee1394_device_id video1394_id_table[] = { { .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION, .specifier_id = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
Signature · 3 lines
Stefan Richter -=====-==--= --=- -==== http://arcgraph.de/sr/
PATCH 1/1 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 <[email protected]>
--- drivers/firewire/fw-device.c | 16 +++++++++------- drivers/firewire/fw-device.h | 19 +++---------------- drivers/firewire/fw-sbp2.c | 5 +++-- 3 files changed, 15 insertions(+), 25 deletions(-)
drivers/firewire/fw-device.c +9 -7
@@ -26,6 +26,7 @@#include <linux/jiffies.h> #include <linux/kobject.h> #include <linux/list.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/semaphore.h>
@@ -57,7 +58,8 @@ EXPORT_SYMBOL(fw_csr_iterator_next);static int is_fw_unit (struct device *dev); -static int match_unit_directory (u32 * directory,const struct fw_device_id *id) +static int match_unit_directory (u32 *directory, +const struct ieee1394_device_id *id) {struct fw_csr_iterator ci;int key, value, match;
@@ -65,14 +67,14 @@ static int match_unit_directory(u32 * di match =0 ;fw_csr_iterator_init (&ci, directory);while (fw_csr_iterator_next (&ci, &key, &value)) { -if (key ==CSR_VENDOR && value == id->vendor) - match |=FW_MATCH_VENDOR ; -if (key ==CSR_MODEL && value == id->model) - match |=FW_MATCH_MODEL ; +if (key ==CSR_VENDOR && value == id->vendor_id) + match |=IEEE1394_MATCH_VENDOR_ID ; +if (key ==CSR_MODEL && value == id->model_id) + match |=IEEE1394_MATCH_MODEL_ID ;if (key ==CSR_SPECIFIER_ID && value == id->specifier_id) - match |=FW_MATCH_SPECIFIER_ID ; + match |=IEEE1394_MATCH_SPECIFIER_ID ;if (key ==CSR_VERSION && value == id->version) - match |=FW_MATCH_VERSION ; + match |=IEEE1394_MATCH_VERSION ; }return (match & id->match_flags) == id->match_flags;
drivers/firewire/fw-device.h +3 -16
@@ -24,6 +24,7 @@#include <linux/idr.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/sysfs.h>
@@ -168,25 +169,11 @@ void fw_csr_iterator_init(struct fw_csr_int fw_csr_iterator_next (struct fw_csr_iterator *ci,int *key,int *value); -#define FW_MATCH_VENDOR 0x0001 -#define FW_MATCH_MODEL 0x0002 -#define FW_MATCH_SPECIFIER_ID 0x0004 -#define FW_MATCH_VERSION 0x0008 - -struct fw_device_id { -u32 match_flags; -u32 vendor; -u32 model; -u32 specifier_id; -u32 version; -void *driver_data; -}; -struct fw_driver {struct device_driver driver;/* Called when the parent device sits through a bus reset. */ -void (*update) (struct fw_unit *unit); -const struct fw_device_id *id_table; +void (*update)(struct fw_unit *unit); +const struct ieee1394_device_id *id_table; };static inline struct fw_driver *fw_driver (struct device_driver *drv)
drivers/firewire/fw-sbp2.c +3 -2
@@ -1259,9 +1259,10 @@ static void sbp2_update(struct fw_unit *#define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e#define SBP2_SW_VERSION_ENTRY 0x00010483 -static const struct fw_device_id sbp2_id_table[] = { +static const struct ieee1394_device_id sbp2_id_table[] = { { - .match_flags =FW_MATCH_SPECIFIER_ID |FW_MATCH_VERSION , + .match_flags =IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , .specifier_id =SBP2_UNIT_SPEC_ID_ENTRY , .version =SBP2_SW_VERSION_ENTRY , },
Signature · 3 lines
Stefan Richter -=====-==--= --=- -==== http://arcgraph.de/sr/
PATCH 1/1 firewire: also use vendor ID in root directory for driver matches
Due to AV/C protocol extensions, FireDTV devices need a vendor-specific driver. But their configuration ROM features a vendor ID only in the root directory, not in the unit directory.
Signed-off-by Stefan Richter <[email protected]>
--- drivers/firewire/fw-device.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/firewire/fw-device.c +16 -6
@@ -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;
@@ -77,21 +77,31 @@ static int match_unit_directory(u32 *dir 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 ; }
Signature · 3 lines
Stefan Richter -=====-==--= --=- =---- http://arcgraph.de/sr/