Re: [PATCH 4/5] can: dev: can_restart(): update debug and error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04.10.2023 13:33:59, Marc Kleine-Budde wrote:
> On 04.10.2023 19:44:15, Vincent Mailhol wrote:
> > On Wed. 4 Oct. 2023, 18:18, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
> > >
> > > Update the debug message from "restarted" to "Attempting restart", as
> > > it is actually printed _before_ restarting the CAN device, and that
> > > restart may fail.
> > >
> > > Also update the error message from printing the error number to
> > > printing symbolic error names.
> > >
> > > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> > > ---
> > >  drivers/net/can/dev/dev.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c
> > > index 9014256c486a..8e4054e2abcc 100644
> > > --- a/drivers/net/can/dev/dev.c
> > > +++ b/drivers/net/can/dev/dev.c
> > > @@ -147,14 +147,14 @@ static void can_restart(struct net_device *dev)
> > >                 netif_rx(skb);
> > >         }
> > >
> > > -       netdev_dbg(dev, "restarted\n");
> > > +       netdev_dbg(dev, "Attempting restart\n");
> > >         priv->can_stats.restarts++;

What about that counter? Also move it into the no-error case?

Marc

> > >
> > >         /* Now restart the device */
> > >         netif_carrier_on(dev);
> > >         err = priv->do_set_mode(dev, CAN_MODE_START);
> > >         if (err) {
> > > -               netdev_err(dev, "Error %d during restart", err);
> > > +               netdev_err(dev, "Restart failed, error %pe\n", ERR_PTR(err));
> > >                 netif_carrier_off(dev);
> > >         }
> > 
> > 
> > Nitpick: I would rather remove the first message and print the
> > affirmative: "restarted"
> > 
> >         if (err) {
> >                 netdev_err(dev, "Restart failed, error %pe\n", ERR_PTR(err));
> >                 netif_carrier_off(dev);
> >         } else {
> >                 netdev_dbg(dev, "Restarted\n");
> >         }

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux