summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/af9005.c
diff options
context:
space:
mode:
authorJonathan Nieder2012-01-07 08:11:27 +0100
committerMauro Carvalho Chehab2012-01-11 01:46:14 +0100
commitd07b901f9dc22977c2c04f320a9cef19e5298e7e (patch)
tree0f63c671c433658d8c4c7d77ae8ce5c99b92afc1 /drivers/media/dvb/dvb-usb/af9005.c
parent[media] cx231xx: use URB_NO_TRANSFER_DMA_MAP on URBs allocated with usb_alloc... (diff)
downloadkernel-qcow2-linux-d07b901f9dc22977c2c04f320a9cef19e5298e7e.tar.gz
kernel-qcow2-linux-d07b901f9dc22977c2c04f320a9cef19e5298e7e.tar.xz
kernel-qcow2-linux-d07b901f9dc22977c2c04f320a9cef19e5298e7e.zip
[media] af9005, af9015: use symbolic names for USB id table indices
The af9005_properties and af9015_properties tables make use of USB ids from the USB id tables with hardcoded indices, as in "&af9015_usb_table[30]". Adding new entries before the end breaks such references, so everyone has had to carefully tiptoe to only add entries at the end of the list. In the spirit of "dw2102: use symbolic names for dw2102_table indices", use C99-style initializers with symbolic names for each index to avoid this. In the new regime, properties tables referring to the USB ids have names like "&af9015_usb_table[CINERGY_T_STICK_RC]" that do not change meaning when items in the USB id table are reordered. Encouraged-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Luca Olivetti <luca@ventoso.org> Acked-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/af9005.c')
-rw-r--r--drivers/media/dvb/dvb-usb/af9005.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c
index bd51a764351b..5d5e32f4e99d 100644
--- a/drivers/media/dvb/dvb-usb/af9005.c
+++ b/drivers/media/dvb/dvb-usb/af9005.c
@@ -977,11 +977,20 @@ static int af9005_usb_probe(struct usb_interface *intf,
THIS_MODULE, NULL, adapter_nr);
}
+enum af9005_usb_table_entry {
+ AFATECH_AF9005,
+ TERRATEC_AF9005,
+ ANSONIC_AF9005,
+};
+
static struct usb_device_id af9005_usb_table[] = {
- {USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9005)},
- {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_USB_XE)},
- {USB_DEVICE(USB_VID_ANSONIC, USB_PID_ANSONIC_DVBT_USB)},
- {0},
+ [AFATECH_AF9005] = {USB_DEVICE(USB_VID_AFATECH,
+ USB_PID_AFATECH_AF9005)},
+ [TERRATEC_AF9005] = {USB_DEVICE(USB_VID_TERRATEC,
+ USB_PID_TERRATEC_CINERGY_T_USB_XE)},
+ [ANSONIC_AF9005] = {USB_DEVICE(USB_VID_ANSONIC,
+ USB_PID_ANSONIC_DVBT_USB)},
+ { }
};
MODULE_DEVICE_TABLE(usb, af9005_usb_table);
@@ -1041,15 +1050,15 @@ static struct dvb_usb_device_properties af9005_properties = {
.num_device_descs = 3,
.devices = {
{.name = "Afatech DVB-T USB1.1 stick",
- .cold_ids = {&af9005_usb_table[0], NULL},
+ .cold_ids = {&af9005_usb_table[AFATECH_AF9005], NULL},
.warm_ids = {NULL},
},
{.name = "TerraTec Cinergy T USB XE",
- .cold_ids = {&af9005_usb_table[1], NULL},
+ .cold_ids = {&af9005_usb_table[TERRATEC_AF9005], NULL},
.warm_ids = {NULL},
},
{.name = "Ansonic DVB-T USB1.1 stick",
- .cold_ids = {&af9005_usb_table[2], NULL},
+ .cold_ids = {&af9005_usb_table[ANSONIC_AF9005], NULL},
.warm_ids = {NULL},
},
{NULL},