[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240216011545.7fmup2qkqikvb7ro@skbuf>
Date: Fri, 16 Feb 2024 03:15:45 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Alvin Šipraga <alsi@...g-olufsen.dk>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3 3/3] net: dsa: realtek: support reset
controller
On Wed, Feb 14, 2024 at 07:17:55PM -0300, Luiz Angelo Daros de Luca wrote:
> > On Wed, Feb 14, 2024 at 1:54 AM Luiz Angelo Daros de Luca
> > <luizluca@...il.com> wrote:
> >
> > > The 'reset-gpios' will not work when the switch reset is controlled by a
> > > reset controller.
> > >
> > > Although the reset is optional and the driver performs a soft reset
> > > during setup, if the initial reset state was asserted, the driver will
> > > not detect it.
> > >
> > > The reset controller will take precedence over the reset GPIO.
> > >
> > > Signed-off-by: Luiz Angelo Daros de Luca <luizluca@...il.com>
> > (...)
> > > +void rtl83xx_reset_assert(struct realtek_priv *priv)
> > > +{
> > > + int ret;
> > > +
> > > + if (priv->reset_ctl) {
> > > + ret = reset_control_assert(priv->reset_ctl);
> >
> > Actually, reset_control_assert() is NULL-tolerand (as well as the
> > stubs) so you can just issue this unconditionally. If priv->reset_ctl
> > is NULL it will just return 0.
>
> The idea was to avoid gpiod_set_value if the reset_control_assert was
> configured and worked. However, I don't see a big issue in calling
> them both as you don't expect both to be configured.
> I'll remove the "ifs not null" and let both be called.
In the defense of Linus' comment, your proposed code did not do what you
seem to have intended anyway. If priv->reset_ctl was non-NULL, it fell
through and potentially ran gpiod_set_value() anyway - there was no
early "return". So, the simplification comment was predictable.
Powered by blists - more mailing lists