From patchwork Tue Jun 7 09:47:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2021 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 276843F08A for ; Tue, 7 Jun 2022 11:48:27 +0200 (CEST) Received: by mail-wm1-f70.google.com with SMTP id c125-20020a1c3583000000b003978decffedsf12540170wma.5 for ; Tue, 07 Jun 2022 02:48:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654595307; cv=pass; d=google.com; s=arc-20160816; b=DT3K2gTlgd3ps/7xtb2Vm01NVgYJJULfE6hcZt8PjkREPyLiER/Ov7UtfamhE9MIvh M6e5MRhtHrNMbTFnYyEAg5iC3LT+dL03T4Ax6nT3HDYt0YwNIRsgCdoKw0rRp6qq4YTq XuMmUbmlsGKj3S6ACTLVghpMPDh41FiwdbtmHvg4pnB3QbwCp2l4Bqwncca3Mm2MmkCi 40+qw0fQvWehJ56kATLteyxHGOCdiAdqEjLjMUuZZS2vFk/KBoQ9zgM+LA+gk5Rv9SP1 kXIjAbbUg0tMaYPkbtXrHaq1s1ZXV5z+r88hrZsevZDfCSSelluOnt36WBXOo6qU1vw8 Waiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=c4yBXzsmJqxSalAFXVCEvDVnZaVmriB3T1+3R5lD/L4=; b=NGgjKXaybGg8z41fVp0EA/EgMxuOmiAEijYT0oUDh+9+N3UX52esiImNH2t0+Hxn5+ DxVm3LEKXyn6MKZf1jCZk1wYuGR7JNTZgyYSm8QjfLX1hxVBc1vi1V6BSQfZqmyiexWJ 9f1Ur95dTvsax72J/nGtpw0zDbtXe5a4l5qMnTqihn0bCNgCe/vnD4tOwwg6HhefIGVo ujoPn3cl/XERlGHlrPro+k9rT5s7kQKRfRnG1GcY7R+31AgqZK/W4rZmgpHyCi5zjgip pmC2r7LbGXMUImrfyydDmY956AuScvoBatVV1KNcRewdE7d+dC8vTvgwV7DTBTwN7Fkr seiw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evbcgwrL; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=c4yBXzsmJqxSalAFXVCEvDVnZaVmriB3T1+3R5lD/L4=; b=lwXf6qzAB+/tFe4L5D7iLaJwhycgnlnHNFDbV6nzYZdYfEuOaD53DAlJvw7nVrM7W3 bxxzX/GEG3hwDQuIL6gtliwvQYvJ7NxxJuXH92eFr0Moi8XRb697Iy4GJ2c+94NSko7Z p4lsYneW4tf/4MRvV4+5jqFB/5A+msGFmB2hg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=c4yBXzsmJqxSalAFXVCEvDVnZaVmriB3T1+3R5lD/L4=; b=lfKdh1fOtscknleNN2kQfp5Mm1qEH11HQP8i2EzglVCu1cwzUzsNk/WTxZEi2rGxph MsQEDHot6oL4Et/5IfR0BJhI0fmikv2otyNNSicA9ODWGHoSzvbSVhK0kVQCNTivGIct Q21Dpq/cBQykTqx6IJgxuMF2CJphEUBQK5oqPaNkzGJ99lqDuZ1MqvP3V/FbJ03QqT8c VRZ0yp9kN/XTDZBlruI+oNAYzmqcfz2THg+fS2WQ5BC5te7glX7UIcFhY3Vt1Jk/S8vA v592ulOzLcCjiVg6EB1V7xYJxY1msF3krhb8KpTt5wbMRRSpiLrkvgsX76Me+2oKiEEc vKbA== X-Gm-Message-State: AOAM531Ql0CqBR6TmZEwzjBo0yy3cIvPkETOdBBkS1lj+d27nhkG+Guf 24ZqXLkqZ6qTzZzy5xTvxabNKpOP X-Google-Smtp-Source: ABdhPJymTygIXR2ctZShY/hKGwnrm9MnOoye8sByEiVvpdKMTCtck2HipU5cbjqldRvygzsK/Q40bw== X-Received: by 2002:a05:6000:1e0a:b0:210:32e1:3b03 with SMTP id bj10-20020a0560001e0a00b0021032e13b03mr27298822wrb.642.1654595306770; Tue, 07 Jun 2022 02:48:26 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3d8c:b0:39c:5b80:3b5c with SMTP id bi12-20020a05600c3d8c00b0039c5b803b5cls393723wmb.2.gmail; Tue, 07 Jun 2022 02:48:26 -0700 (PDT) X-Received: by 2002:a05:600c:17cf:b0:39c:4b79:78c9 with SMTP id y15-20020a05600c17cf00b0039c4b7978c9mr13508560wmo.96.1654595305743; Tue, 07 Jun 2022 02:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654595305; cv=none; d=google.com; s=arc-20160816; b=BAlze7DAjm2uHLyNan7ZlA9o1VFVDujR+dQo2CKRxVFsEEPzkY6vNZdawsYgeKTqBy SHwI/3JiWjCgjskHtM8yn3NTGGZI/w3ECrguS4jep0Dw8lfEfFP5YWpV5vLvg115LdbI aMnuDP6+MpORT/dMB6EHhgEK+NEuP79FKvht1OtA7dlMhE8V4pfUqRTY51nWLg5hFRKr bNx+7fUk/Sdzx/hay0z7pZ2h+T2CPhiGImKABfvrQlSXH7mvhbPxY6wCoGL6H/rdXZLT HmRzSj3tZLDh57iaBgANVrRqRtcpH4gCWbGTZd3SJiwUTC/PGqhybjKxH+MHrs2d14XW 2VKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=cXpKooudMy6rrQwP/L+KMO1DefLsV+CIObJk2wvPyQY=; b=1AQJ7CMNC1Y8yoeq49VFwtbEt16KQH3eodGnOLyNHQd6cEvAMwq4r4o/DtEw7kbZIr qdKgKsllI99BBrUlFcG+CV54U7pwwPHRfcGZQbv8ykEza/hTMQDKni8FouUaDc8cIbrO PlJyiORhLRMP4LqqXfd8/rLEdFyDEispUkrosQQrxfFQpa2Qu/hlhNUqiKjjsV1C4YFL n701XxaQXZBhAxGQm2xUel4uLx7GrzMSZ78UpETJ/xiOpie8oa8kpjZw2aV4hxskK+Hj nTZvyI9ECPkudO9ShQT5NNVwPz5Y5Z4ZvDDsXjk6vIQ8lb1o8RMprke/b0oR7df6VRvv Z7wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evbcgwrL; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id j5-20020a5d4645000000b002101f6cfa8esor9661733wrs.80.2022.06.07.02.48.25 for (Google Transport Security); Tue, 07 Jun 2022 02:48:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6000:15c7:b0:218:4a5f:75bf with SMTP id y7-20020a05600015c700b002184a5f75bfmr4603612wry.94.1654595305547; Tue, 07 Jun 2022 02:48:25 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (mob-5-90-137-51.net.vodafone.it. [5.90.137.51]) by smtp.gmail.com with ESMTPSA id o4-20020a05600c510400b0039748be12dbsm23200547wms.47.2022.06.07.02.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 02:48:25 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Amarula patchwork , michael@amarulasolutions.com, Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 08/13] can: slcan: send the open command to the adapter Date: Tue, 7 Jun 2022 11:47:47 +0200 Message-Id: <20220607094752.1029295-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220607094752.1029295-1-dario.binacchi@amarulasolutions.com> References: <20220607094752.1029295-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evbcgwrL; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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) {