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@xxxxxxxxx> 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@xxxxxxxxx> > > (...) > > > +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.