public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org
Subject: Re: [libgpiod v2][PATCH] misc: make gpiod_is_gpiochip_device() not set errno
Date: Fri, 1 Jul 2022 19:55:12 +0800	[thread overview]
Message-ID: <20220701115512.GB42057@sol> (raw)
In-Reply-To: <CAMRc=MeNfO0-1sn8a4aPpb2tskueVMT=oALbx+VK0x0_yGo-fA@mail.gmail.com>

On Fri, Jul 01, 2022 at 01:50:46PM +0200, Bartosz Golaszewski wrote:
> On Fri, Jul 1, 2022 at 1:43 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Fri, Jul 01, 2022 at 01:00:56PM +0200, Bartosz Golaszewski wrote:
> > > This function should just report whether the file indicated by path is
> > > a GPIO chip or not. Let's rework it to not set errno. Failure to open a
> > > chip should still report errro numbers like before.
> > >
> >
> > This is will break my tool patch, for sure.
> > My gpiodetect uses the errno behaviour to give a clue as to why a chip
> > might not be available to a user, and that work was already done in
> > gpiod_is_gpiochip_device().
> > There might be other places the errno was propagated as well, but
> > whatever, I'll sort something out.
> >
> 
> Doesn't it make more sense to call gpiod_is_gpiochip_device() and then
> if it returns true, just try to open it and then report failure?
> 

Not for the case where the chip doesn't exist -
gpiod_is_gpiochip_device() has already worked that out.

But don't worry - I'll sort something out.

Cheers,
Kent.

      reply	other threads:[~2022-07-01 11:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 11:00 [libgpiod v2][PATCH] misc: make gpiod_is_gpiochip_device() not set errno Bartosz Golaszewski
2022-07-01 11:11 ` Andy Shevchenko
2022-07-01 11:43 ` Kent Gibson
2022-07-01 11:50   ` Bartosz Golaszewski
2022-07-01 11:55     ` Kent Gibson [this message]

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=20220701115512.GB42057@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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