linux/drivers/net/can
Marc Kleine-Budde 6b6e986864 can: flexcan: flexcan_close(): change order if commands to properly shut down the controller
There haven been reports, that the flexcan_close() soradically hangs during
simultanious ifdown, sending of CAN messages and probably open CAN bus:

| (__schedule) from [<808bbd34>] (schedule+0x90/0xb8)
| (schedule) from [<808bf274>] (schedule_timeout+0x1f8/0x24c)
| (schedule_timeout) from [<8016be44>] (msleep+0x18/0x1c)
| (msleep) from [<80746a64>] (napi_disable+0x60/0x70)
| (napi_disable) from [<8052fdd0>] (flexcan_close+0x2c/0x140)
| (flexcan_close) from [<80744930>] (__dev_close_many+0xb8/0xd8)
| (__dev_close_many) from [<8074db9c>] (__dev_change_flags+0xd0/0x1a0)
| (__dev_change_flags) from [<8074dc84>] (dev_change_flags+0x18/0x48)
| (dev_change_flags) from [<80760c24>] (do_setlink+0x44c/0x7b4)
| (do_setlink) from [<80761560>] (rtnl_newlink+0x374/0x68c)

I was unable to reproduce the issue, but a cleanup of the flexcan close
sequence has probably fixed the problem at the reporting user.

This patch changes the sequence in flexcan_close() to:
- stop the TX queue
- disable the interrupts on the chip level and wait via free_irq()
  synchronously for the interrupt handler to finish
- disable RX offload, which disables synchronously NAPI
- disable the flexcan on the chip level
- free RX offload
- disable the transceiver
- close the CAN device
- disable the clocks

Link: https://lore.kernel.org/r/20201119100917.3013281-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20 12:06:46 +01:00
..
c_can can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
cc770 can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
ifi_canfd can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
m_can can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
mscan can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
peak_canfd can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
rcar can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
sja1000 can: drivers: add len8_dlc support for various CAN adapters 2020-11-20 12:05:14 +01:00
softing can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
spi can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
usb can: drivers: add len8_dlc support for esd_usb2 CAN adapter 2020-11-20 12:05:14 +01:00
at91_can.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
dev.c can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
flexcan.c can: flexcan: flexcan_close(): change order if commands to properly shut down the controller 2020-11-20 12:06:46 +01:00
grcan.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
janz-ican3.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
Kconfig can: slcan: update dead link 2020-09-21 10:13:16 +02:00
kvaser_pciefd.c can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00
led.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices 2019-07-24 10:31:53 +02:00
pch_can.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
rx-offload.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
slcan.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
sun4i_can.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
ti_hecc.c can: replace can_dlc as variable/element for payload length 2020-11-20 12:04:12 +01:00
vcan.c can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists 2019-09-04 13:29:15 +02:00
vxcan.c treewide: rename nla_strlcpy to nla_strscpy. 2020-11-16 08:08:54 -08:00
xilinx_can.c can: rename CAN FD related can_len2dlc and can_dlc2len helpers 2020-11-20 12:05:14 +01:00