Skip to content

Commit 717338e

Browse files
Merge patch series "can: m_can: fix struct net_device_ops::{open,stop} callbacks under high bus load"
Marc Kleine-Budde <[email protected]> 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/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
2 parents d0fa064 + 2c09b50 commit 717338e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,11 +1763,7 @@ static int m_can_close(struct net_device *dev)
17631763

17641764
netif_stop_queue(dev);
17651765

1766-
if (!cdev->is_peripheral)
1767-
napi_disable(&cdev->napi);
1768-
17691766
m_can_stop(dev);
1770-
m_can_clk_stop(cdev);
17711767
free_irq(dev->irq, dev);
17721768

17731769
m_can_clean(dev);
@@ -1776,10 +1772,13 @@ static int m_can_close(struct net_device *dev)
17761772
destroy_workqueue(cdev->tx_wq);
17771773
cdev->tx_wq = NULL;
17781774
can_rx_offload_disable(&cdev->offload);
1775+
} else {
1776+
napi_disable(&cdev->napi);
17791777
}
17801778

17811779
close_candev(dev);
17821780

1781+
m_can_clk_stop(cdev);
17831782
phy_power_off(cdev->transceiver);
17841783

17851784
return 0;
@@ -2030,6 +2029,8 @@ static int m_can_open(struct net_device *dev)
20302029

20312030
if (cdev->is_peripheral)
20322031
can_rx_offload_enable(&cdev->offload);
2032+
else
2033+
napi_enable(&cdev->napi);
20332034

20342035
/* register interrupt handler */
20352036
if (cdev->is_peripheral) {
@@ -2063,9 +2064,6 @@ static int m_can_open(struct net_device *dev)
20632064
if (err)
20642065
goto exit_start_fail;
20652066

2066-
if (!cdev->is_peripheral)
2067-
napi_enable(&cdev->napi);
2068-
20692067
netif_start_queue(dev);
20702068

20712069
return 0;
@@ -2079,6 +2077,8 @@ static int m_can_open(struct net_device *dev)
20792077
out_wq_fail:
20802078
if (cdev->is_peripheral)
20812079
can_rx_offload_disable(&cdev->offload);
2080+
else
2081+
napi_disable(&cdev->napi);
20822082
close_candev(dev);
20832083
exit_disable_clks:
20842084
m_can_clk_stop(cdev);

0 commit comments

Comments
 (0)