[PATCH net] can: rockchip_canfd: stop bus-off restart before closing the device
Cunhao Lu
1579567540 at qq.com
Tue Oct 13 06:06:21 PDT 2026
Hi Marc,
> AFAICS this is a systematic problem and should IMHO not worked around in
> one driver only.
Agreed. I initially only noticed the problem in the Rockchip CAN-FD
driver and did not consider the common CAN code.
> netif_running() tests __LINK_STATE_START, which is removed in
> __dev_close_many() prior to calling the driver's ndo_stop().
>
> Can we make use of netif_running() prior to calling do_set_mode(dev,
> CAN_MODE_START)? from can_restart()?
If you have no objections, I think it would be better to put the
netif_running() check after the existing !priv->do_set_mode check and
before netif_carrier_ok():
if (!priv->do_set_mode)
return -EOPNOTSUPP;
if (!netif_running(dev))
return -ENETDOWN;
This would preserve the existing error precedence for devices that do
not support restart.
> can_bus_off() should not schedule_delayed_work() if !netif_running().
Agreed. Although this would change the behavior of some drivers, I think
it should help improve stability.
> We still have to call cancel_delayed_work_sync(&priv->can.restart_work)
> from each driver, though.
I can make changes to the other drivers. However, I do not have the
corresponding hardware and would not be able to test the changes on
real devices, so I am concerned about the risk. I would like to confirm:
do I need to audit and fix the restart behavior of every CAN device
driver?
> What do you think?
I will address these comments in v2. Thanks for your review.
Regards,
Cunhao Lu
More information about the linux-arm-kernel
mailing list