[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250813-tiny-bird-of-painting-999c89-mkl@pengutronix.de>
Date: Wed, 13 Aug 2025 10:09:51 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Stefan Mätje <stefan.maetje@....eu>
Cc: Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Frank Jungclaus <frank.jungclaus@....eu>, linux-can@...r.kernel.org, socketcan@....eu,
Simon Horman <horms@...nel.org>, Olivier Sobrie <olivier@...rie.be>,
Oliver Hartkopp <socketcan@...tkopp.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 6/6] can: esd_usb: Avoid errors triggered from USB
disconnect
On 11.08.2025 23:06:11, Stefan Mätje wrote:
> The USB stack calls during disconnect the esd_usb_disconnect() callback.
> esd_usb_disconnect() calls netdev_unregister() for each network which
> in turn calls the net_device_ops::ndo_stop callback esd_usb_close() if
> the net device is up.
>
> The esd_usb_close() callback tries to disable all CAN Ids and to reset
> the CAN controller of the device sending appropriate control messages.
>
> Sending these messages in .disconnect() is moot and always fails because
> either the device is gone or the USB communication is already torn down
> by the USB stack in the course of a rmmod operation.
>
> This patch moves the code that sends these control messages to a new
> function esd_usb_stop() which is approximately the counterpart of
> esd_usb_start() to make code structure less convoluted.
>
> It then changes esd_usb_close() not to send the control messages at
> all if the ndo_stop() callback is executed from the USB .disconnect()
> callback. A new flag in_usb_disconnect is added to the struct esd_usb
> device structure to mark this condition which is checked by
> esd_usb_close() whether to skip the send operations in esd_usb_start().
I cannot find the reference anymore, but I remember that Greg said, that
USB devices should just be quiet when being unplugged. I removed the
error prints from the gs_usb's close function, see: 5c6c313acdfc ("can:
gs_usb: gs_can_close(): don't complain about failed device reset during
ndo_stop")
regards,
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists