Commit 717338e2 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

Merge patch series "can: m_can: fix struct net_device_ops::{open,stop}...

Merge patch series "can: m_can: fix struct net_device_ops::{open,stop} callbacks under high bus load"

Marc Kleine-Budde <mkl@pengutronix.de> says:

Under high CAN-bus load the struct net_device_ops::{open,stop}
callbacks (m_can_open(), m_can_close()) don't properly start and
shutdown the device.

Fix the problems by re-arranging the order of functions in
m_can_open() and m_can_close().

Link: https://patch.msgid.link/20240910-can-m_can-fix-ifup-v3-0-6c1720ba45ce@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parents d0fa0640 2c09b50e
......@@ -1763,11 +1763,7 @@ static int m_can_close(struct net_device *dev)
netif_stop_queue(dev);
if (!cdev->is_peripheral)
napi_disable(&cdev->napi);
m_can_stop(dev);
m_can_clk_stop(cdev);
free_irq(dev->irq, dev);
m_can_clean(dev);
......@@ -1776,10 +1772,13 @@ static int m_can_close(struct net_device *dev)
destroy_workqueue(cdev->tx_wq);
cdev->tx_wq = NULL;
can_rx_offload_disable(&cdev->offload);
} else {
napi_disable(&cdev->napi);
}
close_candev(dev);
m_can_clk_stop(cdev);
phy_power_off(cdev->transceiver);
return 0;
......@@ -2030,6 +2029,8 @@ static int m_can_open(struct net_device *dev)
if (cdev->is_peripheral)
can_rx_offload_enable(&cdev->offload);
else
napi_enable(&cdev->napi);
/* register interrupt handler */
if (cdev->is_peripheral) {
......@@ -2063,9 +2064,6 @@ static int m_can_open(struct net_device *dev)
if (err)
goto exit_start_fail;
if (!cdev->is_peripheral)
napi_enable(&cdev->napi);
netif_start_queue(dev);
return 0;
......@@ -2079,6 +2077,8 @@ static int m_can_open(struct net_device *dev)
out_wq_fail:
if (cdev->is_peripheral)
can_rx_offload_disable(&cdev->offload);
else
napi_disable(&cdev->napi);
close_candev(dev);
exit_disable_clks:
m_can_clk_stop(cdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment