Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1409187

Re: [PATCH RFT 1/2] phylib: add device reset GPIO support

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH RFT 1/2] phylib: add device reset GPIO support
Date 2016-05-30 17:00 +0200
Message-ID <rEwPD-5wp-5@gated-at.bofh.it> (permalink)
References <rlN4B-2Mf-3@gated-at.bofh.it> <rt2rV-3gl-23@gated-at.bofh.it> <ry3Qm-2Xu-7@gated-at.bofh.it> <rCZsJ-4u8-1@gated-at.bofh.it> <rD8Pn-1Or-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 26, 2016 at 9:00 PM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> On Thu, May 26, 2016 at 11:00:55AM +0200, Linus Walleij wrote:
>> On Thu, May 12, 2016 at 8:42 PM, Uwe Kleine-König
>> <u.kleine-koenig@pengutronix.de> wrote:
>>
>> > [added Linus Walleij to Cc, there is a question for you/him below]
>> (...)
>> >> +void mdio_device_reset(struct mdio_device *mdiodev, int value)
>> >> +{
>> >> +     if (mdiodev->reset)
>> >> +             gpiod_set_value(mdiodev->reset, value);
>> >
>> > Before v4.6-rc1~108^2~91 it was not necessary to check for the first
>> > parameter being non-NULL before calling gpiod_set_value. Linus, did you
>> > change this on purpose?
>>
>> Not really. And AFAICT it is still not necessary: what changed is that
>> an error message will be printed by VALIDATE_DESC() if you do that.
>> And that is proper I guess? I think it's sloppy code to randomly pass in
>> NULL to a call and just expect it to bail out, it seems more like
>> exercising the error path than something you'd normally rely on.
>>
>> Or am I getting things wrong?
>
> is the following sloppy?:
>
>         somegpio = gpiod_get_optional(dev, "some", GPIOD_OUT_LOW);
>         if (IS_ERR(somegpio))
>                 return PTR_ERR(somegpio);
>         gpiod_set_value(somegpio, 1);

Grrr OK I see, it's explicit from the _optional() call that it may be NULL
and then it should be ignored. So subsequent functions should ignore
that and bail out. My bad, sorry.

> If not (as I assume) you really changed something as this might trigger
> the warning.

Making a patch.

Yours,
Linus Walleij

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-05-12 20:50 +0200
  Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-12 23:40 +0200
    Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Andrew Lunn <andrew@lunn.ch> - 2016-05-13 06:10 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-13 23:20 +0200
    Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-05-13 09:10 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-13 23:50 +0200
    Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-13 21:20 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-16 04:10 +0200
  Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Roger Quadros <rogerq@ti.com> - 2016-05-13 11:10 +0200
    Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-13 21:40 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Andrew Lunn <andrew@lunn.ch> - 2016-05-13 22:50 +0200
        Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-13 23:00 +0200
          Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Andrew Lunn <andrew@lunn.ch> - 2016-05-14 01:50 +0200
            Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-14 21:40 +0200
              Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Andrew Lunn <andrew@lunn.ch> - 2016-05-14 22:00 +0200
                Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Andrew Lunn <andrew@lunn.ch> - 2016-05-16 04:10 +0200
                Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-19 15:50 +0200
                Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-05-16 04:10 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Roger Quadros <rogerq@ti.com> - 2016-05-16 11:00 +0200
  Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Linus Walleij <linus.walleij@linaro.org> - 2016-05-26 11:10 +0200
    Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-05-26 21:10 +0200
      Re: [PATCH RFT 1/2] phylib: add device reset GPIO support Linus Walleij <linus.walleij@linaro.org> - 2016-05-30 17:00 +0200

csiph-web