[PATCH] can: dev: clean up CAN ctrlmode when close CAN device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CAN driver always writes registers according to "ctrlmode", and now CAN
framework will keep CAN ctrlmode after device closed.

e.g. with following sequences:
1)ip link set can0 type can bitrate 1000000 loopback on
2)ip link set can0 up
3)ip link set can0 down
4)ip link set can0 type can bitrate 1000000
5)ip link set can0 up

After this sequence, we may want to test loopback for the first time and
not to test loopback second time. However, CAN device still keep
"ctrlmode" as loopback on.

This patch intends to clean up CAN ctrlmode when close CAN device. We
can set which ctrlmode we need when open CAN device again.

Signed-off-by: Joakim Zhang <qiangqing.zhang@xxxxxxx>
---
 drivers/net/can/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c05e4d50d43d..4f69a8f16ba3 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -870,6 +870,7 @@ void close_candev(struct net_device *dev)
 	struct can_priv *priv = netdev_priv(dev);
 
 	cancel_delayed_work_sync(&priv->restart_work);
+	priv->ctrlmode = 0;
 	can_flush_echo_skb(dev);
 }
 EXPORT_SYMBOL_GPL(close_candev);
-- 
2.17.1





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux