From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B13EFC4332F for ; Mon, 17 Jan 2022 09:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235632AbiAQJZq (ORCPT ); Mon, 17 Jan 2022 04:25:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235622AbiAQJZp (ORCPT ); Mon, 17 Jan 2022 04:25:45 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80114C061574 for ; Mon, 17 Jan 2022 01:25:45 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9OFv-0006KR-Ei; Mon, 17 Jan 2022 10:24:51 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9OFp-00AnDX-Gd; Mon, 17 Jan 2022 10:24:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n9OFo-0002fs-6r; Mon, 17 Jan 2022 10:24:44 +0100 Date: Mon, 17 Jan 2022 10:24:44 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven Cc: Sergey Shtylyov , Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , KVM list , "Rafael J. Wysocki" , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , ALSA Development Mailing List , Jaroslav Kysela , Guenter Roeck , Thierry Reding , MTD Maling List , Linux I2C , "open list:GPIO SUBSYSTEM" , Miquel Raynal , linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-spi , Jiri Slaby , Khuong Dinh , Florian Fainelli , Matthias Schiffer , Kamal Dasu , Lee Jones , Bartosz Golaszewski , Daniel Lezcano , Kishon Vijay Abraham I , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Jakub Kicinski , Zhang Rui , platform-driver-x86@vger.kernel.org, Linux PWM List , Robert Richter , Saravanan Sekar , Corey Minyard , Linux PM list , Liam Girdwood , Mauro Carvalho Chehab , John Garry , Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , Borislav Petkov , Takashi Iwai , Matthias Brugger , openipmi-developer@lists.sourceforge.net, Andy Shevchenko , Benson Leung , Pengutronix Kernel Team , Linux ARM , linux-edac@vger.kernel.org, Tony Luck , Richard Weinberger , Mun Yew Tham , Eric Auger , Greg Kroah-Hartman , Yoshihiro Shimoda , Cornelia Huck , Linux MMC List , Joakim Zhang , Linux Kernel Mailing List , Linux-Renesas , Vinod Koul , James Morse , Zha Qipeng , Sebastian Reichel , Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: <20220117092444.opoedfcf5k5u6otq@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <29f0c65d-77f2-e5b2-f6cc-422add8a707d@omp.ru> <20220114092557.jrkfx7ihg26ekzci@pengutronix.de> <61b80939-357d-14f5-df99-b8d102a4e1a1@omp.ru> <20220114202226.ugzklxv4wzr6egwj@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycu5k3o6g2lyq6o4" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-gpio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org --ycu5k3o6g2lyq6o4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Geert, On Mon, Jan 17, 2022 at 09:41:42AM +0100, Geert Uytterhoeven wrote: > On Sat, Jan 15, 2022 at 9:22 PM Sergey Shtylyov wrote: > > On 1/14/22 11:22 PM, Uwe Kleine-K=F6nig wrote: > > > You have to understand that for clk (and regulator and gpiod) NULL is= a > > > valid descriptor that can actually be used, it just has no effect. So > > > this is a convenience value for the case "If the clk/regulator/gpiod = in > > > question isn't available, there is nothing to do". This is what makes > > > clk_get_optional() and the others really useful and justifies their > > > existence. This doesn't apply to platform_get_irq_optional(). > > > > I do understand that. However, IRQs are a different beast with their > > own justifications... >=20 > > > clk_get_optional() is sane and sensible for cases where the clk might= be > > > absent and it helps you because you don't have to differentiate betwe= en > > > "not found" and "there is an actual resource". > > > > > > The reason for platform_get_irq_optional()'s existence is just that > > > platform_get_irq() emits an error message which is wrong or suboptimal > > > > I think you are very wrong here. The real reason is to simplify the > > callers. >=20 > Indeed. The commit that introduced platform_get_irq_optional() said: Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt. So the author of 8973ea47901c81a1912bd05f1577bed9b5b52506 failed to mention the real reason? Or look at 31a8d8fa84c51d3ab00bf059158d5de6178cf890: [...] use platform_get_irq_optional() to get second/third IRQ which are optional to avoid below error message during probe: [...] Look through the output of git log -Splatform_get_irq_optional to find several more of these. Also I fail to see how a caller of (today's) platform_get_irq_optional() is simpler than a caller of platform_get_irq() given that there is no semantic difference between the two. Please show me a single conversion from platform_get_irq to platform_get_irq_optional that yielded a simplification. So you need some more effort to convince me of your POV. > Even for clocks, you cannot assume that you can always blindly use > the returned dummy (actually a NULL pointer) to call into the clk > API. While this works fine for simple use cases, where you just > want to enable/disable an optional clock (clk_prepare_enable() and > clk_disable_unprepare()), it does not work for more complex use cases. Agreed. But for clks and gpiods and regulators the simple case is quite usual. For irqs it isn't. And if you cannot blindly use the dummy, then you're not the targetted caller of *_get_optional() and should better use *_get() and handle -ENODEV explicitly. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycu5k3o6g2lyq6o4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHlNdMACgkQwfwUeK3K 7AkbyQf/dzwfw39nzRfi8yss0CiqoAU/yS+7MsnZvnWGKQxcIojgK1OX/xdxiMKI C4HnYtImt4dRHJdZDTL5+BWmwrkKo3ytJl8YRHBffgzQdKfAXOit1Pce623dbYvd wKJedLR6H9VXuTa1ULEvTnC0cXupHaoxjvQbKkUhlz/PahrhX91+dNJcoWTB6eB2 YSb6MMcqwMFJ6y2P4pDKDoCf0RNjt8EzTKMWUdx1zcCrqT+wDzA0Ub0UvM7EpUXn ziLd4JEC+3SxJZvr2Y8jPQUGb4RMr+Z20vfEOG154m+zZ5lZe7Pcp1ggo6wb+fZ9 qM6JVYjExAvA43UcTTna2uSeE/+nfA== =gHVT -----END PGP SIGNATURE----- --ycu5k3o6g2lyq6o4-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4CE3C433EF for ; Mon, 17 Jan 2022 09:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FWpBWVdRWAsBUpIqVDrgI227bewV5+WHAd3DTm4kVhw=; b=cLc/BBEl53y5N6IkR7BMwMusSd tEV8Hon4BjU+8h9/z6Ky0dcREf38ciYjsCSGgXMgY5i6+UE5kJr5pX8ywmR4ZLBddjEvYPMduQNRL ONik0ER/Q79qp+/l8PQwj9EN92qvrJaJ6Ah0wvcewih9ICD1Swlm7hoXe1rN1kjoT4P3eCMOPFBs6 VN/30ADDzo9LnYqdFmUOTpYDO9zFRfH2NOGBbn7WDXCrIb8SjvWwgYyrHNV5mVDpqgMRNVMbEHY+N hA6SdvQS6wbtK+islY+4+S4fjka91mEw5KpCVGmD39egYhxqhNo7YdWR3TUmpY36/mSSKgTwb1nyU QdraA1/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHY-00EFdA-6l; Mon, 17 Jan 2022 09:26:32 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHH-00EFZu-Ov for linux-phy@lists.infradead.org; Mon, 17 Jan 2022 09:26:17 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9OFv-0006KR-Ei; Mon, 17 Jan 2022 10:24:51 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9OFp-00AnDX-Gd; Mon, 17 Jan 2022 10:24:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n9OFo-0002fs-6r; Mon, 17 Jan 2022 10:24:44 +0100 Date: Mon, 17 Jan 2022 10:24:44 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven Cc: Sergey Shtylyov , Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , KVM list , "Rafael J. Wysocki" , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , ALSA Development Mailing List , Jaroslav Kysela , Guenter Roeck , Thierry Reding , MTD Maling List , Linux I2C , "open list:GPIO SUBSYSTEM" , Miquel Raynal , linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-spi , Jiri Slaby , Khuong Dinh , Florian Fainelli , Matthias Schiffer , Kamal Dasu , Lee Jones , Bartosz Golaszewski , Daniel Lezcano , Kishon Vijay Abraham I , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Jakub Kicinski , Zhang Rui , platform-driver-x86@vger.kernel.org, Linux PWM List , Robert Richter , Saravanan Sekar , Corey Minyard , Linux PM list , Liam Girdwood , Mauro Carvalho Chehab , John Garry , Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , Borislav Petkov , Takashi Iwai , Matthias Brugger , openipmi-developer@lists.sourceforge.net, Andy Shevchenko , Benson Leung , Pengutronix Kernel Team , Linux ARM , linux-edac@vger.kernel.org, Tony Luck , Richard Weinberger , Mun Yew Tham , Eric Auger , Greg Kroah-Hartman , Yoshihiro Shimoda , Cornelia Huck , Linux MMC List , Joakim Zhang , Linux Kernel Mailing List , Linux-Renesas , Vinod Koul , James Morse , Zha Qipeng , Sebastian Reichel , Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: <20220117092444.opoedfcf5k5u6otq@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <29f0c65d-77f2-e5b2-f6cc-422add8a707d@omp.ru> <20220114092557.jrkfx7ihg26ekzci@pengutronix.de> <61b80939-357d-14f5-df99-b8d102a4e1a1@omp.ru> <20220114202226.ugzklxv4wzr6egwj@pengutronix.de> MIME-Version: 1.0 In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-phy@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_012615_992233_703E99A9 X-CRM114-Status: GOOD ( 38.64 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6006808642659847795==" Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org --===============6006808642659847795== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycu5k3o6g2lyq6o4" Content-Disposition: inline --ycu5k3o6g2lyq6o4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Geert, On Mon, Jan 17, 2022 at 09:41:42AM +0100, Geert Uytterhoeven wrote: > On Sat, Jan 15, 2022 at 9:22 PM Sergey Shtylyov wrote: > > On 1/14/22 11:22 PM, Uwe Kleine-K=F6nig wrote: > > > You have to understand that for clk (and regulator and gpiod) NULL is= a > > > valid descriptor that can actually be used, it just has no effect. So > > > this is a convenience value for the case "If the clk/regulator/gpiod = in > > > question isn't available, there is nothing to do". This is what makes > > > clk_get_optional() and the others really useful and justifies their > > > existence. This doesn't apply to platform_get_irq_optional(). > > > > I do understand that. However, IRQs are a different beast with their > > own justifications... >=20 > > > clk_get_optional() is sane and sensible for cases where the clk might= be > > > absent and it helps you because you don't have to differentiate betwe= en > > > "not found" and "there is an actual resource". > > > > > > The reason for platform_get_irq_optional()'s existence is just that > > > platform_get_irq() emits an error message which is wrong or suboptimal > > > > I think you are very wrong here. The real reason is to simplify the > > callers. >=20 > Indeed. The commit that introduced platform_get_irq_optional() said: Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt. So the author of 8973ea47901c81a1912bd05f1577bed9b5b52506 failed to mention the real reason? Or look at 31a8d8fa84c51d3ab00bf059158d5de6178cf890: [...] use platform_get_irq_optional() to get second/third IRQ which are optional to avoid below error message during probe: [...] Look through the output of git log -Splatform_get_irq_optional to find several more of these. Also I fail to see how a caller of (today's) platform_get_irq_optional() is simpler than a caller of platform_get_irq() given that there is no semantic difference between the two. Please show me a single conversion from platform_get_irq to platform_get_irq_optional that yielded a simplification. So you need some more effort to convince me of your POV. > Even for clocks, you cannot assume that you can always blindly use > the returned dummy (actually a NULL pointer) to call into the clk > API. While this works fine for simple use cases, where you just > want to enable/disable an optional clock (clk_prepare_enable() and > clk_disable_unprepare()), it does not work for more complex use cases. Agreed. But for clks and gpiods and regulators the simple case is quite usual. For irqs it isn't. And if you cannot blindly use the dummy, then you're not the targetted caller of *_get_optional() and should better use *_get() and handle -ENODEV explicitly. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycu5k3o6g2lyq6o4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHlNdMACgkQwfwUeK3K 7AkbyQf/dzwfw39nzRfi8yss0CiqoAU/yS+7MsnZvnWGKQxcIojgK1OX/xdxiMKI C4HnYtImt4dRHJdZDTL5+BWmwrkKo3ytJl8YRHBffgzQdKfAXOit1Pce623dbYvd wKJedLR6H9VXuTa1ULEvTnC0cXupHaoxjvQbKkUhlz/PahrhX91+dNJcoWTB6eB2 YSb6MMcqwMFJ6y2P4pDKDoCf0RNjt8EzTKMWUdx1zcCrqT+wDzA0Ub0UvM7EpUXn ziLd4JEC+3SxJZvr2Y8jPQUGb4RMr+Z20vfEOG154m+zZ5lZe7Pcp1ggo6wb+fZ9 qM6JVYjExAvA43UcTTna2uSeE/+nfA== =gHVT -----END PGP SIGNATURE----- --ycu5k3o6g2lyq6o4-- --===============6006808642659847795== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy --===============6006808642659847795==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CEBBC433EF for ; Mon, 17 Jan 2022 09:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MkjXp0QL/+bqWY2wUhAdPgRq8KDJ0/QtZMekNuAuoz4=; b=wIjJNPvkamkEC+DmC5fKgfX63l ItbWkBFBtwD1jUpBdnkqAmqyXT6bZv4wOWyE9V1ER0JQ8R1Oa0muOe9zh7+vgK8J2fbRr2mKZUHaP RxYiSoSe5hG6PxauBqmXAClZmMVVNzWmZCKsSPqwJvo5etF09HIlzHTXXj6yqggFT7gMqy/lX1Jc2 kVYuyccPgAUogb0B7jYjeQycpMTsaoYcJS6DOWvQE3UfgKP8n5aq9XECidNcLqtZ6oyZLlKRL9Whd AgEObuFAz+gk65m14kulytxMHUNqogqTmaX28jH27VfgcLfRNi6J71ZWDFQmPGKWU65PgMgQTLDt5 uMZ/OpiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHL-00EFbG-Hi; Mon, 17 Jan 2022 09:26:19 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHH-00EFZt-Ow for linux-mtd@lists.infradead.org; Mon, 17 Jan 2022 09:26:17 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9OFv-0006KR-Ei; Mon, 17 Jan 2022 10:24:51 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9OFp-00AnDX-Gd; Mon, 17 Jan 2022 10:24:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n9OFo-0002fs-6r; Mon, 17 Jan 2022 10:24:44 +0100 Date: Mon, 17 Jan 2022 10:24:44 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven Cc: Sergey Shtylyov , Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , KVM list , "Rafael J. Wysocki" , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , ALSA Development Mailing List , Jaroslav Kysela , Guenter Roeck , Thierry Reding , MTD Maling List , Linux I2C , "open list:GPIO SUBSYSTEM" , Miquel Raynal , linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-spi , Jiri Slaby , Khuong Dinh , Florian Fainelli , Matthias Schiffer , Kamal Dasu , Lee Jones , Bartosz Golaszewski , Daniel Lezcano , Kishon Vijay Abraham I , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Jakub Kicinski , Zhang Rui , platform-driver-x86@vger.kernel.org, Linux PWM List , Robert Richter , Saravanan Sekar , Corey Minyard , Linux PM list , Liam Girdwood , Mauro Carvalho Chehab , John Garry , Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , Borislav Petkov , Takashi Iwai , Matthias Brugger , openipmi-developer@lists.sourceforge.net, Andy Shevchenko , Benson Leung , Pengutronix Kernel Team , Linux ARM , linux-edac@vger.kernel.org, Tony Luck , Richard Weinberger , Mun Yew Tham , Eric Auger , Greg Kroah-Hartman , Yoshihiro Shimoda , Cornelia Huck , Linux MMC List , Joakim Zhang , Linux Kernel Mailing List , Linux-Renesas , Vinod Koul , James Morse , Zha Qipeng , Sebastian Reichel , Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: <20220117092444.opoedfcf5k5u6otq@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <29f0c65d-77f2-e5b2-f6cc-422add8a707d@omp.ru> <20220114092557.jrkfx7ihg26ekzci@pengutronix.de> <61b80939-357d-14f5-df99-b8d102a4e1a1@omp.ru> <20220114202226.ugzklxv4wzr6egwj@pengutronix.de> MIME-Version: 1.0 In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_012615_987609_06DD0B90 X-CRM114-Status: GOOD ( 38.92 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2813832460092254318==" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org --===============2813832460092254318== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycu5k3o6g2lyq6o4" Content-Disposition: inline --ycu5k3o6g2lyq6o4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Geert, On Mon, Jan 17, 2022 at 09:41:42AM +0100, Geert Uytterhoeven wrote: > On Sat, Jan 15, 2022 at 9:22 PM Sergey Shtylyov wrote: > > On 1/14/22 11:22 PM, Uwe Kleine-K=F6nig wrote: > > > You have to understand that for clk (and regulator and gpiod) NULL is= a > > > valid descriptor that can actually be used, it just has no effect. So > > > this is a convenience value for the case "If the clk/regulator/gpiod = in > > > question isn't available, there is nothing to do". This is what makes > > > clk_get_optional() and the others really useful and justifies their > > > existence. This doesn't apply to platform_get_irq_optional(). > > > > I do understand that. However, IRQs are a different beast with their > > own justifications... >=20 > > > clk_get_optional() is sane and sensible for cases where the clk might= be > > > absent and it helps you because you don't have to differentiate betwe= en > > > "not found" and "there is an actual resource". > > > > > > The reason for platform_get_irq_optional()'s existence is just that > > > platform_get_irq() emits an error message which is wrong or suboptimal > > > > I think you are very wrong here. The real reason is to simplify the > > callers. >=20 > Indeed. The commit that introduced platform_get_irq_optional() said: Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt. So the author of 8973ea47901c81a1912bd05f1577bed9b5b52506 failed to mention the real reason? Or look at 31a8d8fa84c51d3ab00bf059158d5de6178cf890: [...] use platform_get_irq_optional() to get second/third IRQ which are optional to avoid below error message during probe: [...] Look through the output of git log -Splatform_get_irq_optional to find several more of these. Also I fail to see how a caller of (today's) platform_get_irq_optional() is simpler than a caller of platform_get_irq() given that there is no semantic difference between the two. Please show me a single conversion from platform_get_irq to platform_get_irq_optional that yielded a simplification. So you need some more effort to convince me of your POV. > Even for clocks, you cannot assume that you can always blindly use > the returned dummy (actually a NULL pointer) to call into the clk > API. While this works fine for simple use cases, where you just > want to enable/disable an optional clock (clk_prepare_enable() and > clk_disable_unprepare()), it does not work for more complex use cases. Agreed. But for clks and gpiods and regulators the simple case is quite usual. For irqs it isn't. And if you cannot blindly use the dummy, then you're not the targetted caller of *_get_optional() and should better use *_get() and handle -ENODEV explicitly. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycu5k3o6g2lyq6o4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHlNdMACgkQwfwUeK3K 7AkbyQf/dzwfw39nzRfi8yss0CiqoAU/yS+7MsnZvnWGKQxcIojgK1OX/xdxiMKI C4HnYtImt4dRHJdZDTL5+BWmwrkKo3ytJl8YRHBffgzQdKfAXOit1Pce623dbYvd wKJedLR6H9VXuTa1ULEvTnC0cXupHaoxjvQbKkUhlz/PahrhX91+dNJcoWTB6eB2 YSb6MMcqwMFJ6y2P4pDKDoCf0RNjt8EzTKMWUdx1zcCrqT+wDzA0Ub0UvM7EpUXn ziLd4JEC+3SxJZvr2Y8jPQUGb4RMr+Z20vfEOG154m+zZ5lZe7Pcp1ggo6wb+fZ9 qM6JVYjExAvA43UcTTna2uSeE/+nfA== =gHVT -----END PGP SIGNATURE----- --ycu5k3o6g2lyq6o4-- --===============2813832460092254318== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ --===============2813832460092254318==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36AC4C433EF for ; Mon, 17 Jan 2022 09:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4tCHeh+5q3Ns87Qsn7A8w8nPz59GrjbIQFcbrSmOFMU=; b=BqqVaaRxNehWTJyRuFd2eZDm5F 14eiHJyMVoMDuOar4L+n50Kq2ZzSe5RjC9QvKmhbf9Fe49zJas9F9YZE71HGCGflo+Kzgku8iB7K/ zMP1tKh5Lx5CVdEQfjM7GhPPX6WCUbpbMkbKWJcLMlaswjo82jRm5GJlzVrl3awunyk4uXcaC1e1f 0UV+s36PH0b4IkTazvfA49VCgc5euC+d/4ngh9n0bYNsJ0UAVF7wvI85GGNCXJ3auFia0P/ec6vM8 8moe2jhX9RNJ/s4406x8glyczVfrmE7xl0BrAiINgiaMbR8r63r48dyTx96MEVsCdgoqIR19BnOXQ avw8ZKlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHZ-00EFdd-Dy; Mon, 17 Jan 2022 09:26:33 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9OHK-00EFal-Od for linux-mediatek@lists.infradead.org; Mon, 17 Jan 2022 09:26:20 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9OFv-0006KR-Ei; Mon, 17 Jan 2022 10:24:51 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9OFp-00AnDX-Gd; Mon, 17 Jan 2022 10:24:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n9OFo-0002fs-6r; Mon, 17 Jan 2022 10:24:44 +0100 Date: Mon, 17 Jan 2022 10:24:44 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven Cc: Sergey Shtylyov , Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , KVM list , "Rafael J. Wysocki" , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , ALSA Development Mailing List , Jaroslav Kysela , Guenter Roeck , Thierry Reding , MTD Maling List , Linux I2C , "open list:GPIO SUBSYSTEM" , Miquel Raynal , linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-spi , Jiri Slaby , Khuong Dinh , Florian Fainelli , Matthias Schiffer , Kamal Dasu , Lee Jones , Bartosz Golaszewski , Daniel Lezcano , Kishon Vijay Abraham I , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Jakub Kicinski , Zhang Rui , platform-driver-x86@vger.kernel.org, Linux PWM List , Robert Richter , Saravanan Sekar , Corey Minyard , Linux PM list , Liam Girdwood , Mauro Carvalho Chehab , John Garry , Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , Borislav Petkov , Takashi Iwai , Matthias Brugger , openipmi-developer@lists.sourceforge.net, Andy Shevchenko , Benson Leung , Pengutronix Kernel Team , Linux ARM , linux-edac@vger.kernel.org, Tony Luck , Richard Weinberger , Mun Yew Tham , Eric Auger , Greg Kroah-Hartman , Yoshihiro Shimoda , Cornelia Huck , Linux MMC List , Joakim Zhang , Linux Kernel Mailing List , Linux-Renesas , Vinod Koul , James Morse , Zha Qipeng , Sebastian Reichel , Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: <20220117092444.opoedfcf5k5u6otq@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <29f0c65d-77f2-e5b2-f6cc-422add8a707d@omp.ru> <20220114092557.jrkfx7ihg26ekzci@pengutronix.de> <61b80939-357d-14f5-df99-b8d102a4e1a1@omp.ru> <20220114202226.ugzklxv4wzr6egwj@pengutronix.de> MIME-Version: 1.0 In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_012618_976104_83F7C7A9 X-CRM114-Status: GOOD ( 38.74 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============3368068791667728644==" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org --===============3368068791667728644== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycu5k3o6g2lyq6o4" Content-Disposition: inline --ycu5k3o6g2lyq6o4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Geert, On Mon, Jan 17, 2022 at 09:41:42AM +0100, Geert Uytterhoeven wrote: > On Sat, Jan 15, 2022 at 9:22 PM Sergey Shtylyov wrote: > > On 1/14/22 11:22 PM, Uwe Kleine-K=F6nig wrote: > > > You have to understand that for clk (and regulator and gpiod) NULL is= a > > > valid descriptor that can actually be used, it just has no effect. So > > > this is a convenience value for the case "If the clk/regulator/gpiod = in > > > question isn't available, there is nothing to do". This is what makes > > > clk_get_optional() and the others really useful and justifies their > > > existence. This doesn't apply to platform_get_irq_optional(). > > > > I do understand that. However, IRQs are a different beast with their > > own justifications... >=20 > > > clk_get_optional() is sane and sensible for cases where the clk might= be > > > absent and it helps you because you don't have to differentiate betwe= en > > > "not found" and "there is an actual resource". > > > > > > The reason for platform_get_irq_optional()'s existence is just that > > > platform_get_irq() emits an error message which is wrong or suboptimal > > > > I think you are very wrong here. The real reason is to simplify the > > callers. >=20 > Indeed. The commit that introduced platform_get_irq_optional() said: Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt. So the author of 8973ea47901c81a1912bd05f1577bed9b5b52506 failed to mention the real reason? Or look at 31a8d8fa84c51d3ab00bf059158d5de6178cf890: [...] use platform_get_irq_optional() to get second/third IRQ which are optional to avoid below error message during probe: [...] Look through the output of git log -Splatform_get_irq_optional to find several more of these. Also I fail to see how a caller of (today's) platform_get_irq_optional() is simpler than a caller of platform_get_irq() given that there is no semantic difference between the two. Please show me a single conversion from platform_get_irq to platform_get_irq_optional that yielded a simplification. So you need some more effort to convince me of your POV. > Even for clocks, you cannot assume that you can always blindly use > the returned dummy (actually a NULL pointer) to call into the clk > API. While this works fine for simple use cases, where you just > want to enable/disable an optional clock (clk_prepare_enable() and > clk_disable_unprepare()), it does not work for more complex use cases. Agreed. But for clks and gpiods and regulators the simple case is quite usual. For irqs it isn't. And if you cannot blindly use the dummy, then you're not the targetted caller of *_get_optional() and should better use *_get() and handle -ENODEV explicitly. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycu5k3o6g2lyq6o4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHlNdMACgkQwfwUeK3K 7AkbyQf/dzwfw39nzRfi8yss0CiqoAU/yS+7MsnZvnWGKQxcIojgK1OX/xdxiMKI C4HnYtImt4dRHJdZDTL5+BWmwrkKo3ytJl8YRHBffgzQdKfAXOit1Pce623dbYvd wKJedLR6H9VXuTa1ULEvTnC0cXupHaoxjvQbKkUhlz/PahrhX91+dNJcoWTB6eB2 YSb6MMcqwMFJ6y2P4pDKDoCf0RNjt8EzTKMWUdx1zcCrqT+wDzA0Ub0UvM7EpUXn ziLd4JEC+3SxJZvr2Y8jPQUGb4RMr+Z20vfEOG154m+zZ5lZe7Pcp1ggo6wb+fZ9 qM6JVYjExAvA43UcTTna2uSeE/+nfA== =gHVT -----END PGP SIGNATURE----- --ycu5k3o6g2lyq6o4-- --===============3368068791667728644== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek --===============3368068791667728644==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBA27C433F5 for ; Thu, 20 Jan 2022 07:06:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2607D2F71; Thu, 20 Jan 2022 08:05:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2607D2F71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642662401; bh=KahPkGd62HlpTNRwonxkqeMzwbhhlTVHUgDFV2XrfRA=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=c6WoQHsdZmwT4/gszfhHL2HfLnnujpbYgVE9iP90ixnImNJ18jDABC2J0FbJFF0ur iZckH0HQs0a/5GhVlnKuNpNrI3wtABObLODEznlwLTz4T9oo9cohidm/LjdtQPod5U zY2Nzl33YRQD99Yn9ho7TNHlZNuwuUFqa3Zvb2hQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D6CB6F80527; Thu, 20 Jan 2022 08:03:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 513E8F800CE; Mon, 17 Jan 2022 10:25:02 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 43E51F800CE for ; Mon, 17 Jan 2022 10:24:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 43E51F800CE Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9OFv-0006KR-Ei; Mon, 17 Jan 2022 10:24:51 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9OFp-00AnDX-Gd; Mon, 17 Jan 2022 10:24:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n9OFo-0002fs-6r; Mon, 17 Jan 2022 10:24:44 +0100 Date: Mon, 17 Jan 2022 10:24:44 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: <20220117092444.opoedfcf5k5u6otq@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <29f0c65d-77f2-e5b2-f6cc-422add8a707d@omp.ru> <20220114092557.jrkfx7ihg26ekzci@pengutronix.de> <61b80939-357d-14f5-df99-b8d102a4e1a1@omp.ru> <20220114202226.ugzklxv4wzr6egwj@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycu5k3o6g2lyq6o4" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: alsa-devel@alsa-project.org X-Mailman-Approved-At: Thu, 20 Jan 2022 08:03:34 +0100 Cc: Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , KVM list , "Rafael J. Wysocki" , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , ALSA Development Mailing List , Andy Shevchenko , Guenter Roeck , Thierry Reding , MTD Maling List , Linux I2C , Miquel Raynal , linux-phy@lists.infradead.org, Jiri Slaby , openipmi-developer@lists.sourceforge.net, Khuong Dinh , Florian Fainelli , Matthias Schiffer , Joakim Zhang , Kamal Dasu , Greg Kroah-Hartman , Lee Jones , Bartosz Golaszewski , Daniel Lezcano , Tony Luck , Kishon Vijay Abraham I , bcm-kernel-feedback-list , "open list:SERIAL DRIVERS" , Jakub Kicinski , Zhang Rui , Linux PWM List , Robert Richter , Saravanan Sekar , Corey Minyard , Linux PM list , Linux Kernel Mailing List , Mauro Carvalho Chehab , John Garry , Peter Korsgaard , William Breathitt Gray , Mark Gross , "open list:GPIO SUBSYSTEM" , Alex Williamson , Mark Brown , Borislav Petkov , Sebastian Reichel , Eric Auger , Matthias Brugger , Takashi Iwai , platform-driver-x86@vger.kernel.org, Benson Leung , Linux ARM , linux-edac@vger.kernel.org, Sergey Shtylyov , Mun Yew Tham , Hans de Goede , netdev@vger.kernel.org, Yoshihiro Shimoda , Cornelia Huck , Linux MMC List , Liam Girdwood , linux-spi , Linux-Renesas , Vinod Koul , James Morse , Zha Qipeng , Pengutronix Kernel Team , Richard Weinberger , Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" --ycu5k3o6g2lyq6o4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Geert, On Mon, Jan 17, 2022 at 09:41:42AM +0100, Geert Uytterhoeven wrote: > On Sat, Jan 15, 2022 at 9:22 PM Sergey Shtylyov wrote: > > On 1/14/22 11:22 PM, Uwe Kleine-K=F6nig wrote: > > > You have to understand that for clk (and regulator and gpiod) NULL is= a > > > valid descriptor that can actually be used, it just has no effect. So > > > this is a convenience value for the case "If the clk/regulator/gpiod = in > > > question isn't available, there is nothing to do". This is what makes > > > clk_get_optional() and the others really useful and justifies their > > > existence. This doesn't apply to platform_get_irq_optional(). > > > > I do understand that. However, IRQs are a different beast with their > > own justifications... >=20 > > > clk_get_optional() is sane and sensible for cases where the clk might= be > > > absent and it helps you because you don't have to differentiate betwe= en > > > "not found" and "there is an actual resource". > > > > > > The reason for platform_get_irq_optional()'s existence is just that > > > platform_get_irq() emits an error message which is wrong or suboptimal > > > > I think you are very wrong here. The real reason is to simplify the > > callers. >=20 > Indeed. The commit that introduced platform_get_irq_optional() said: Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt. So the author of 8973ea47901c81a1912bd05f1577bed9b5b52506 failed to mention the real reason? Or look at 31a8d8fa84c51d3ab00bf059158d5de6178cf890: [...] use platform_get_irq_optional() to get second/third IRQ which are optional to avoid below error message during probe: [...] Look through the output of git log -Splatform_get_irq_optional to find several more of these. Also I fail to see how a caller of (today's) platform_get_irq_optional() is simpler than a caller of platform_get_irq() given that there is no semantic difference between the two. Please show me a single conversion from platform_get_irq to platform_get_irq_optional that yielded a simplification. So you need some more effort to convince me of your POV. > Even for clocks, you cannot assume that you can always blindly use > the returned dummy (actually a NULL pointer) to call into the clk > API. While this works fine for simple use cases, where you just > want to enable/disable an optional clock (clk_prepare_enable() and > clk_disable_unprepare()), it does not work for more complex use cases. Agreed. But for clks and gpiods and regulators the simple case is quite usual. For irqs it isn't. And if you cannot blindly use the dummy, then you're not the targetted caller of *_get_optional() and should better use *_get() and handle -ENODEV explicitly. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycu5k3o6g2lyq6o4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHlNdMACgkQwfwUeK3K 7AkbyQf/dzwfw39nzRfi8yss0CiqoAU/yS+7MsnZvnWGKQxcIojgK1OX/xdxiMKI C4HnYtImt4dRHJdZDTL5+BWmwrkKo3ytJl8YRHBffgzQdKfAXOit1Pce623dbYvd wKJedLR6H9VXuTa1ULEvTnC0cXupHaoxjvQbKkUhlz/PahrhX91+dNJcoWTB6eB2 YSb6MMcqwMFJ6y2P4pDKDoCf0RNjt8EzTKMWUdx1zcCrqT+wDzA0Ub0UvM7EpUXn ziLd4JEC+3SxJZvr2Y8jPQUGb4RMr+Z20vfEOG154m+zZ5lZe7Pcp1ggo6wb+fZ9 qM6JVYjExAvA43UcTTna2uSeE/+nfA== =gHVT -----END PGP SIGNATURE----- --ycu5k3o6g2lyq6o4--