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 B17A0C433F5 for ; Mon, 10 Jan 2022 21:08:47 +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-Transfer-Encoding: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-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uEvdQQhyAmUsGyZvlDG+WcC9GtXAdNRdYFPS6Rlb1L8=; b=EMpTkvGvnLQQ4j VaOERhc276sAwhFjuiO9XWTXYN7yGhnu6rUqb39UpihuJBC2yoIcHWjtUTPgJ8J6p/RxSVfiPGeK+ rGjtFbfLPBnZeOxLz3lhe9arDMAmeMkAcNE8owo9/RVBezs6YtJdvYZgAs644pm8NOtjflCMmyf3w UktfDWb0MP4WOGtiYhyK0Reu2s8SkTqI8tSr6Xr6rD5uLLjcXSSVQ6GLnE+hmGgojLZjE8LQWvHZb A8YWdf4XRWIos/hAZrRhWx65S/KERHHkGZCrd6knpHknfMbJppKMhXxLqLrS8hVwjpos6krn7MIom +s8Aw0dwXzHHv2c1beIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n71uI-00DLrQ-Vx; Mon, 10 Jan 2022 21:08:46 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n71uD-00DLnv-4T; Mon, 10 Jan 2022 21:08:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641848921; x=1673384921; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=noXDmlMb/EBRvid+M0xTN4DJrqhApqmO9Jn6H9SNPpk=; b=gHbih01Mr3YKT1rv5nOjELNCkPGRHU83/EhA3wWGQz86+mj3m5NaLrGY cRNlionPmDPyhzgxiMHD+lmbdX4c38IpVssKIFt3Ez3wSV4fCP5BhJ2vk OUl8x6QnaP+pp7OxKMMBmEm8X3j3V4bJ7+wrhL3Ohu66MiFBD/2fZAIFJ SuThOXNcYRwgH9Q1ABzEc+sL9qao0v7wZsYyGhMpZG+5MA3sk6ADtqUHI D5Q40pE27lIsv6hcCdB197cktCGjmR2txz2OAAcrTC/ABxH0M0m1PhnhU hqBX0OGgXW31lhDi7Rj9tmYLSDf+AbanVw6XFyWYWNzCpob/jnBtwwCHk A==; X-IronPort-AV: E=McAfee;i="6200,9189,10223"; a="240871316" X-IronPort-AV: E=Sophos;i="5.88,278,1635231600"; d="scan'208";a="240871316" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2022 13:08:38 -0800 X-IronPort-AV: E=Sophos;i="5.88,278,1635231600"; d="scan'208";a="490132599" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2022 13:08:20 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1n71sd-00915P-Sm; Mon, 10 Jan 2022 23:07:03 +0200 Date: Mon, 10 Jan 2022 23:07:03 +0200 From: Andy Shevchenko To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Sergey Shtylyov , 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, 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 =?iso-8859-1?Q?S=F6derlund?= , linux-mediatek@lists.infradead.org, Brian Norris , "David S. Miller" Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional Message-ID: References: <20220110195449.12448-1-s.shtylyov@omp.ru> <20220110195449.12448-2-s.shtylyov@omp.ru> <20220110201014.mtajyrfcfznfhyqm@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220110201014.mtajyrfcfznfhyqm@pengutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220110_130841_253975_BA752631 X-CRM114-Status: GOOD ( 32.30 ) 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: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On Mon, Jan 10, 2022 at 09:10:14PM +0100, Uwe Kleine-K=F6nig wrote: > On Mon, Jan 10, 2022 at 10:54:48PM +0300, Sergey Shtylyov wrote: > > This patch is based on the former Andy Shevchenko's patch: > > = > > https://lore.kernel.org/lkml/20210331144526.19439-1-andriy.shevchenko@l= inux.intel.com/ > > = > > Currently platform_get_irq_optional() returns an error code even if IRQ > > resource simply has not been found. It prevents the callers from being > > error code agnostic in their error handling: > > = > > ret =3D platform_get_irq_optional(...); > > if (ret < 0 && ret !=3D -ENXIO) > > return ret; // respect deferred probe > > if (ret > 0) > > ...we get an IRQ... > > = > > All other *_optional() APIs seem to return 0 or NULL in case an optional > > resource is not available. Let's follow this good example, so that the > > callers would look like: > > = > > ret =3D platform_get_irq_optional(...); > > if (ret < 0) > > return ret; > > if (ret > 0) > > ...we get an IRQ... > = > The difference to gpiod_get_optional (and most other *_optional) is that > you can use the NULL value as if it were a valid GPIO. The problem is not only there, but also in the platform_get_irq() and that problem is called vIRQ0. Or as Linus put it "_cookie_" for IRQ, which never ever should be 0. > As this isn't given with for irqs, I don't think changing the return > value has much sense. In my eyes the problem with platform_get_irq() and > platform_get_irq_optional() is that someone considered it was a good > idea that a global function emits an error message. The problem is, > that's only true most of the time. (Sometimes the caller can handle an > error (here: the absence of an irq) just fine, sometimes the generic > error message just isn't as good as a message by the caller could be. > (here: The caller could emit "TX irq not found" which is a much nicer > message than "IRQ index 5 not found".) > = > My suggestion would be to keep the return value of > platform_get_irq_optional() as is, but rename it to > platform_get_irq_silent() to get rid of the expectation invoked by the > naming similarity that motivated you to change > platform_get_irq_optional(). This won't fix the issue with vIRQ0. -- = With Best Regards, Andy Shevchenko -- = linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy