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 A1892C43217 for ; Thu, 13 Jan 2022 22:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238064AbiAMWoX (ORCPT ); Thu, 13 Jan 2022 17:44:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238062AbiAMWoW (ORCPT ); Thu, 13 Jan 2022 17:44:22 -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 EF9E7C061574 for ; Thu, 13 Jan 2022 14:44:21 -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 1n88oe-0007pY-PW; Thu, 13 Jan 2022 23:43:32 +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 1n88oS-00A973-DR; Thu, 13 Jan 2022 23:43:19 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n88oR-0000VL-8T; Thu, 13 Jan 2022 23:43:19 +0100 Date: Thu, 13 Jan 2022 23:43:19 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Sergey Shtylyov Cc: Mark Brown , 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 , Geert Uytterhoeven , "open list:SERIAL DRIVERS" , bcm-kernel-feedback-list , 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 , Takashi Iwai , Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Borislav Petkov , Jakub Kicinski , 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] driver core: platform: Rename platform_get_irq_optional() to platform_get_irq_silent() Message-ID: <20220113224319.akljsjtu7ps75vun@pengutronix.de> References: <20220112085009.dbasceh3obfok5dc@pengutronix.de> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <20220113110831.wvwbm75hbfysbn2d@pengutronix.de> <20220113194358.xnnbhsoyetihterb@pengutronix.de> <1df04d74-8aa2-11f1-54e9-34d0e8f4e58b@omp.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7tuoe52njhyotvsc" Content-Disposition: inline In-Reply-To: <1df04d74-8aa2-11f1-54e9-34d0e8f4e58b@omp.ru> 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: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org --7tuoe52njhyotvsc Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 13, 2022 at 11:57:43PM +0300, Sergey Shtylyov wrote: > On 1/13/22 11:17 PM, Mark Brown wrote: >=20 > >> The subsystems regulator, clk and gpio have the concept of a dummy > >> resource. For regulator, clk and gpio there is a semantic difference > >> between the regular _get() function and the _get_optional() variant. > >> (One might return the dummy resource, the other won't. Unfortunately > >> which one implements which isn't the same for these three.) The > >> difference between platform_get_irq() and platform_get_irq_optional() = is > >> only that the former might emit an error message and the later won't. >=20 > This is only a current difference but I'm still going to return 0 ISO > -ENXIO from latform_get_irq_optional(), no way I'd leave that -ENXIO there > alone... :-) This would address a bit of the critic in my commit log. But as 0 isn't a dummy value like the dummy values that exist for clk, gpiod and regulator I still think that the naming is a bad idea because it's not in the spirit of the other *_get_optional functions. Seeing you say that -ENXIO is a bad return value for platform_get_irq_optional() and 0 should be used instead, I wonder why not changing platform_get_irq() to return 0 instead of -ENXIO, too. This question is for now only about a sensible semantic. That actually changing platform_get_irq() is probably harder than changing platform_get_irq_optional() is a different story. If only platform_get_irq_optional() is changed and given that the callers have to do something like: if (this_irq_exists()): ... (e.g. request_irq) else: ... (e.g. setup polling) I really think it's a bad idea that this_irq_exists() has to be different for platform_get_irq() vs. platform_get_irq_optional(). > > Reviewed-by: Mark Brown >=20 > Hm... I'm seeing a tag bit not seeing the patch itself... See https://lore.kernel.org/all/20220113194358.xnnbhsoyetihterb@pengutronix= =2Ede/ This is just a tree-wide s/platform_get_irq_optional/platform_get_irq_silent/ + a macro to not break callers of platform_get_irq_optional(). Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --7tuoe52njhyotvsc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHgqwMACgkQwfwUeK3K 7AlyrggAnnNuI35GvxF5VtWAxjQVEMBwQAZzFN2zmbCN56PVqEEi+hrB3o4qCrg5 RVngj3mJZBBvnB/EPzv0cg7FWq2/jPiopb8JGnPMf2HyN6pE6vQRw/vgdCAw1tSa Z1uE/p+FA63qrrD0UrCjr+6bQaobnf20ljmXq6EmZ6oPXvcQLnTureudQD0YJdII xZcTKIPC5wH7+yFedZzk1AovNre37jVzG74IzyB6Bbk4Jl22v8GJ8Nq3VUP7x2jE Ps6AsNLRubU3vuJ1T43P8/yY0B7PRiyRHvXS+N/qCCf44UuRmpvKziXUP2vnspWR 9RIT5bkqqtknA+dRrLt/xWijFiViOQ== =EM1y -----END PGP SIGNATURE----- --7tuoe52njhyotvsc--