Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5635797pxb; Mon, 28 Mar 2022 15:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykOlOFSacOjj3qfKo0TtCN+rwkEA3UDIIOyRM3g9Vw4C/kXWnrAfc+LL9PK+Y+FptoZSGk X-Received: by 2002:a1f:3244:0:b0:332:2037:83b1 with SMTP id y65-20020a1f3244000000b00332203783b1mr14697352vky.24.1648505847511; Mon, 28 Mar 2022 15:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648505847; cv=none; d=google.com; s=arc-20160816; b=FmuDXxP9CXQwVFDhWIu+CWyc62z6MD9DYkR4ZwzPhH9yfji6rACuRNVXWAefLGtp6w qWpUPea9PowaeI8ET7cf+nZYs/AMjSq/HzFecZxhE4CGUSAgs5GnZQpxjhc+Wt4p6Kt8 kkJBj/2o+8tZWZGTsS7VkY1AORLusjseGFibEu2sWSShTZldp4Aw7cmFR9fOcDTWcF7E 009H/l/hR4hnQqqawIbdFcXH6We/EaVQ1tRnMKHiVdDpm6t0hWNekPOWo+IkzYjUfEav 8kiqtPS7yoKWaFvVhQjNUVxG4kd/q5re4moJDe0FOn/ajtsDIhaKpLpDYbAjQfYTasG4 mVUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=vFq57pdXnxk1pzOCaJXUwZDG8BLGdWWLpTEAV16gRLU=; b=MhJ7SCdL4b3D+WT93mllLNzbikkkVx7XljlWLWhykzSf2d22ub8XpVoqcseFsTsWkL 3jjYm4hD2JW4SG0CUrZwTt6fSN4NAlp30gyUnmhlQDwO2DeCRETxGDScXnqPS6ipOP/S KX137meaSciUj7M6am6tEUZhNcAbH7Tt9aGDeylaQimcvPkr2DwJwii18uJDLPw9VXTC IS+sA3AcD4h9XgVniu3vFSiRIE1VCYbH8hkEAIr4CURDRmltWTc0aWZFjkwKmyuj1oXF 89+DtC0EnAmF1uK3u0zsnaP8IbThkHdIUnHJpSaCn1hbwtisPEoS4gMnQ3Ub4KDw/iuK tI2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=KFFSMQQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r30-20020a67c31e000000b0032573772170si3146605vsj.324.2022.03.28.15.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 15:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=KFFSMQQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 344E5180228; Mon, 28 Mar 2022 14:34:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345627AbiC1Uqz (ORCPT + 99 others); Mon, 28 Mar 2022 16:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345683AbiC1Un1 (ORCPT ); Mon, 28 Mar 2022 16:43:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 883C067D09; Mon, 28 Mar 2022 13:41:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 19CBCB81217; Mon, 28 Mar 2022 20:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC28AC341D5; Mon, 28 Mar 2022 20:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648500103; bh=Hi9bdGTrkLqzCP9PA6HQj7j6ahQbZYu8OOriI1R776k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFFSMQQJP4k20mAYa8Cj2ojkSgwlEJi6anqJu7nmUbkgxCi6wDJkxXG9EYkhdgCE6 RM4mAMB+BZqXCSypbYmCpfXvXvS1jFWSRsPXW5U/3SDXmVizKV8O9O6Xyk459KO2wi OGRjLqN8/omJZ4q94/zfqgkBS56ImcTRlXORl7xmykx4IjNAyprVAMK5q4ITlXH136 0HukNFqJ6mhMsj2FgAoEpgxxCbUOiaq5ceqWP5dkLFkfxw3eciimWsFtLLikd+QAlJ 1HsvCuWRvGwfCbmvfzevy9ZmarMvWfSNy7aX7aOiztHWnsF0vMa2/qlac7bwNVWGTc A64h/GdlMA8/g== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1nYwBI-000lcm-Jd; Mon, 28 Mar 2022 22:41:40 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 15/26] media: dvb-usb: m920x: use an enum for the device number Date: Mon, 28 Mar 2022 22:41:27 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The device number is currently a value that needs to be the same on two separate tables, but the code doesn't actually enforce it, leading to errors as boards get added or removed. Fix it by using an enum. Signed-off-by: Mauro Carvalho Chehab --- To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 00/26] at: https://lore.kernel.org/all/cover.1648499509.git.mchehab@kernel.org/ drivers/media/usb/dvb-usb/m920x.c | 51 ++++++++++++++++++------------- include/media/dvb-usb-ids.h | 10 +++--- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c index 691e05833db1..548199cd86f6 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -897,20 +897,29 @@ static int m920x_probe(struct usb_interface *intf, return ret; } -static struct usb_device_id m920x_table [] = { - { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) }, - { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, - USB_PID_MSI_DIGI_VOX_MINI_II) }, - { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, - USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) }, - { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, - USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, - { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, - { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, - { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) }, - { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) }, - { } /* Terminating entry */ +enum { + MSI_MEGASKY580, + ANUBIS_MSI_DIGI_VOX_MINI_II, + ANUBIS_LIFEVIEW_TV_WALKER_TWIN_COLD, + ANUBIS_LIFEVIEW_TV_WALKER_TWIN_WARM, + DPOSH_M9206_COLD, + DPOSH_M9206_WARM, + VISIONPLUS_PINNACLE_PCTV310E, + AZUREWAVE_TWINHAN_VP7049, }; + +static struct usb_device_id m920x_table[] = { + DVB_USB_DEV(MSI, MSI_MEGASKY580), + DVB_USB_DEV(ANUBIS_ELECTRONIC, ANUBIS_MSI_DIGI_VOX_MINI_II), + DVB_USB_DEV(ANUBIS_ELECTRONIC, ANUBIS_LIFEVIEW_TV_WALKER_TWIN_COLD), + DVB_USB_DEV(ANUBIS_ELECTRONIC, ANUBIS_LIFEVIEW_TV_WALKER_TWIN_WARM), + DVB_USB_DEV(DPOSH, DPOSH_M9206_COLD), + DVB_USB_DEV(DPOSH, DPOSH_M9206_WARM), + DVB_USB_DEV(VISIONPLUS, VISIONPLUS_PINNACLE_PCTV310E), + DVB_USB_DEV(AZUREWAVE, AZUREWAVE_TWINHAN_VP7049), + { } +}; + MODULE_DEVICE_TABLE (usb, m920x_table); static struct dvb_usb_device_properties megasky_properties = { @@ -962,7 +971,7 @@ static struct dvb_usb_device_properties megasky_properties = { .num_device_descs = 1, .devices = { { "MSI Mega Sky 580 DVB-T USB2.0", - { &m920x_table[0], NULL }, + { &m920x_table[MSI_MEGASKY580], NULL }, { NULL }, } } @@ -1010,7 +1019,7 @@ static struct dvb_usb_device_properties digivox_mini_ii_properties = { .num_device_descs = 1, .devices = { { "MSI DIGI VOX mini II DVB-T USB2.0", - { &m920x_table[1], NULL }, + { &m920x_table[ANUBIS_MSI_DIGI_VOX_MINI_II], NULL }, { NULL }, }, } @@ -1097,8 +1106,8 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { .num_device_descs = 1, .devices = { { .name = "LifeView TV Walker Twin DVB-T USB2.0", - .cold_ids = { &m920x_table[2], NULL }, - .warm_ids = { &m920x_table[3], NULL }, + .cold_ids = { &m920x_table[ANUBIS_LIFEVIEW_TV_WALKER_TWIN_COLD], NULL }, + .warm_ids = { &m920x_table[ANUBIS_LIFEVIEW_TV_WALKER_TWIN_WARM], NULL }, }, } }; @@ -1139,8 +1148,8 @@ static struct dvb_usb_device_properties dposh_properties = { .num_device_descs = 1, .devices = { { .name = "Dposh DVB-T USB2.0", - .cold_ids = { &m920x_table[4], NULL }, - .warm_ids = { &m920x_table[5], NULL }, + .cold_ids = { &m920x_table[DPOSH_M9206_COLD], NULL }, + .warm_ids = { &m920x_table[DPOSH_M9206_WARM], NULL }, }, } }; @@ -1195,7 +1204,7 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { .num_device_descs = 1, .devices = { { "Pinnacle PCTV 310e", - { &m920x_table[6], NULL }, + { &m920x_table[VISIONPLUS_PINNACLE_PCTV310E], NULL }, { NULL }, } } @@ -1250,7 +1259,7 @@ static struct dvb_usb_device_properties vp7049_properties = { .num_device_descs = 1, .devices = { { "DTV-DVB UDTT7049", - { &m920x_table[7], NULL }, + { &m920x_table[AZUREWAVE_TWINHAN_VP7049], NULL }, { NULL }, } } diff --git a/include/media/dvb-usb-ids.h b/include/media/dvb-usb-ids.h index e41902d06ccc..10d73c108149 100644 --- a/include/media/dvb-usb-ids.h +++ b/include/media/dvb-usb-ids.h @@ -106,6 +106,9 @@ #define USB_PID_AME_DTV5100 0xa232 #define USB_PID_ANCHOR_NEBULA_DIGITV 0x0201 #define USB_PID_ANSONIC_DVBT_USB 0x6000 +#define USB_PID_ANUBIS_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 +#define USB_PID_ANUBIS_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 +#define USB_PID_ANUBIS_MSI_DIGI_VOX_MINI_II 0x1513 #define USB_PID_ANYSEE 0x861f #define USB_PID_ARTEC_T14BR 0x810f #define USB_PID_ARTEC_T14_COLD 0x810b @@ -149,6 +152,7 @@ #define USB_PID_AZUREWAVE_6007 0x0ccd #define USB_PID_AZUREWAVE_AD_TU700 0x3237 #define USB_PID_AZUREWAVE_AZ6027 0x3275 +#define USB_PID_AZUREWAVE_TWINHAN_VP7049 0x3219 #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d @@ -283,14 +287,11 @@ #define USB_PID_KWORLD_VSTREAM_WARM 0x17df #define USB_PID_KYE_DVB_T_COLD 0x701e #define USB_PID_KYE_DVB_T_WARM 0x701f -#define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 -#define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 #define USB_PID_LITEON_DVB_T_COLD 0xf000 #define USB_PID_LITEON_DVB_T_WARM 0xf001 #define USB_PID_MEDION_MD95700 0x0932 #define USB_PID_MIGLIA_WT220U_ZAP250_COLD 0x0220 #define USB_PID_MSI_DIGIVOX_DUO 0x8801 -#define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513 #define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807 #define USB_PID_MSI_MEGASKY580 0x5580 #define USB_PID_MSI_MEGASKY580_55801 0x5581 @@ -317,7 +318,6 @@ #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e #define USB_PID_PINNACLE_PCTV2000E 0x022c #define USB_PID_PINNACLE_PCTV282E 0x0248 -#define USB_PID_PINNACLE_PCTV310E 0x3211 #define USB_PID_PINNACLE_PCTV340E 0x023d #define USB_PID_PINNACLE_PCTV340E_SE 0x023e #define USB_PID_PINNACLE_PCTV71E 0x022b @@ -416,7 +416,6 @@ #define USB_PID_TWINHAN_VP7041_WARM 0x3202 #define USB_PID_TWINHAN_VP7045_COLD 0x3205 #define USB_PID_TWINHAN_VP7045_WARM 0x3206 -#define USB_PID_TWINHAN_VP7049 0x3219 #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 @@ -429,6 +428,7 @@ #define USB_PID_UNIWILL_STK7700P 0x6003 #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f +#define USB_PID_VISIONPLUS_PINNACLE_PCTV310E 0x3211 #define USB_PID_WIDEVIEW_DTT200U_COLD 0x0201 #define USB_PID_WIDEVIEW_DTT200U_WARM 0x0301 #define USB_PID_WIDEVIEW_WT220U_COLD 0x0222 -- 2.35.1