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 C5B6EC4332F for ; Mon, 14 Feb 2022 10:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349377AbiBNKwh (ORCPT ); Mon, 14 Feb 2022 05:52:37 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349391AbiBNKvz (ORCPT ); Mon, 14 Feb 2022 05:51:55 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B93469CD8; Mon, 14 Feb 2022 02:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644833793; x=1676369793; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=iMfir8Hys8PoRkg7XbbXRj39pNMes8hLErnltaIltH8=; b=H0pRtYXVokRBX+RGOdsauOP2aIBK1vtMoRGVk+VDUjA0gjIToKp08alR Tm18cVC3x44oAcrbuiqx/MzOE8OK4CduA2tcM/A1XkQRsBI7PovauGPJd 0kz34pErXmws8kirxEiFlrcm3UmngipUs6aMo6zPHQmDtF9jNxNgty5Eu x+fAcade60DLDG7Rwc6dU+y5s++sSBiaXXsF0yEQzBwK49KC3bxrLe4wT TpB1A+VMBkcYrK8YoNp/BJt8twTNALUNIl+xHo6DUgdP8dwR9lZ7s8WuF dPG9EmE0KsElsnrAyZkL2fICumUH0C3VBRwIxaCvdCGRHPC478tlmkk2s g==; X-IronPort-AV: E=McAfee;i="6200,9189,10257"; a="230023834" X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="230023834" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2022 02:16:32 -0800 X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="603187011" Received: from smile.fi.intel.com ([10.237.72.61]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2022 02:16:17 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nJYLy-004PC8-6n; Mon, 14 Feb 2022 12:13:06 +0200 Date: Mon, 14 Feb 2022 12:13:01 +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 , linux-iio@vger.kernel.org, Linus Walleij , Amit Kucheria , alsa-devel@alsa-project.org, Liam Girdwood , 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 , linux-spi@vger.kernel.org, Lee Jones , openipmi-developer@lists.sourceforge.net, Peter Korsgaard , 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, Zha Qipeng , Corey Minyard , linux-pm@vger.kernel.org, John Garry , William Breathitt Gray , Mark Gross , Hans de Goede , Alex Williamson , Mark Brown , linux-mediatek@lists.infradead.org, Matthias Brugger , Takashi Iwai , Benson Leung , linux-arm-kernel@lists.infradead.org, Mun Yew Tham , Eric Auger , netdev@vger.kernel.org, Yoshihiro Shimoda , Cornelia Huck , linux-mmc@vger.kernel.org, Joakim Zhang , Oleksij Rempel , linux-renesas-soc@vger.kernel.org, Vinod Koul , Pengutronix Kernel Team , Niklas =?iso-8859-1?Q?S=F6derlund?= , Brian Norris , "David S. Miller" Subject: Re: [PATCH v2 1/2] platform: make platform_get_irq_optional() optional Message-ID: References: <20220212201631.12648-1-s.shtylyov@omp.ru> <20220212201631.12648-2-s.shtylyov@omp.ru> <20220214071351.pcvstrzkwqyrg536@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220214071351.pcvstrzkwqyrg536@pengutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Mon, Feb 14, 2022 at 08:13:51AM +0100, Uwe Kleine-König wrote: > On Sat, Feb 12, 2022 at 11:16:30PM +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@linux.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 = platform_get_irq_optional(...); > > if (ret < 0 && ret != -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 = platform_get_irq_optional(...); > > if (ret < 0) > > return ret; > > if (ret > 0) > > ...we get an IRQ... > > > > Reported-by: Matthias Schiffer > > Signed-off-by: Sergey Shtylyov > > While this patch is better than v1, I still don't like it for the > reasons discussed for v1. (i.e. 0 isn't usable as a dummy value which I > consider the real advantage for the other _get_optional() functions.) I think you haven't reacted anyhow to my point that you mixing apples and bananas together when comparing this 0 to the others _optional APIs. > Apart from that, I think the subject is badly chosen. With "Make > somefunc() optional" I would expect that you introduce a Kconfig symbol > that results in the function not being available when disabled. -- With Best Regards, Andy Shevchenko