lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVeFu+27Fe7LrHx-oX2mVX89h=cLfBH=kf82=QPP5EokDWC+Q@mail.gmail.com>
Date:	Wed, 2 Sep 2015 21:37:00 +0900
From:	Alexandre Courbot <gnurou@...il.com>
To:	Bjorn Andersson <bjorn.andersson@...ymobile.com>
Cc:	Linus Walleij <linus.walleij@...aro.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpio: Propagate errors from chip->get()

On Tue, Sep 1, 2015 at 2:16 PM, Bjorn Andersson
<bjorn.andersson@...ymobile.com> wrote:
> On Fri 28 Aug 09:44 PDT 2015, Bjorn Andersson wrote:
>
>> It's possible to have gpio chips hanging off unreliable remote buses
>> where the get() operation will fail to acquire a readout of the current
>> gpio state. Propagate these errors to the consumer so that they can
>> act on, retry or ignore these failing reads, instead of treating them as
>> the line being held high.
>>
>> Signed-off-by: Bjorn Andersson <bjorn.andersson@...ymobile.com>
>> ---
>>  drivers/gpio/gpiolib.c | 21 ++++++++++++++-------
>>  1 file changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
>> index 3b5e516298e0..dc17dbf8c234 100644
>> --- a/drivers/gpio/gpiolib.c
>> +++ b/drivers/gpio/gpiolib.c
>> @@ -1173,15 +1173,16 @@ EXPORT_SYMBOL_GPL(gpiod_is_active_low);
>>   * that the GPIO was actually requested.
>>   */
>>
>> -static bool _gpiod_get_raw_value(const struct gpio_desc *desc)
>> +static int _gpiod_get_raw_value(const struct gpio_desc *desc)
>>  {
>>       struct gpio_chip        *chip;
>> -     bool value;
>>       int offset;
>> +     int value;
>>
>>       chip = desc->chip;
>>       offset = gpio_chip_hwgpio(desc);
>> -     value = chip->get ? chip->get(chip, offset) : false;
>> +     value = chip->get ? chip->get(chip, offset) : -EIO;
>
> Linus, Alexandre, please feel free to apply this with -ENOTSUPP in
> accordance to Alexandre's comment in [1], if you prefer that. I picked
> -EIO as that's what's used in most other places when the get() op is
> missing.
>
> Maybe we should follow up with separate patch to make that consistent?

I will let Linus decide which value is the more appropriate, the patch
looks solid to me!

Reviewed-by: Alexandre Courbot <acourbot@...dia.com>

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ