From patchwork Wed Jun 8 16:51:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2035 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 758CA3F1F7 for ; Wed, 8 Jun 2022 18:51:36 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id k21-20020aa7d2d5000000b0042dcac48313sf15341547edr.8 for ; Wed, 08 Jun 2022 09:51:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654707096; cv=pass; d=google.com; s=arc-20160816; b=b2rZSXMHu5cNMrAlHgEpdNYnX+czg3B5NFqgQm4+gJoB2fGe0FiQqPN4wTfV+cTl6n K20JDvdZxCrNw19i3X5Nr9jXNaAc4aEyPB0hQjcOhl2OaxkrGVQMjev6/b+0GOBkAbYb xlm2hYCa06MGAn0/e+reoRqBiWC4upzC77PbP1Yflx4qmVUSpWU+O0rnwe02ZcnjlVTl Ba/KkZC6ojJ8VEiYBtP/wC/hx59eoGkc85UGsjkYAKHsBuNNO/2ZPBe1j34gbiFkqjV7 iBjPZSTNlCgFB7m9AxB6XNkoRcaxUMl0UTZ+iD4Z8KqrNVxNIcU42q+MM7uzFlUxdOS9 6ZWg== 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=X6ymUjLhFwGvdk+Dpc68mkS4dqByCGPE7VoI8tna6dY=; b=xnPvnlHdLnAdOG0qvweaYujFy5ecO6xyToWiAu10oKPJucs33yBkgq4aIEbVLtEoEg Y/OtzQBsjtYxGC5CN2b/0YPykiwfDAF3TdhbXXWACBx1kzlNQ/lkzwvF4+EP9Z86Y/AD evVpq8et0Lf7it1GGWtGg/c7A69xCQeQO6UMhpCahIGCzPJkyJ0W62ZxlWzufBuQlF44 g35p+eqOLpVvFYaNessExqkMG6FNZOBX9+4+nuXTr9no9Z7ck1zzqb94wOzhsifSL0H5 gJ2kA6F60yMPfs/Z59cYfIv8K6PlE1ELpmBKU91FkHJ4Kd4ob3DrCcAkjYePavRTIIqu rzCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MZKbWtEN; 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=X6ymUjLhFwGvdk+Dpc68mkS4dqByCGPE7VoI8tna6dY=; b=jtrJN1yb7f5ym1qcLrAELzHnBvPti2PArl7ViylDjAjDSALENZlSpi74NM8AULu9V0 pQ3AhOvgADOpZU++kjkmHZ1ne48hH4roKCMXD8vfTmIXNWNSUb3mfiv3ctuRr6qk4WRi 0VErk1YTch326CDgmsawtDInAeiivqIkTE/iI= 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=X6ymUjLhFwGvdk+Dpc68mkS4dqByCGPE7VoI8tna6dY=; b=Xe9XzBn28M8JxVf+HYWDIykVQTrJeI+QrFGItzOdesWDR2j/glLoS1++UyjdcnmXVR SE70YNiNG/tXn5P7mml/iESybSeE0XjgU+oCOU7IHdflt2ov55wxzcw1iw2JK2v8KAko S2CwQaUwdPff8VIXJGuCDH6fCXpSYnm82Wh4yp7zKenF6vuo+G6r3GbNo8N/D8PZkgNT oISEBxqx4WTwk3FBahpFNvlUnd5V4qtOzFbeH5D0aeZ8QSBiMLXXYBhI0IPPeBWvf6fH jt0UarazWEITi3z6eNMlAcu2lkdWKvpHGGkNvhOPQ+slAmsxS0YO9Mk6pbYF5qrM9ms6 +jbw== X-Gm-Message-State: AOAM531XM1KjI6OscXmZPQLg54KHNuqTc8B9HWNs2L5QxrBRioqxLyaE gVlDQarv0XbQ2E9BNO8fMp3Y4k01 X-Google-Smtp-Source: ABdhPJx4RnvqWKUubTO1oNeid/vkFB91WlQjd8lVYcpbZIap/q0dSvSc9t+Ou5CLitfgks/d6MyeNg== X-Received: by 2002:a17:906:4356:b0:711:cd0d:b205 with SMTP id z22-20020a170906435600b00711cd0db205mr16361226ejm.240.1654707096315; Wed, 08 Jun 2022 09:51:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:7f91:b0:704:cf38:c76b with SMTP id qk17-20020a1709077f9100b00704cf38c76bls1239134ejc.11.gmail; Wed, 08 Jun 2022 09:51:35 -0700 (PDT) X-Received: by 2002:a17:906:dc8f:b0:70e:5e7a:cc59 with SMTP id cs15-20020a170906dc8f00b0070e5e7acc59mr26540203ejc.423.1654707095330; Wed, 08 Jun 2022 09:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654707095; cv=none; d=google.com; s=arc-20160816; b=VPhhkuWVkPhIakzf4WnNlDly1YKnR2j5fIA513ed/aLH6WK9ts3v15j16XDTKaJKUP Y+Wm4oOmo2VRSl2JWw/EXpllIMra/239MFH76B78VkjpA0xO+mWJ41bcuRFg30bxyc+x 7eU0QKMzpiqrPF37N/6ojQoLVEfN+jWMIBb+yo4K3ADXRN5R/jfW2JJOGXc4O2UPK88j swsS5QzToLbCFeF8mdbwKYIJ7ywYeUtICf5nluIQIQE9JTlDyY3tOgnC5RcEDJm+4S16 rg4JC9cHkEBCsNWYKBTVLCcT9JFDxyrGlouwmqx5zh2vJOh0YmprwMz94A5guv2ehaLQ z4rA== 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=IHEZAJdjR8GiF2rcZjyRDsrMR8WF0LYSErHxMnZ6s20=; b=TMb8Ulwdlmn6+dkqDAzo1wSUJJbx46XgEQ9qqhZDzmIlK+sVo+aEGQt6a+MxCdxOs4 SN0ip9v5RVScyq9S9s0SKRk3yAckZYyyzjtleSDKN0a/4Cfgcn+bhOjVAg3Vgdadamq+ MFPuTic2a7UBczvmU1L0oPdfwe/dC+7F6lm+dMNKIByfEOJ2nSZN1ClPxf0EEiWFEnUJ 8KW497R/c880pcON7XnjyvfoFam3dAlKdeJQRIgSoWZ98Uz4L/gfRHQ6AG7v9v3D4/ov LEzmrsa6BPEtnhEKlFF5M4iZDqp3CKnPsYK3UX408EY/idWZ5BZZYnEYf8WCvOh5ZU/P MOOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MZKbWtEN; 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 m23-20020a1709060d9700b006f3afcd1b7bsor9484383eji.115.2022.06.08.09.51.35 for (Google Transport Security); Wed, 08 Jun 2022 09:51:35 -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:a17:906:4a83:b0:70b:156f:9098 with SMTP id x3-20020a1709064a8300b0070b156f9098mr31951137eju.109.1654707095099; Wed, 08 Jun 2022 09:51:35 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-116-90-174.pool80116.interbusiness.it. [80.116.90.174]) by smtp.gmail.com with ESMTPSA id c22-20020a17090654d600b0070587f81bcfsm9569071ejp.19.2022.06.08.09.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:51:34 -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: [PATCH v2 08/13] can: slcan: send the open command to the adapter Date: Wed, 8 Jun 2022 18:51:11 +0200 Message-Id: <20220608165116.1575390-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608165116.1575390-1-dario.binacchi@amarulasolutions.com> References: <20220608165116.1575390-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=MZKbWtEN; 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, this patch changes the driver to send the open command ("O\r") to the adapter. Signed-off-by: Dario Binacchi --- Changes in v2: - Improve the commit message. 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 8561bcee81ba..ec682715ce99 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -461,8 +461,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) {