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: <CAMz4kuKboR+QBJ9sQoiSA0SQHGioufpjgv7nKYCugfDewx5PLA@mail.gmail.com>
Date:   Thu, 20 Sep 2018 08:40:46 +0800
From:   Baolin Wang <baolin.wang@...aro.org>
To:     Sebastian Reichel <sebastian.reichel@...labora.com>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Linux PM list <linux-pm@...r.kernel.org>,
        DTML <devicetree@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>, yuanjiang.yu@...soc.com,
        Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH 2/2] power: supply: Add Spreadtrum SC27XX fuel gauge unit driver

Hi,

On 20 September 2018 at 08:36, Sebastian Reichel
<sebastian.reichel@...labora.com> wrote:
> Hi,
>
> On Mon, Sep 17, 2018 at 12:01:51PM +0800, Baolin Wang wrote:
> [...]
>> >> +static int sc27xx_fgu_parse_dt(struct sc27xx_fgu_data *data,
>> >> +                            struct device_node *np)
>> >> +{
>> >> +     const __be32 *list;
>> >> +     int i, len, size, ret;
>> >> +
>> >> +     ret = of_property_read_u32(np, "reg", &data->base);
>> >> +     if (ret) {
>> >> +             dev_err(data->dev, "failed to get fgu address\n");
>> >> +             return ret;
>> >> +     }
>> >> +
>> >> +     data->gpiod = devm_gpiod_get_optional(data->dev, "bat-detect", GPIOD_IN);
>> >> +     if (IS_ERR(data->gpiod)) {
>> >> +             dev_err(data->dev, "failed to get battery detection GPIO\n");
>> >> +             return PTR_ERR(data->gpiod);
>> >> +     }
>> >
>> > According to the binding (and the remaining code!) this gpio is not
>> > optional.
>>
>> Yes, they are not optional. If we can not get the detection GPIO, we
>> will return errors. So am I missing something else?
>>
>> Thanks for your comments.
>
> devm_gpiod_get_optional => devm_gpiod_get
>
> The _optional variant will return NULL if the GPIO is not specified in DT.
> The variant without _optional will return an error instead.

Ah, you are definitely correct. I missed _optional and thanks for
pointing this out.

-- 
Baolin Wang
Best Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ