The USB id table opens with a comment: /* do not change the order of the ID table */ because the dvb_usb_device_properties::devices field makes use of USB ids using hardcoded indices, as in "&a800_table[1]". Inserting new USB ids before the end of the table can cause these indices to go stale and the code to misbehave. In the spirit of "dw2102: use symbolic names for dw2102_table indices", use symbolic names for the indices and C99-style initializers to ensure they continue to refer to the entries they are supposed to. Now you can reorder entries in the id table without fear. Encouraged-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- drivers/media/dvb/dvb-usb/a800.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index 2aef3c89e9fa..3f7ab144218b 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -110,11 +110,17 @@ static int a800_probe(struct usb_interface *intf, THIS_MODULE, NULL, adapter_nr); } -/* do not change the order of the ID table */ +enum a800_table_entry { + AVERMEDIA_A800_COLD, + AVERMEDIA_A800_WARM +}; + static struct usb_device_id a800_table [] = { -/* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_COLD) }, -/* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_WARM) }, - { } /* Terminating entry */ + [AVERMEDIA_A800_COLD] = {USB_DEVICE(USB_VID_AVERMEDIA, + USB_PID_AVERMEDIA_DVBT_USB2_COLD)}, + [AVERMEDIA_A800_WARM] = {USB_DEVICE(USB_VID_AVERMEDIA, + USB_PID_AVERMEDIA_DVBT_USB2_WARM)}, + { } }; MODULE_DEVICE_TABLE (usb, a800_table); @@ -169,9 +175,10 @@ static struct dvb_usb_device_properties a800_properties = { .generic_bulk_ctrl_endpoint = 0x01, .num_device_descs = 1, .devices = { - { "AVerMedia AverTV DVB-T USB 2.0 (A800)", - { &a800_table[0], NULL }, - { &a800_table[1], NULL }, + { + .name = "AVerMedia AverTV DVB-T USB 2.0 (A800)", + .cold_ids = {&a800_table[AVERMEDIA_A800_COLD], NULL}, + .warm_ids = {&a800_table[AVERMEDIA_A800_WARM], NULL}, }, } }; -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html