Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2052801pxb; Sun, 16 Jan 2022 08:22:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDgXUL6TRFyzS5EqlS3MjoUuWouwNotLJzP06RdYVhhVbmFwNEcqp+cDPKN2DtRcJxMdQh X-Received: by 2002:a17:90b:4b48:: with SMTP id mi8mr20814773pjb.172.1642350141786; Sun, 16 Jan 2022 08:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642350141; cv=none; d=google.com; s=arc-20160816; b=ko3I0hkQ0NWxZHNxPTIA2uoJ4+DzVOK9reMWnlvstD8LDVfhUfOTwLVD0DutqALr4n Ksldrz+OfW7dYdWrvxwcDrC9ml36Suf139SAChRdmBlqr9bGteVykAj+1hoq1E2L0ggz s9O6cc9Y24B7yNfft8PV0jTnYYXMlzoneodJOEr7z6+k/OhsYaNCTDq7qdC60bfuLb1V YBK3/yGVXp4N4+Eijk4Axd7ZYUvSJc0kzudf1A7WWoFFTeA1XMlkBFSy0ojCPQbvtbLY RTc6stDX6sXl3fwhaMqimykBpbkQhyDfCliHZl6zExA7YYIL7n+1Kxs589jarvih4r9K cxJw== 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=Rw65GdievkQ5vrto3VSeua39uDeVgR+Q8oPdWh6CYkU=; b=Cc41hQmWGbTtOukBqKchmTH5rrKSv15hM/wve5zTiz5eACYf29qRawSKidrtOuVxQ6 iKrR+KkajUHnzNBF9gFaWAsdi9W5BXwZrTR6zfMmsmP6FbAlQlLFzQFyfVLKFKtQgTwm BUdFz5BNIo4fNZNuS3sg93SQD5lDf7owQhxsIRXXH+KA5q9CxmjCpecl2GSnqM5MnJpG XNLTFeTZiaaB3FApbuaOgHwVzKnbo2ByEPXb0wFDxhQkvs6bdueD0TY2gZqqkoeNhazz KcsowMUIm3EbF89Vb29Cbhf2+6qeGI10cwoYAP3f+gOHZsX9/U+2vppKWJQ4tjAvzexn tbww== 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 oj7si4546805pjb.29.2022.01.16.08.22.10; Sun, 16 Jan 2022 08:22:21 -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 S233167AbiAOSiE (ORCPT + 99 others); Sat, 15 Jan 2022 13:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbiAOSiD (ORCPT ); Sat, 15 Jan 2022 13:38:03 -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 9586EC061574 for ; Sat, 15 Jan 2022 10:38:02 -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 1n8nvA-0003Jj-3l; Sat, 15 Jan 2022 19:37:00 +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 1n8nux-00AUOf-7m; Sat, 15 Jan 2022 19:36:46 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1n8nuv-0005gB-Q6; Sat, 15 Jan 2022 19:36:45 +0100 Date: Sat, 15 Jan 2022 19:36:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Sergey Shtylyov Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Andrew Lunn , Ulf Hansson , Vignesh Raghavendra , Jiri Slaby , Liam Girdwood , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , alsa-devel@alsa-project.org, Andy Shevchenko , Sebastian Reichel , linux-phy@lists.infradead.org, Thierry Reding , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, Miquel Raynal , Guenter Roeck , Lee Jones , openipmi-developer@lists.sourceforge.net, Saravanan Sekar , Khuong Dinh , Florian Fainelli , Matthias Schiffer , kvm@vger.kernel.org, Kamal Dasu , Richard Weinberger , Bartosz Golaszewski , Daniel Lezcano , Kishon Vijay Abraham I , bcm-kernel-feedback-list@broadcom.com, linux-serial@vger.kernel.org, Jakub Kicinski , Zhang Rui , Jaroslav Kysela , platform-driver-x86@vger.kernel.org, linux-pwm@vger.kernel.org, John Garry , Robert Richter , Zha Qipeng , Corey Minyard , linux-pm@vger.kernel.org, Peter Korsgaard , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , Borislav Petkov , Matthias Brugger , Takashi Iwai , Mauro Carvalho Chehab , Benson Leung , linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, Tony Luck , Mun Yew Tham , Eric Auger , netdev@vger.kernel.org, Yoshihiro Shimoda , Cornelia Huck , linux-mmc@vger.kernel.org, Joakim Zhang , linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Vinod Koul , James Morse , Pengutronix Kernel Team , 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 (summary) Message-ID: <20220115183643.6zxalxqxrhkfgdfq@pengutronix.de> References: <20220110195449.12448-1-s.shtylyov@omp.ru> <20220110195449.12448-2-s.shtylyov@omp.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="j6ppxzwmobiijznr" Content-Disposition: inline In-Reply-To: <20220110195449.12448-2-s.shtylyov@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: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --j6ppxzwmobiijznr Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, I'm trying to objectively summarize the discussions in this thread in the hope this helps finding a way that most people can live with. First a description of the status quo: There are several function pairs *get() and *get_optional() that however are different in various aspects. Their relevant properties are listes in the following table. Ideally each line had only identical entries. | clk_get | gpiod_get | platform_get_irq | regulator_get | return value | | | | | on not-found | ERR_PTR(-ENOENT) | ERR_PTR(-ENOENT) | -ENXIO | dummy[1] = | (plain get) | | | | | | | | | | return value | | | | | on not-found | dummy[1] | dummy[1] | -ENXIO | ERR_PTR(-ENOENT) | (get_optional) | | | | | | | | | | emits an error message | | | | | on error (including | no | no | yes[2] | no | not-found) | | | | | | | | | | get_optional emits an error | | | | | message on error (including | no | no | no | no | not-found) | | | | | | | | | | summary: | returning a dummy | returning a dummy | doesn't emit an | ret= urning error code | *_get_optional() differs from | on not-found | on not-found | error mess= age | on not-found | *_get by: | | | | | [1] the dummy value is a valid resource descriptor, the API functions are a noop for this dummy value. This dummy value is NULL for all three subsystems. [2] no error is printed for -EPROBE_DEFER. The inversion between clk+gpio vs. regulator is unforunate, swaping one or the other would be good for consistency, but this isn't the topic of this thread. Only so much: It's not agreed upon which variant is the better one and the difference is of historical origin. There are now different suggestions to improve the situation regarding platform_get_irq() compared to the other functions: a) by Sergey platform_get_irq_optional() is changed to return 0 on not-found. b) by Uwe rename platform_get_irq_optional() to platform_get_irq_silent() The argument pro a) is: platform_get_irq_optional() is aligned to clk_get() and gpiod_get() by returning 0 on not-found. The argument contra a)=20 The return value 0 for platform_get_irq() is only syntactically nearer to the dummy value of clk_get() and gpiod_get(). A dummy value isn't available and probably not sensible to introduce for irq because most drivers have to check for the not-found situation anyhow to setup polling.=20 The argument pro b) is: The relevant difference between platform_get_irq() and its optional variant is that the latter is silent. This is a different concept for the meaning of optional compared to the other *_get_optional(). The argument contra b) is: The chosen name is bad, because driver authors might wonder what a silent irq is. ---- end of summary =09 A possible compromise: We can have both. We rename platform_get_irq_optional() to platform_get_irq_silent() (or platform_get_irq_silently() if this is preferred) and once all users are are changed (which can be done mechanically), we reintroduce a platform_get_irq_optional() with Sergey's suggested semantic (i.e. return 0 on not-found, no error message printking). Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --j6ppxzwmobiijznr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmHjFDcACgkQwfwUeK3K 7Al8ywf+IeUGmQ++ZSqrHA1sy8iG93DkE7XqgEI+/OYaQABSzKpE6w55cBp0EbHJ TXkVcUUkd5e6eFtr5FwZEgzO1/vKIlB6IkuD5jbuqXJy0oRz9whaVLAJvpYN/mmy KTHzmFssgA4mbUBx8XRteoVSNn6k9z0UF6EGrb0Vyfu70Q4yTdZKDP2mznyAnLee rw1Oj2UCu2Jn5QrSTg0jNrPqGbHrmEeadE08d3oZRpL/ZcO1Er30Oj3aYFDiiE1V p0J5fzDs0GZN4r/mwNSUDyq2edsIF3F2/ILOt05pf6AsFudhufarTMh2VWIu/mz7 mMHkAm6dYTtw1VKd1mp/RwSpxhhJSw== =6uea -----END PGP SIGNATURE----- --j6ppxzwmobiijznr--