lkml.org 
[lkml]   [2018]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] power: supply: Add Spreadtrum SC27XX fuel gauge unit driver
    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.

    -- Sebastian
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2018-09-20 02:36    [W:2.170 / U:0.216 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site