Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5613515pxb; Mon, 28 Mar 2022 14:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnEVu8YFgUoH7/eI4dBlhrT6GLQMCe/mBz/fD7v0gjV3nAQY0xVASyMTbzjy5AvFYIZuo6 X-Received: by 2002:a05:6122:1681:b0:340:45fd:5b16 with SMTP id 1-20020a056122168100b0034045fd5b16mr9866152vkl.3.1648504775212; Mon, 28 Mar 2022 14:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648504775; cv=none; d=google.com; s=arc-20160816; b=oT43HPyt4l1qg6rYdLIEYa6KKyZJ4tPA5xdsbY/cIH3Us7BQxl6Y1yLyzkyby8nvhD R7skpX3xsQI/H470x6I4iFrlp0xF+0/bX1sbMiTZ9GDnaVwFVKyz54Q+37frN0pIVwGj 3081JM2VNf1AQiy2UUkQw6RWZygGEazmSSk5n8puQBA/BDCiEbhv8PEYVibyf0e0c3/v nAgjQUu/6rSdqJUk0xGTxZrSbDQlFE/pp90zahm8kGcIGHEA9COHNnwxm436/yLcIqjK MKrm0jRc8qNsnHF9w7I5aVMyt80BxiJtFpfneror7UlR+LW2YdhwLdpWYiZpAWa7xAwp wuXw== 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=i6lhE/CKZgi/n0Il6zaakFtlL/0lp0GAr7Iosd2qvqI=; b=HAB5XuCGTf/u3CMCJ+IDNZx4exNvK0HxvZ0/RxpmIHr3IMGQTcmQ+X6GCZ0Rekh6ft +IVugImC2gIRXHx5QBnNGS3blSE52I3NmxAj11aaWe3Vfn2nqmLL+bLC2Aayn8KPDeXi 9fzxUwePHgyXXMNJHtnAfBrf9qOmFaA2e1hClO1hjDCkC6CqmSqfWOsuX3QpN4v6LnhW +CFRLpuWKlVH9uCbBLbKn/jJ7IjWz/9cGCZJYVtCV2yMKJZdju4zvhA82/1AjTEGATp1 YxPs2ZIgmwxUlIpRRISz+4e1o9CAdEKXQ8yQkPKvJka9Y4ynNhnhRCMfMXT0T7c4PkQj 0yAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=IdKqAdDM; 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 t22-20020a67d916000000b00324c5c3becdsi3289614vsj.271.2022.03.28.14.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:59:35 -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=IdKqAdDM; 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 E1A9769296; Mon, 28 Mar 2022 14:25:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346019AbiC1UsD (ORCPT + 99 others); Mon, 28 Mar 2022 16:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345704AbiC1Un3 (ORCPT ); Mon, 28 Mar 2022 16:43:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9644E66AD2; Mon, 28 Mar 2022 13:41:47 -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 4DABFB8121B; Mon, 28 Mar 2022 20:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED94BC3411E; 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=1648500103; bh=gaJVK9j4dgU7VRPy0o42lYJiLsQkio1yHZPgSpFfnQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IdKqAdDMeOXOpA7KnlrMUExtyq/yYs1qxXPd0UqRXFe8siG/CMeDqoeWQGtvBa3mE N4eWw1YE4pSKrw48mQkiLP86C2qiZ3vD7lWoNnRCbzNn9sdmXDRn9Npd3FvdqaNb2M TL3zkMytfldedhzuAH2aWLsyDasAWACcgF2hkk3fSoSssKxzNjb+8+XW0im5tdcGFq TA74tdL0I4uD+8zxKuPe08lSATZAI453dsaXK5V2vrnSRcF/eolzADB70X0jBrYLag yY0yLdvbLU3h562rbYqW9RmtaES6cMAX8Iafy3WtbEEwmzIk+/zERkdeqHXiNRp760 cgJvezqSriiqg== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1nYwBI-000lci-IJ; 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 14/26] media: dvb-usb: gp8psk: use an enum for the device number Date: Mon, 28 Mar 2022 22:41:26 +0200 Message-Id: <0d32148747df677f0c930605389c12b190c09bdf.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/gp8psk.c | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c index b4f661bb5648..b2b27a86dfe5 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.c +++ b/drivers/media/usb/dvb-usb/gp8psk.c @@ -310,15 +310,25 @@ static int gp8psk_usb_probe(struct usb_interface *intf, return ret; } -static struct usb_device_id gp8psk_usb_table [] = { - { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_COLD) }, - { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_WARM) }, - { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_2) }, - { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_1) }, - { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_2) }, -/* { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_CW3K) }, */ - { 0 }, +enum { + GENPIX_8PSK_REV_1_COLD, + GENPIX_8PSK_REV_1_WARM, + GENPIX_8PSK_REV_2, + GENPIX_SKYWALKER_1, + GENPIX_SKYWALKER_2, + GENPIX_SKYWALKER_CW3K, }; + +static struct usb_device_id gp8psk_usb_table[] = { + DVB_USB_DEV(GENPIX, GENPIX_8PSK_REV_1_COLD), + DVB_USB_DEV(GENPIX, GENPIX_8PSK_REV_1_WARM), + DVB_USB_DEV(GENPIX, GENPIX_8PSK_REV_2), + DVB_USB_DEV(GENPIX, GENPIX_SKYWALKER_1), + DVB_USB_DEV(GENPIX, GENPIX_SKYWALKER_2), + DVB_USB_DEV(GENPIX, GENPIX_SKYWALKER_CW3K), + { } +}; + MODULE_DEVICE_TABLE(usb, gp8psk_usb_table); static struct dvb_usb_device_properties gp8psk_properties = { @@ -355,20 +365,20 @@ static struct dvb_usb_device_properties gp8psk_properties = { .num_device_descs = 4, .devices = { { .name = "Genpix 8PSK-to-USB2 Rev.1 DVB-S receiver", - .cold_ids = { &gp8psk_usb_table[0], NULL }, - .warm_ids = { &gp8psk_usb_table[1], NULL }, + .cold_ids = { &gp8psk_usb_table[GENPIX_8PSK_REV_1_COLD], NULL }, + .warm_ids = { &gp8psk_usb_table[GENPIX_8PSK_REV_1_WARM], NULL }, }, { .name = "Genpix 8PSK-to-USB2 Rev.2 DVB-S receiver", .cold_ids = { NULL }, - .warm_ids = { &gp8psk_usb_table[2], NULL }, + .warm_ids = { &gp8psk_usb_table[GENPIX_8PSK_REV_2], NULL }, }, { .name = "Genpix SkyWalker-1 DVB-S receiver", .cold_ids = { NULL }, - .warm_ids = { &gp8psk_usb_table[3], NULL }, + .warm_ids = { &gp8psk_usb_table[GENPIX_SKYWALKER_1], NULL }, }, { .name = "Genpix SkyWalker-2 DVB-S receiver", .cold_ids = { NULL }, - .warm_ids = { &gp8psk_usb_table[4], NULL }, + .warm_ids = { &gp8psk_usb_table[GENPIX_SKYWALKER_2], NULL }, }, { NULL }, } -- 2.35.1