public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Sergey Shtylyov" <s.shtylyov@omp.ru>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org, "Andrew Lunn" <andrew@lunn.ch>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	linux-iio@vger.kernel.org,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Amit Kucheria" <amitk@kernel.org>,
	alsa-devel@alsa-project.org,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	linux-phy@lists.infradead.org,
	"Thierry Reding" <thierry.reding@gmail.com>,
	linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org,
	linux-gpio@vger.kernel.org,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Guenter Roeck" <groeck@chromium.org>,
	linux-spi@vger.kernel.org, "Lee Jones" <lee.jones@linaro.org>,
	openipmi-developer@lists.sourceforge.net,
	"Peter Korsgaard" <peter@korsgaard.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Matthias Schiffer" <matthias.schiffer@ew.tq-group.com>,
	kvm@vger.kernel.org, "Kamal Dasu" <kdasu.kdev@gmail.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-serial@vger.kernel.org, "Jakub Kicinski" <kuba@kernel.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	platform-driver-x86@vger.kernel.org, linux-pwm@vger.kernel.org,
	"Zha Qipeng" <qipeng.zha@intel.com>,
	"Corey Minyard" <minyard@acm.org>,
	linux-pm@vger.kernel.org, "John Garry" <john.garry@huawei.com>,
	"William Breathitt Gray" <vilhelm.gray@gmail.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-mediatek@lists.infradead.org,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Benson Leung" <bleung@chromium.org>,
	linux-arm-kernel@lists.infradead.org,
	"Mun Yew Tham" <mun.yew.tham@intel.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	netdev@vger.kernel.org,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	linux-mmc@vger.kernel.org,
	"Joakim Zhang" <qiangqing.zhang@nxp.com>,
	"Oleksij Rempel" <linux@rempel-privat.de>,
	linux-renesas-soc@vger.kernel.org,
	"Vinod Koul" <vkoul@kernel.org>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2 1/2] platform: make platform_get_irq_optional() optional
Date: Mon, 14 Feb 2022 12:13:01 +0200	[thread overview]
Message-ID: <YgorLXUr8aT+1ttv@smile.fi.intel.com> (raw)
In-Reply-To: <20220214071351.pcvstrzkwqyrg536@pengutronix.de>

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 <matthias.schiffer@ew.tq-group.com>
> > Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> 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



  parent reply	other threads:[~2022-02-14 10:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220212201631.12648-1-s.shtylyov@omp.ru>
2022-02-12 20:16 ` [PATCH v2 1/2] platform: make platform_get_irq_optional() optional Sergey Shtylyov
2022-02-14  7:13   ` Uwe Kleine-König
2022-02-14  9:01     ` Geert Uytterhoeven
2022-02-14 14:00       ` Uwe Kleine-König
2022-02-14 10:13     ` Andy Shevchenko [this message]
2022-02-14 13:56       ` Uwe Kleine-König
2022-02-14  8:54   ` Geert Uytterhoeven
2022-02-14 10:43     ` Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgorLXUr8aT+1ttv@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amitk@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bleung@chromium.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=cohuck@redhat.com \
    --cc=computersforpeace@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=davem@davemloft.net \
    --cc=eric.auger@redhat.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=hdegoede@redhat.com \
    --cc=jirislaby@kernel.org \
    --cc=john.garry@huawei.com \
    --cc=kdasu.kdev@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kishon@ti.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=markgross@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=minyard@acm.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mun.yew.tham@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=perex@perex.cz \
    --cc=peter@korsgaard.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=qiangqing.zhang@nxp.com \
    --cc=qipeng.zha@intel.com \
    --cc=rafael@kernel.org \
    --cc=richard@nod.at \
    --cc=rui.zhang@intel.com \
    --cc=s.shtylyov@omp.ru \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ulf.hansson@linaro.org \
    --cc=vigneshr@ti.com \
    --cc=vilhelm.gray@gmail.com \
    --cc=vkoul@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox