Commit d07b901f authored by Jonathan Nieder's avatar Jonathan Nieder Committed by Mauro Carvalho Chehab

[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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
Acked-by: default avatarLuca Olivetti <luca@ventoso.org>
Acked-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7a6f6c29
......@@ -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},
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment