summaryrefslogtreecommitdiff
path: root/net/can/gw.c
diff options
context:
space:
mode:
authorStefan Mätje <stefan.maetje@esd.eu>2025-08-21 16:34:22 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2025-09-19 20:03:47 +0200
commit37dc3ea4d2a21f3b0c474ae3aeebcfada6a29655 (patch)
tree94fee55dd226425857ae85217b6a9345eb456b29 /net/can/gw.c
parentc6e07521431ce6d45a0ea2d220df456a7785087c (diff)
can: esd_usb: Avoid errors triggered from USB disconnect
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. Move 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. Then change esd_usb_close() not to send the control messages at all if the ndo_stop() callback is executed from the USB .disconnect() callback. Add a new flag in_usb_disconnect 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(). Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu> Link: https://patch.msgid.link/20250821143422.3567029-6-stefan.maetje@esd.eu [mkl: minor change patch description to imperative language] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/gw.c')
0 files changed, 0 insertions, 0 deletions