Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5645771pxb; Mon, 28 Mar 2022 15:26:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaO+xJxc2cfYusveibS2duOge3OhqjaZPbfIss5NXrfeKavhxfZGMjggFrl9pfwevx7XUs X-Received: by 2002:a05:6870:600a:b0:d7:4895:75be with SMTP id t10-20020a056870600a00b000d7489575bemr660451oaa.35.1648506397660; Mon, 28 Mar 2022 15:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648506397; cv=none; d=google.com; s=arc-20160816; b=J5Cm/Wr0R2O3UcxIUCitBZdrZVT/LW5wxd7/Nhc44AXxvUyP0vjuAIDaSa31ULNuSA BDGCuIMEiFvTTet7NEIYxtT+Rw2RMwrSZmxLEI8L+Bj0zCje9HhY2hJbpLGEuCPRuRLx 7/SmJX7ENlQr2uUFDKOX6u7zvyEhRYr/T+hzXaSZEvUWLKFTmbH5Qyw2X6FeYD+9IUEH R1W7MiMbBNl1JJx1e60SzJiJunm3F1vDukopJle6zfZqg9GPJqI3TsfiW7CuipWdfLjY ta69GUf5kel5Sc/aI3Q0Ea/suIJVQ9t0HD+a12aRSUWNl5saO84SgOc3WEzooXzGt2Ot T45w== 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=qOrayLVe4oByxqiL1Pu9SqvbPqP+czRQR4R99vAptao=; b=ZGxMa4acgcvIdbYu7Td1czG6btoAsAppuZvYHk3WZXxUne/Zw3eiSJrnoF8vPhK1Vw I4cYRT2tvPiRPftQO5G7iiKWEdOmmT0ZQn+IRP+SPZICcukp9pdJWH6wygy+bpIuLynS EoPoahfySuPNewJCeaSjpeGDAln2sNLT3IX5mRuuO+P8wRneO5yBIKqAuwC2Gw6aQkqc jDiOKjv1APRZg9z/NLeb7Ht9pRALjBlCVuFMxYgOq7QuZElRZAH7Dp3CX3RQeuOdClk6 Tl5kV5LZTDKzn8CxExawOxRrpptDRWNeH4tq9QrW1/xVZjiJxQAfs0UgDfQqWPF/nsJV L3uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=hkw9zIuD; 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 k14-20020a056870148e00b000de092671d2si10880809oab.78.2022.03.28.15.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 15:26:37 -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=hkw9zIuD; 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 4D2C21B48CF; Mon, 28 Mar 2022 14:40:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346222AbiC1UsY (ORCPT + 99 others); Mon, 28 Mar 2022 16:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345841AbiC1Un3 (ORCPT ); Mon, 28 Mar 2022 16:43:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C6D674C6; Mon, 28 Mar 2022 13:41:48 -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 1748FB81229; Mon, 28 Mar 2022 20:41:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE19C341DB; 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=1648500104; bh=OZbAm1ebGLpYNVtKje0n/Ne1+7kOD/b8OLKk94dRokY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkw9zIuDEc58wrTEtbwhs4hUl1Nol2jRQm8N4Nila6+M4F8iTBOrNLgVJo/tkZ/RN GMhPaGwUmUAO636B8s9gxthX1qI5mEjy0VNBDBkQXJnJLX2OZBkWsSsasg/68qaDaP b/BWmymLsILs9iNVNLy2B3d3Btcy26SBErJDcmhA8rxZA4Lc6qU1O8AwqosFpfooHa wvKSKzwJJ6WJZIjxIUDHv88t+Ga6c3v/5LBmq3Ztce/ibxae516wEekZjxBJ9TSux9 clfafJ0TH6FQTbXSDxR41rcydwOzEGhL+EpgIKiG/7IJiVSWf4dp8fvfH4Gg4z0AC3 4AXn+b8au1gyw== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1nYwBI-000ld6-Sn; 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 20/26] media: dvb-usb: ttusb2: use an enum for the device number Date: Mon, 28 Mar 2022 22:41:32 +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/ttusb2.c | 36 +++++++++++++++++------------- include/media/dvb-usb-ids.h | 4 ++-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c index 294274fd8f55..373ffa7f641e 100644 --- a/drivers/media/usb/dvb-usb/ttusb2.c +++ b/drivers/media/usb/dvb-usb/ttusb2.c @@ -630,17 +630,23 @@ static int ttusb2_probe(struct usb_interface *intf, return -ENODEV; } -static struct usb_device_id ttusb2_table [] = { - { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_400E) }, - { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_450E) }, - { USB_DEVICE(USB_VID_TECHNOTREND, - USB_PID_TECHNOTREND_CONNECT_S2400) }, - { USB_DEVICE(USB_VID_TECHNOTREND, - USB_PID_TECHNOTREND_CONNECT_CT3650) }, - { USB_DEVICE(USB_VID_TECHNOTREND, - USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM) }, - {} /* Terminating entry */ +enum { + PINNACLE_PCTV_400E, + PINNACLE_PCTV_450E, + TECHNOTREND_CONNECT_S2400, + TECHNOTREND_CONNECT_CT3650, + TECHNOTREND_CONNECT_S2400_8KEEPROM, }; + +static struct usb_device_id ttusb2_table[] = { + DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_400E), + DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_450E), + DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400), + DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_CT3650), + DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400_8KEEPROM), + { } +}; + MODULE_DEVICE_TABLE (usb, ttusb2_table); static struct dvb_usb_device_properties ttusb2_properties = { @@ -688,11 +694,11 @@ static struct dvb_usb_device_properties ttusb2_properties = { .num_device_descs = 2, .devices = { { "Pinnacle 400e DVB-S USB2.0", - { &ttusb2_table[0], NULL }, + { &ttusb2_table[PINNACLE_PCTV_400E], NULL }, { NULL }, }, { "Pinnacle 450e DVB-S USB2.0", - { &ttusb2_table[1], NULL }, + { &ttusb2_table[PINNACLE_PCTV_450E], NULL }, { NULL }, }, } @@ -743,11 +749,11 @@ static struct dvb_usb_device_properties ttusb2_properties_s2400 = { .num_device_descs = 2, .devices = { { "Technotrend TT-connect S-2400", - { &ttusb2_table[2], NULL }, + { &ttusb2_table[TECHNOTREND_CONNECT_S2400], NULL }, { NULL }, }, { "Technotrend TT-connect S-2400 (8kB EEPROM)", - { &ttusb2_table[4], NULL }, + { &ttusb2_table[TECHNOTREND_CONNECT_S2400_8KEEPROM], NULL }, { NULL }, }, } @@ -823,7 +829,7 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = { .num_device_descs = 1, .devices = { { "Technotrend TT-connect CT-3650", - .warm_ids = { &ttusb2_table[3], NULL }, + .warm_ids = { &ttusb2_table[TECHNOTREND_CONNECT_CT3650], NULL }, }, } }; diff --git a/include/media/dvb-usb-ids.h b/include/media/dvb-usb-ids.h index ed6e37f23cbc..0fad68bfe6f9 100644 --- a/include/media/dvb-usb-ids.h +++ b/include/media/dvb-usb-ids.h @@ -312,8 +312,6 @@ #define USB_PID_PCTV_2002E 0x025c #define USB_PID_PCTV_2002E_SE 0x025d #define USB_PID_PCTV_200E 0x020e -#define USB_PID_PCTV_400E 0x020f -#define USB_PID_PCTV_450E 0x0222 #define USB_PID_PCTV_78E 0x025a #define USB_PID_PCTV_79E 0x0262 #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e @@ -329,6 +327,8 @@ #define USB_PID_PINNACLE_PCTV74E 0x0246 #define USB_PID_PINNACLE_PCTV801E 0x023a #define USB_PID_PINNACLE_PCTV801E_SE 0x023b +#define USB_PID_PINNACLE_PCTV_400E 0x020f +#define USB_PID_PINNACLE_PCTV_450E 0x0222 #define USB_PID_PINNACLE_PCTV_452E 0x021f #define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229 #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 -- 2.35.1