linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled
Date: Mon, 13 Feb 2017 09:20:01 +0100	[thread overview]
Message-ID: <20170213082001.eoebg6wtzagzaaow@pengutronix.de> (raw)
In-Reply-To: <20170213074506.cf2zrjp2lmhtyoo5@pengutronix.de>

On Mon, Feb 13, 2017 at 08:45:06AM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Sun, Feb 12, 2017 at 05:15:01PM -0800, Dmitry Torokhov wrote:
> > On Sun, Feb 12, 2017 at 05:13:55PM -0800, Dmitry Torokhov wrote:
> > > Given the intent behind gpiod_get_optional() and friends it does not make
> > > sense to return -ENOSYS when GPIOLIB is disabled: the driver is expected to
> > > work just fine without gpio so let's behave as if gpio was not found.
> > > Otherwise we have to special-case -ENOSYS in drivers.
> > > 
> > > Note that there was objection that someone might forget to enable GPIOLIB
> > > when dealing with a platform that has device that actually specifies
> > > optional gpio and we'll break it. I find this unconvincing as that would
> > > have to be the *only GPIO* in the system, which is extremely unlikely.
> > > 
> > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> I don't like this patch and so I wonder what I wrote that could be
> interpreted as suggesting this patch. For now I'd say only
> 
> 	Nacked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> is justified.

Oh, it seems I really sent such a RFC patch some time ago. Still I think
it's wrong to do that and that we need something like a
lookup-only-GPIOLIB that implements:

	def gpio_get_optional(...):
		if a gpio is specified:
			return -ENOSYS
		else:
			return NULL

if you really want save some bytes and disable the full-fledged GPIOLIB.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2017-02-13  8:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13  1:13 [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Dmitry Torokhov
2017-02-13  1:15 ` Dmitry Torokhov
2017-02-13  7:45   ` Uwe Kleine-König
2017-02-13  8:20     ` Uwe Kleine-König [this message]
2017-02-13  8:20     ` Dmitry Torokhov
2017-02-13  8:59       ` Uwe Kleine-König
2017-02-13 17:32         ` Dmitry Torokhov
2017-02-22 16:06 ` Linus Walleij
2017-02-22 18:27   ` Dmitry Torokhov
2017-02-22 18:49     ` Mark Brown
2017-02-22 18:44   ` Mark Brown
2017-03-14 13:31 ` Linus Walleij

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=20170213082001.eoebg6wtzagzaaow@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).