From patchwork Mon Mar 28 20:41:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 82100 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1nYwET-009vcW-RN; Mon, 28 Mar 2022 20:44:58 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345507AbiC1Uq2 (ORCPT + 1 other); Mon, 28 Mar 2022 16:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345672AbiC1Un1 (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 91BC3674C4; Mon, 28 Mar 2022 13:41:45 -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 1B6AEB81212; Mon, 28 Mar 2022 20:41:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99DCFC3410F; 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=bhjIYrP1LIUYHqVqwO9fRvylmwAunjFXsaJ23BiEGqA=; h=From:To:Cc:Subject:Date:From; b=GovG5HsDQ4D8az97d54Km7h5AMXTWG1jPG8BBqU4m7W8PKWIWQDaFv3KNilsJFu+w r6PT4f0ZHz1KMOwLZYHLXCFTezk981XP/jP4tpRP+lNSDedzrdVkNFWF8sLfFeCpWz yGcm+G7UnX4/Mmh+FSqycxBuc3HpVPO3S/UK5QX2SzH7oA2m52dJLAsOveXgJFFRpZ o0JOnOh1U2XjKNBI2HXO9ym/tr16EBpSnRA0fG8lcj1UUL8xDssF30NWcymiaYmmf6 t5rVUtXDpXdXSuzVNXzg/y+o0v7oYn1fS0UqHd3wwlx70A7y41aa54lyro8r09G4Ji ognzsVS/3DS4A== Received: from mchehab by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1nYwBH-000lbp-SV; Mon, 28 Mar 2022 22:41:39 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Michael Krufky , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 00/26] dvb-usb: use designated initializers Date: Mon, 28 Mar 2022 22:41:12 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-media@vger.kernel.org X-LSpam-Score: -2.8 (--) X-LSpam-Report: No, score=-2.8 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,MAILING_LIST_MULTI=-1,T_DKIM_INVALID=0.01 autolearn=unavailable autolearn_force=no There are two DVB USB cores on media. The new one (dvb-usb-v2) solves several problems with the previous one, but, unfortunately, there are several drivers that weren't migrated yet. One of the problems with dvb-usb is that, besides the common DVB USB table, it also uses a per-device table which require links to the USB ID table. This is done, on most drivers, using a magic number, which is easy to get outdated. Rewrite the drivers in order to use an enum and use designated initializers where needed. This patch series was inspired on this patch: https://patchwork.kernel.org/project/linux-media/patch/20220326165909.506926-16-benni@stuerz.xyz/ While it would be nice to also change the tables to be const, this is currently not possible, as a couple drivers that depend on the dvb-usb struct depend on it to not be const. Writing a patch series like that and making it properly referencing the right entries is not fun. That's most drivers were never fixed. So, I ended using a script to change it, adding several checks on it, in order to avoid the risk of problems. Even so, I needed to manually adjust some patches. This is the used script: Mauro Carvalho Chehab (26): media: dvb-usb-ids.h: sort entries media: dvb-usb: move USB IDs to dvb-usb-ids.h media: dvb-usb: vp702x: reference to usb ID table media: dvb-usb: Add helper macros for using USB VID/PID media: dvb-usb: a800: use an enum for the device number media: af9005: use the newer dvb-usb macros for USB device media: dvb-usb: az6027: use an enum for the device number media: cinergyT2-core: use the newer dvb-usb macros for USB device media: cxusb: use the newer dvb-usb macros for USB device media: digitv: use the newer dvb-usb macros for USB device media: dvb-usb: dtt200u: use an enum for the device number media: dtv5100: use the newer dvb-usb macros for USB device media: dw2102: use the newer dvb-usb macros for USB device media: dvb-usb: gp8psk: use an enum for the device number media: dvb-usb: m920x: use an enum for the device number media: dvb-usb: nova-t-usb2: use an enum for the device number media: dvb-usb: opera1: use an enum for the device number media: dvb-usb: pctv452e: use an enum for the device number media: technisat-usb2: use the newer dvb-usb macros for USB device media: dvb-usb: ttusb2: use an enum for the device number media: dvb-usb: umt-010: use an enum for the device number media: dvb-usb: vp702x: use an enum for the device number media: dvb-usb: vp7045: use an enum for the device number media: dvb-usb: dibusb-mb: use an enum for the device number media: dvb-usb: dibusb-mc: use an enum for the device number media: dvb-usb: dib0700_devices: use an enum for the device number drivers/media/usb/dvb-usb/a800.c | 18 +- drivers/media/usb/dvb-usb/af9005.c | 19 +- drivers/media/usb/dvb-usb/az6027.c | 45 +- drivers/media/usb/dvb-usb/cinergyT2-core.c | 10 +- drivers/media/usb/dvb-usb/cxusb.c | 88 +-- drivers/media/usb/dvb-usb/dib0700_devices.c | 428 +++++++------ drivers/media/usb/dvb-usb/dibusb-mb.c | 165 ++--- drivers/media/usb/dvb-usb/dibusb-mc.c | 88 +-- drivers/media/usb/dvb-usb/digitv.c | 13 +- drivers/media/usb/dvb-usb/dtt200u.c | 56 +- drivers/media/usb/dvb-usb/dtv5100.c | 11 +- drivers/media/usb/dvb-usb/dw2102.c | 84 ++- drivers/media/usb/dvb-usb/gp8psk.c | 36 +- drivers/media/usb/dvb-usb/m920x.c | 51 +- drivers/media/usb/dvb-usb/nova-t-usb2.c | 18 +- drivers/media/usb/dvb-usb/opera1.c | 15 +- drivers/media/usb/dvb-usb/pctv452e.c | 22 +- drivers/media/usb/dvb-usb/technisat-usb2.c | 11 +- drivers/media/usb/dvb-usb/ttusb2.c | 36 +- drivers/media/usb/dvb-usb/umt-010.c | 18 +- drivers/media/usb/dvb-usb/vp702x.c | 23 +- drivers/media/usb/dvb-usb/vp7045.c | 28 +- include/media/dvb-usb-ids.h | 632 +++++++++++--------- 23 files changed, 1071 insertions(+), 844 deletions(-)