[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220607094752.1029295-9-dario.binacchi@amarulasolutions.com>
Date: Tue, 7 Jun 2022 11:47:47 +0200
From: Dario Binacchi <dario.binacchi@...rulasolutions.com>
To: linux-kernel@...r.kernel.org
Cc: Amarula patchwork <linux-amarula@...rulasolutions.com>,
michael@...rulasolutions.com,
Dario Binacchi <dario.binacchi@...rulasolutions.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Paolo Abeni <pabeni@...hat.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: [RFC PATCH 08/13] can: slcan: send the open command to the adapter
In case the bitrate has been set via ip tool, it sends the open command
("O\r") to the adapter.
Signed-off-by: Dario Binacchi <dario.binacchi@...rulasolutions.com>
---
drivers/net/can/slcan.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index f1bf32b70c4d..f18097c62222 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -469,8 +469,15 @@ static int slc_open(struct net_device *dev)
* can.bittiming.bitrate is 0, causing open_candev() to fail.
* So let's set to a fake value.
*/
- if (sl->can.bittiming.bitrate == 0)
+ if (sl->can.bittiming.bitrate == 0) {
sl->can.bittiming.bitrate = -1UL;
+ } else {
+ err = slcan_transmit_cmd(sl, "O\r");
+ if (err) {
+ netdev_err(dev, "failed to send open command 'O\\r'\n");
+ return err;
+ }
+ }
err = open_candev(dev);
if (err) {
--
2.32.0
Powered by blists - more mailing lists