Message ID | 20221121170911.7cd72bfc@endymion.delvare |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1687987wrr; Mon, 21 Nov 2022 08:21:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PVho9QYUnb22Zl9+OqjrakicxBq+3KkIwAxorYrRrjohGjgDHye+PfV1kgRthpE5tYajK X-Received: by 2002:a17:906:ee2:b0:78d:3f96:b7aa with SMTP id x2-20020a1709060ee200b0078d3f96b7aamr2692555eji.74.1669047700290; Mon, 21 Nov 2022 08:21:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669047700; cv=none; d=google.com; s=arc-20160816; b=ZyIN//vDfxsynwUMSvjCglGmOWasb6mzU6FxieiVlLcegIwqmQWSIdLusbNBEPhpDz zN7CKtffM3h7cbs79iJ6AQB+1+1jRCgipBLMkyfFKDR8R4Wl9/ZX2sBrPvJihMX3azvS jtFIkLF9WBowdE0IFr5KLPq54OkZQjAaGLv//lC1czs77+2zkw8wPdErHruOkhNsXqrV D0GF7KJNq9QuL7AY8W5dBZtrFZ6leoy9GHPmhNmULvzr5MUqSgW1xZM+CvTEVRQCGgvp SNGoGf+QaNH/YYwN0DK03hgs44A5VqjxrqEpn4lHXdcGL8C/xDpOsdLMKnUGfI/ETnol /XcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=KyfNmcPz42geDnL1EI62RbwuzIIJ0tLz64n6CtQSE5I=; b=mNdhyJY03pWuS5Xmr6e+AbmWbhLj0JPawJ3coUrxGlKHRJZRMy5cJJgD/Guj8t7TYk jZN10h1nFMoikhUkjGigH2UcW/APhvDvp5yUwslGggQzXAdLh2fPXvaFGO+O7RE9awNH sBrVtSEhvDcx1A2qDw33mMkA0bQdqzuYyWCH8LBWWxaoeUxEIaWd9w1bY4uspYrEnzCK WpucKqqYtFM3z+5xg/Pfa123B/XKPvV/AdImwhJ/kFASkLQGwl2gZfY4s15ux1wDrmUa 6zisZPponcHxRMkH59Wq9mKeHhjGcaxMr9EaH3ozq9epi1HhS5hAmwn0X88P0GPv3ttg Qt1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AxHbtyPn; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss28-20020a170907c01c00b00783d969f318si121734ejc.253.2022.11.21.08.21.16; Mon, 21 Nov 2022 08:21:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AxHbtyPn; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbiKUQJY (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 11:09:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbiKUQJR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 11:09:17 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291DCC72F0; Mon, 21 Nov 2022 08:09:16 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CE8B91F899; Mon, 21 Nov 2022 16:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669046954; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KyfNmcPz42geDnL1EI62RbwuzIIJ0tLz64n6CtQSE5I=; b=AxHbtyPn8fCOhgK03LCj+hsL1iGrhbOLg2ykdln3BBS3q2x7elr/R6Wkj8m8fCJB79AUQP TOo27oxKLH65LRjtrQ+L6EdBKjjw3ZmyOpQm4+8uuLj7DX6fpb/ELJR+mmOP/hLjP7zDe3 sAjsRdxOJVrHnS/UvbnGwyl80SfCkSo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669046954; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KyfNmcPz42geDnL1EI62RbwuzIIJ0tLz64n6CtQSE5I=; b=ko02FeoOF0N1Xxryj1kDA6bduoJiMktnvqb0DEqehmw5HBSDGM7KzAbEwQVMazZJ/tynFq BVT6DLS1yOOHlECw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8EBD21377F; Mon, 21 Nov 2022 16:09:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id y0E0Iaqie2N7VwAAMHmgww (envelope-from <jdelvare@suse.de>); Mon, 21 Nov 2022 16:09:14 +0000 Date: Mon, 21 Nov 2022 17:09:11 +0100 From: Jean Delvare <jdelvare@suse.de> To: Sean Young <sean@mess.org> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, Thierry Reding <thierry.reding@gmail.com>, "Uwe =?utf-8?q?Kleine-K=C3=B6nig?= " <u.kleine-koenig@pengutronix.de>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org Subject: [PATCH] media: rc: Drop obsolete dependencies on COMPILE_TEST Message-ID: <20221121170911.7cd72bfc@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750123361060837575?= X-GMAIL-MSGID: =?utf-8?q?1750123361060837575?= |
Series |
media: rc: Drop obsolete dependencies on COMPILE_TEST
|
|
Commit Message
Jean Delvare
Nov. 21, 2022, 4:09 p.m. UTC
Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it
is possible to test-build any driver which depends on OF on any
architecture by explicitly selecting OF. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.
It is actually better to always build such drivers with OF enabled,
so that the test builds are closer to how each driver will actually be
built on its intended target. Building them without OF may not test
much as the compiler will optimize out potentially large parts of the
code. In the worst case, this could even pop false positive warnings.
Dropping COMPILE_TEST here improves the quality of our testing and
avoids wasting time on non-existent issues.
As a minor optimization, this also lets us drop of_match_ptr(), as we
now know what it will resolve to, we might as well save cpp some work.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Sean Young <sean@mess.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
---
drivers/media/rc/Kconfig | 4 ++--
drivers/media/rc/pwm-ir-tx.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Mon, Nov 21, 2022 at 05:09:11PM +0100, Jean Delvare wrote: > Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it > is possible to test-build any driver which depends on OF on any > architecture by explicitly selecting OF. Therefore depending on > COMPILE_TEST as an alternative is no longer needed. > > It is actually better to always build such drivers with OF enabled, > so that the test builds are closer to how each driver will actually be > built on its intended target. Building them without OF may not test > much as the compiler will optimize out potentially large parts of the > code. In the worst case, this could even pop false positive warnings. > Dropping COMPILE_TEST here improves the quality of our testing and > avoids wasting time on non-existent issues. > > As a minor optimization, this also lets us drop of_match_ptr(), as we > now know what it will resolve to, we might as well save cpp some work. > > Signed-off-by: Jean Delvare <jdelvare@suse.de> > Cc: Sean Young <sean@mess.org> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org> > Cc: Thierry Reding <thierry.reding@gmail.com> > Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> > --- > drivers/media/rc/Kconfig | 4 ++-- > drivers/media/rc/pwm-ir-tx.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > --- linux-6.0.orig/drivers/media/rc/Kconfig > +++ linux-6.0/drivers/media/rc/Kconfig > @@ -314,7 +314,7 @@ config IR_PWM_TX > tristate "PWM IR transmitter" > depends on LIRC > depends on PWM > - depends on OF || COMPILE_TEST > + depends on OF > help > Say Y if you want to use a PWM based IR transmitter. This is > more power efficient than the bit banging gpio driver. > @@ -361,7 +361,7 @@ config IR_SERIAL_TRANSMITTER > config IR_SPI > tristate "SPI connected IR LED" > depends on SPI && LIRC > - depends on OF || COMPILE_TEST > + depends on OF > help > Say Y if you want to use an IR LED connected through SPI bus. > > --- linux-6.0.orig/drivers/media/rc/pwm-ir-tx.c > +++ linux-6.0/drivers/media/rc/pwm-ir-tx.c > @@ -120,7 +120,7 @@ static struct platform_driver pwm_ir_dri > .probe = pwm_ir_probe, > .driver = { > .name = DRIVER_NAME, > - .of_match_table = of_match_ptr(pwm_ir_of_match), > + .of_match_table = pwm_ir_of_match, > }, > }; > module_platform_driver(pwm_ir_driver); That hunk makes sense even without the Kconfig change. ACPI makes use of .of_match_table, so .of_match_table = of_match_ptr(pwm_ir_of_match), is (almost?) always wrong. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Best regards Uwe
Hallo Uwe, On Sun, 11 Dec 2022 21:56:48 +0100, Uwe Kleine-König wrote: > On Mon, Nov 21, 2022 at 05:09:11PM +0100, Jean Delvare wrote: > > --- linux-6.0.orig/drivers/media/rc/pwm-ir-tx.c > > +++ linux-6.0/drivers/media/rc/pwm-ir-tx.c > > @@ -120,7 +120,7 @@ static struct platform_driver pwm_ir_dri > > .probe = pwm_ir_probe, > > .driver = { > > .name = DRIVER_NAME, > > - .of_match_table = of_match_ptr(pwm_ir_of_match), > > + .of_match_table = pwm_ir_of_match, > > }, > > }; > > module_platform_driver(pwm_ir_driver); > > That hunk makes sense even without the Kconfig change. ACPI makes use of > .of_match_table, so > > .of_match_table = of_match_ptr(pwm_ir_of_match), > > is (almost?) always wrong. Should we just get rid of this macro altogether then? (Somehow I have a strange feeling that we already had this discussion...)
Hello, [expanded Cc: for the acpi topic] On Sun, Dec 11, 2022 at 11:14:35PM +0100, Jean Delvare wrote: > Hallo Uwe, > > On Sun, 11 Dec 2022 21:56:48 +0100, Uwe Kleine-König wrote: > > On Mon, Nov 21, 2022 at 05:09:11PM +0100, Jean Delvare wrote: > > > --- linux-6.0.orig/drivers/media/rc/pwm-ir-tx.c > > > +++ linux-6.0/drivers/media/rc/pwm-ir-tx.c > > > @@ -120,7 +120,7 @@ static struct platform_driver pwm_ir_dri > > > .probe = pwm_ir_probe, > > > .driver = { > > > .name = DRIVER_NAME, > > > - .of_match_table = of_match_ptr(pwm_ir_of_match), > > > + .of_match_table = pwm_ir_of_match, > > > }, > > > }; > > > module_platform_driver(pwm_ir_driver); > > > > That hunk makes sense even without the Kconfig change. ACPI makes use of > > .of_match_table, so > > > > .of_match_table = of_match_ptr(pwm_ir_of_match), > > > > is (almost?) always wrong. > > Should we just get rid of this macro altogether then? > > (Somehow I have a strange feeling that we already had this > discussion...) Might be. But for me this is only second hand knowledge, too. Maybe someone of the new recipents in this thread feels competent to comment here?! Best regards Uwe
On Mon, Dec 12, 2022 at 08:59:07AM +0100, Uwe Kleine-König wrote: > On Sun, Dec 11, 2022 at 11:14:35PM +0100, Jean Delvare wrote: > > On Sun, 11 Dec 2022 21:56:48 +0100, Uwe Kleine-König wrote: > > > On Mon, Nov 21, 2022 at 05:09:11PM +0100, Jean Delvare wrote: ... > > > > - .of_match_table = of_match_ptr(pwm_ir_of_match), > > > > + .of_match_table = pwm_ir_of_match, > > > That hunk makes sense even without the Kconfig change. ACPI makes use of > > > .of_match_table, so > > > > > > .of_match_table = of_match_ptr(pwm_ir_of_match), > > > > > > is (almost?) always wrong. > > > > Should we just get rid of this macro altogether then? > > > > (Somehow I have a strange feeling that we already had this > > discussion...) > > Might be. But for me this is only second hand knowledge, too. Maybe > someone of the new recipents in this thread feels competent to comment > here?! Pros of of_match_ptr() / ACPI_PTR(): - saves a few dozens of bytes in the module ID tables - doesn't show ACPI ID for non-ACPI platform or OF ID on non-OF platforms Cons: - prevents from using OF IDs on ACPI platforms - doesn't show ACPI ID for non-ACPI platform or OF ID on non-OF platforms - makes error prone for the compiler to have the variable unused - makes code uglier (I left the second in the both because I find useful to have all supported IDs to be listed even if the system is compiled with OF/ACPI opted-out.) Personally I remove the of_match_ptr()/ACPI_PTR() from drivers that can be used on OF or ACPI platforms, which leaves us only with the drivers we are 100% sure that they won't ever be used on non-OF platforms. BUT, I do not see any sense to have of_match_ptr() that either in use, because the driver in question is 100% for OF platform, or not when it's compile tested, which means it reduces test coverage anyway. All the same for ACPI_PTR(). TL;DR: I don't see any [big] usefulness of keeping those macros.
Hello, On Mon, Nov 21, 2022 at 05:09:11PM +0100, Jean Delvare wrote: > Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it > is possible to test-build any driver which depends on OF on any > architecture by explicitly selecting OF. Therefore depending on > COMPILE_TEST as an alternative is no longer needed. > > It is actually better to always build such drivers with OF enabled, > so that the test builds are closer to how each driver will actually be > built on its intended target. Building them without OF may not test > much as the compiler will optimize out potentially large parts of the > code. In the worst case, this could even pop false positive warnings. > Dropping COMPILE_TEST here improves the quality of our testing and > avoids wasting time on non-existent issues. > > As a minor optimization, this also lets us drop of_match_ptr(), as we > now know what it will resolve to, we might as well save cpp some work. > > Signed-off-by: Jean Delvare <jdelvare@suse.de> > Cc: Sean Young <sean@mess.org> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org> > Cc: Thierry Reding <thierry.reding@gmail.com> > Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> FTR: I discard this patch from the PWM patchwork as "handled elsewhere". Best regards Uwe
--- linux-6.0.orig/drivers/media/rc/Kconfig +++ linux-6.0/drivers/media/rc/Kconfig @@ -314,7 +314,7 @@ config IR_PWM_TX tristate "PWM IR transmitter" depends on LIRC depends on PWM - depends on OF || COMPILE_TEST + depends on OF help Say Y if you want to use a PWM based IR transmitter. This is more power efficient than the bit banging gpio driver. @@ -361,7 +361,7 @@ config IR_SERIAL_TRANSMITTER config IR_SPI tristate "SPI connected IR LED" depends on SPI && LIRC - depends on OF || COMPILE_TEST + depends on OF help Say Y if you want to use an IR LED connected through SPI bus. --- linux-6.0.orig/drivers/media/rc/pwm-ir-tx.c +++ linux-6.0/drivers/media/rc/pwm-ir-tx.c @@ -120,7 +120,7 @@ static struct platform_driver pwm_ir_dri .probe = pwm_ir_probe, .driver = { .name = DRIVER_NAME, - .of_match_table = of_match_ptr(pwm_ir_of_match), + .of_match_table = pwm_ir_of_match, }, }; module_platform_driver(pwm_ir_driver);