Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5575696pxb; Mon, 28 Mar 2022 14:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6oTmcEliL3yv1QvAHSZhr9NFZEYf88fLFD98LSCCl44BFGdVPu5x/tvSPo/rW+3o2CPJh X-Received: by 2002:a4a:1106:0:b0:324:acea:8de with SMTP id 6-20020a4a1106000000b00324acea08demr9553769ooc.41.1648502800585; Mon, 28 Mar 2022 14:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648502800; cv=none; d=google.com; s=arc-20160816; b=0IHegtlDLWeWJz7E3L00O3kWy3Mu2StE2JYGJw6WSKzD3GzqBTbun0DUNfn+i9oKp2 nzisDNxq4yuePEHqivxU3x3BcexTVNjzE6K6wcUwwdxv39orN7ZcQzG7uTf38XFVIiJ5 8fLzSJstJ8Qewxps+8eOzOUuNhZg4m7ifyO92Bxndm7FDWR+MrSF1okJDzQi2Y92QOUv 2BAjwwyBp/uMy5H1R+6cqUkCpHc1uOPKcXzIFVAKQk7zWp2YbZVBK4DPmnjLtVsLq/eq ar+Xbi8lltQ4neALyK0N1oGmDwJ40jWua2li9ouWIDaZs4svqUpV61KVoURhuCICAi86 owNA== 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=HdUfitGzj/zSmb0REMMJ00VLEiMNH+15wA2QfuXxqzE=; b=bUgwtNp/CD7Km60r9fzCtkiJyIK516tnb1Et/sixQm0nieg6pdaqvezBWSKX7WqMXv 4sVf+CFn8gwlTxsqyihTMUjuJWK4dlUUP0hS9j8yqAsyIgbFb2ek4G+hC1c7kQPB6S4F RwQ2aY3Q63kLTYXR/QdoKx+usog7OfckA+vdjxMZHDL7R3VuMpOx196/ffS4H+q0lsfE KB7xBBVll4DKpsu5FrZvIC8tNsZZKK5lbpESYq/WlJ8K1ZlTh/UvkJdfAghfSY3GVLJY ZH9huGd1vBFFmpw07wjB+nZ8+RmO1KxI212FzfFqYd+MnBOdR7yk7Bg/7qEqelaX0nhI DvtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=R9h30IAy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w22-20020a056808141600b002ef0c347669si13413676oiv.233.2022.03.28.14.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:26:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=R9h30IAy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (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 4C0AE3B3EF; Mon, 28 Mar 2022 14:10:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345433AbiC1UqE (ORCPT + 99 others); Mon, 28 Mar 2022 16:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345657AbiC1UnY (ORCPT ); Mon, 28 Mar 2022 16:43:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9130366ACC; Mon, 28 Mar 2022 13:41:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3303F614B3; Mon, 28 Mar 2022 20:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9306BC340ED; Mon, 28 Mar 2022 20:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648500102; bh=kWgGrhwx6DwAxyD1VMwH9Xw1QxCd/o7nc+h7FA2drrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R9h30IAyzmOvqaQe+Wt6s4dtwgekH/Z/c8JIhXUPSJ+SDYT5HEDEQOs1cC55zlbse SVH/qG8fVXne/OiVu6hhugpx5C6OztIPtbZ6GRcUITejO7CzojGeMriZ8SNbtmXlLm 8NQLnrVcDOArEm5eCET0pFrHKEcOgsJIehkEK7LqTLY9IowqM5Qv8+N5rr9ZWSexni fsqxtUA943a9Ftd9HQhyFLuEJEbGXf0vTV0iK4Gy5KpcyCDh54ofvWYonZ3rEFo4eC e1sPH3ssgrxR7vHinS33phJrmmT0EJxzshcGeXvQ11yNb+tEEFhUEN9nhp+TZBc2m0 w7VcDuEi6OhBQ== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1nYwBI-000lcG-6t; Mon, 28 Mar 2022 22:41:40 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Pavel Skripkin , Sean Young , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 07/26] media: dvb-usb: az6027: use an enum for the device number Date: Mon, 28 Mar 2022 22:41:19 +0200 Message-Id: <65b9775c39dcd21e5cb75a86e1e7b99b7d6eefcd.1648499509.git.mchehab@kernel.org> 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/az6027.c | 45 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c index 86788771175b..cf15988dfb51 100644 --- a/drivers/media/usb/dvb-usb/az6027.c +++ b/drivers/media/usb/dvb-usb/az6027.c @@ -1080,16 +1080,27 @@ static int az6027_identify_state(struct usb_device *udev, } +enum { + AZUREWAVE_AZ6027, + TERRATEC_DVBS2CI_V1, + TERRATEC_DVBS2CI_V2, + TECHNISAT_USB2_HDCI_V1, + TECHNISAT_USB2_HDCI_V2, + ELGATO_EYETV_SAT, + ELGATO_EYETV_SAT_V2, + ELGATO_EYETV_SAT_V3, +}; + static struct usb_device_id az6027_usb_table[] = { - { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, - { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V1) }, - { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) }, - { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, - { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, - { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) }, - { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V2) }, - { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V3) }, - { }, + DVB_USB_DEV(AZUREWAVE, AZUREWAVE_AZ6027), + DVB_USB_DEV(TERRATEC, TERRATEC_DVBS2CI_V1), + DVB_USB_DEV(TERRATEC, TERRATEC_DVBS2CI_V2), + DVB_USB_DEV(TECHNISAT, TECHNISAT_USB2_HDCI_V1), + DVB_USB_DEV(TECHNISAT, TECHNISAT_USB2_HDCI_V2), + DVB_USB_DEV(ELGATO, ELGATO_EYETV_SAT), + DVB_USB_DEV(ELGATO, ELGATO_EYETV_SAT_V2), + DVB_USB_DEV(ELGATO, ELGATO_EYETV_SAT_V3), + { } }; MODULE_DEVICE_TABLE(usb, az6027_usb_table); @@ -1141,35 +1152,35 @@ static struct dvb_usb_device_properties az6027_properties = { .devices = { { .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", - .cold_ids = { &az6027_usb_table[0], NULL }, + .cold_ids = { &az6027_usb_table[AZUREWAVE_AZ6027], NULL }, .warm_ids = { NULL }, }, { .name = "TERRATEC S7", - .cold_ids = { &az6027_usb_table[1], NULL }, + .cold_ids = { &az6027_usb_table[TERRATEC_DVBS2CI_V1], NULL }, .warm_ids = { NULL }, }, { .name = "TERRATEC S7 MKII", - .cold_ids = { &az6027_usb_table[2], NULL }, + .cold_ids = { &az6027_usb_table[TERRATEC_DVBS2CI_V2], NULL }, .warm_ids = { NULL }, }, { .name = "Technisat SkyStar USB 2 HD CI", - .cold_ids = { &az6027_usb_table[3], NULL }, + .cold_ids = { &az6027_usb_table[TECHNISAT_USB2_HDCI_V1], NULL }, .warm_ids = { NULL }, }, { .name = "Technisat SkyStar USB 2 HD CI", - .cold_ids = { &az6027_usb_table[4], NULL }, + .cold_ids = { &az6027_usb_table[TECHNISAT_USB2_HDCI_V2], NULL }, .warm_ids = { NULL }, }, { .name = "Elgato EyeTV Sat", - .cold_ids = { &az6027_usb_table[5], NULL }, + .cold_ids = { &az6027_usb_table[ELGATO_EYETV_SAT], NULL }, .warm_ids = { NULL }, }, { .name = "Elgato EyeTV Sat", - .cold_ids = { &az6027_usb_table[6], NULL }, + .cold_ids = { &az6027_usb_table[ELGATO_EYETV_SAT_V2], NULL }, .warm_ids = { NULL }, }, { .name = "Elgato EyeTV Sat", - .cold_ids = { &az6027_usb_table[7], NULL }, + .cold_ids = { &az6027_usb_table[ELGATO_EYETV_SAT_V3], NULL }, .warm_ids = { NULL }, }, { NULL }, -- 2.35.1