Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1737805pxb; Sat, 15 Jan 2022 22:46:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJznkqY9bmBfq4lt68JMpbUaWbmZCGgL9iyspez/YRTbIsZuYFddgMCHfN0zEb7l/FvD7O3t X-Received: by 2002:aa7:95b1:0:b0:4bf:ed5a:55d3 with SMTP id a17-20020aa795b1000000b004bfed5a55d3mr15994223pfk.64.1642315588281; Sat, 15 Jan 2022 22:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642315588; cv=none; d=google.com; s=arc-20160816; b=RiLJT5sA5H92MVaRC4eRMOyXZUCdKawCKw3Up1sQx6BJZDGL5Ah7+W5hzhq0At+3GT GJPUXO5RaxfiSjcsZHB3je9o+pi79MwtcMS0ihGGGEc68JhZJPte1beyde8mII/2GZ1Z yfH3YVcDkXHXOR8nhEuS3W6ZN7d12VhF/sWsndmnYfV1HcI36tZg1/mUP9eEtK6qEAry BFPlAk1DJTZP0Ouwdnjz3/sI7zWMlVxVrRc/xWxaS4m3sM83mWkKoUGqhfHuCP87yZGj +VRhs1gKN5hWQRlDjggOFpPSq4GqgShC73YRYBJhT2j4azkxqQv1Q3muZQIKPG/Ea6yQ uduQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OtNRmFDZXtKOmwqrXvin+zVWBOeaBiFWfj0fBGzZXdo=; b=MX3pG4YLdkNeA8er4rUP0Jdyw7ujMsj7Ltkr180q+acTDp9i5CPQOOzCHpNHf8NhLD fBdtjz3oPn/4educBgKbwztlzphtHHJkCXve6VFxVSI2ZxfEF48/y4Z6c5xEL8yCbOzW r78/tyZLmlES5dGP1hX4nYLktlqtpIxeAGDS4zIUzF68uz5egigPUt9wZmBsc20+MAjX e5hRjpamXdoRm3YeIfhOGFIlx/YJCv0BIg82XmkLVKQxxw3oAvrhGhpn4mxUg7gnez+G 5LUyMWgEigMmYd1dcJuwf30MU4L++vMPWl9Vyj3M5wN5+J9WACrjEpifQoNLS1Yos0du nmcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si10488687pls.194.2022.01.15.22.46.16; Sat, 15 Jan 2022 22:46:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232982AbiAOPWY (ORCPT + 99 others); Sat, 15 Jan 2022 10:22:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232978AbiAOPWT (ORCPT ); Sat, 15 Jan 2022 10:22:19 -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 78339C061574 for ; Sat, 15 Jan 2022 07:22:19 -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 1n8krk-00024Z-CN; Sat, 15 Jan 2022 16:21:16 +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 1n8kra-00ASwx-3H; Sat, 15 Jan 2022 16:21:05 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n8krY-0003aa-TV; Sat, 15 Jan 2022 16:21:04 +0100 Date: Sat, 15 Jan 2022 16:21:02 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Geert Uytterhoeven 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 , Jaroslav Kysela , 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 , 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" Subject: Re: [PATCH] driver core: platform: Rename platform_get_irq_optional() to platform_get_irq_silent() Message-ID: <20220115152102.m47snsdrw2elagak@pengutronix.de> References: <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <20220113110831.wvwbm75hbfysbn2d@pengutronix.de> <20220113194358.xnnbhsoyetihterb@pengutronix.de> <1df04d74-8aa2-11f1-54e9-34d0e8f4e58b@omp.ru> <20220113224319.akljsjtu7ps75vun@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ocudook43fjcrvv4" 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-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ocudook43fjcrvv4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 14, 2022 at 10:58:51AM +0100, Geert Uytterhoeven wrote: > Hi Uwe, >=20 > On Thu, Jan 13, 2022 at 11:43 PM Uwe Kleine-K=F6nig > wrote: > > On Thu, Jan 13, 2022 at 11:57:43PM +0300, Sergey Shtylyov wrote: > > > On 1/13/22 11:17 PM, Mark Brown wrote: > > > >> The subsystems regulator, clk and gpio have the concept of a dummy > > > >> resource. For regulator, clk and gpio there is a semantic differen= ce > > > >> between the regular _get() function and the _get_optional() varian= t. > > > >> (One might return the dummy resource, the other won't. Unfortunate= ly > > > >> which one implements which isn't the same for these three.) The > > > >> difference between platform_get_irq() and platform_get_irq_optiona= l() is > > > >> only that the former might emit an error message and the later won= 't. > > > > > > 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(). >=20 > For platform_get_irq(), the IRQ being absent is an error condition, > hence it should return an error code. > For platform_get_irq_optional(), the IRQ being absent is not an error > condition, hence it should not return an error code, and 0 is OK. Please show a few examples how this simplifies the code. If it's only that a driver has to check for =3D=3D 0 instead of =3D=3D -ENXIO, than that= 's not a good enough motivation to make platform_get_irq_optional() different to platform_get_irq(). Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ocudook43fjcrvv4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHi5kAACgkQwfwUeK3K 7AmxjQf+LjEMbZ2BLPsszWOOyw2Xtjn8mpuOmCBImErsT+AnE5G2nUp9a//M8hxr OxUaITVBvGpeAOf8afjOnacEHqcvNJGUdWblNwEGdc7auyl6qSe7agtR2LDjM5ir x233Ner1R+O8K0t4zRM2+g/LeLLNwL9Y+9y6swNJvQcsqzy0z86I7/R1ebWk9NMa w1paYTwYlIyghKS5pAN7yXeIAJFP9DFBDy0KGZG8uA+MZn1WWTk/vwK4/NR5XcrY WXb6zM/0lZtQWhYlKW/dcj4b3LlOo8dgfuGuu8WIqoKxY0230JDSg1E+5ZNLyKq3 7VzijyuxAzaTNhwSnAvUB2ToosLs1g== =EUgY -----END PGP SIGNATURE----- --ocudook43fjcrvv4--