From patchwork Sun Jun 12 21:39:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2055 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7A0EB3F1DD for ; Sun, 12 Jun 2022 23:40:11 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id g7-20020a056402424700b0042dee9d11d0sf2939276edb.3 for ; Sun, 12 Jun 2022 14:40:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655070011; cv=pass; d=google.com; s=arc-20160816; b=tHvD6gOvknlb9wEiyyhMm/yh8pCab/qeybWrkULavGDMlpGlxEs56oKREZ9X+ZVCLY xPhu2BAu17mboX6AkoSadqAcnP/teY6SCFHZR/l+/rZCKyLr4mHc4gktEOqaBKXs4jjV CtQAa+C5JWdZ5HBbfJ7l7vm03JfoSI+O50Ju8ZjYrW2UrfSErl5Xt+TQDx1MvRYGqUNu r44Kz9dPqHkqGA7S3XueZqq9/KsIJ/XJGBLoS+D4FReYDMfzdk/3t8LiwvvnL90bFZ+T LspGwQca+6Dnr5rbxTeLDlNimFmHw5Ib3mKlMxmqOw+08EZQzPhV2WJHelmiX7nuDfNy fdzQ== 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=kdWAnxchTQLmIuV/UbAYWm2G8/u7Sjiwq3f/19nOh+s=; b=mZ7BZOfOueDKO2Lbs7xlIlz09coG7Ctiv/i/oFiaW2mhgDncz9TVNeQNtchGwb0oYL syD3VdKXmLeEzSOkfVXMkyJVGwaE5zwjOtIa4QltSyY+C50QUvWInNV5+Bmzh5oIf3eN VN4517toU29XcAMXoksza5NPJUc8U5g6vAT+YtWW/+IV12tcXO3TuxBW53r4Xbr04d3O MvCC4FSPnzOY+DbAgSbEkCe9IO4OPGQIhVuCkfdmMrykGleUZxV50NW2+osX+rn7DG79 LHWMbR42tBJQf0lByJL5pyjOZqq/nFl0/wBH8A1G4pq0Vw6vzYM+1AJb0PICvoRtK9vx Mesw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Qr//VDTJ"; 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=kdWAnxchTQLmIuV/UbAYWm2G8/u7Sjiwq3f/19nOh+s=; b=ZxWk/xlKJqr/3DRs1ONHAL6RTxEln6wOo6QwztKIXqailIkR9W91DPWs74BgJ/GBwm gnFjNhIwLujpGjHbVq+ny4P0cu4njS2SZ2OjrmKaKBcir9etFRJM3bJeciTI7lRYDCgz HxJUNtovv7JxyGd5kmk7viGa+gkB4kIRWpZX4= 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=kdWAnxchTQLmIuV/UbAYWm2G8/u7Sjiwq3f/19nOh+s=; b=61aGIDpqHcL5ca0Q3efAyEYWn0UKfVmo5TG+sq+dUE24IsGnupp30mZGuzLkEJRotK 0hySAznM80drZidImMq72nf9i8LDBonRNZN1NbZxZHdSwVb5X7nwk4iXxxw/CopUaKyW rMBHUYL562aLf42k23GwXdNloqHATlFKuR5WiAPLh2VGwcUqBS3iULYdOESoWQ+2sSoV 3yYbjVRgai4OuOmtqHLcM5rwJOjnPl2LOLlv4/kdjwPa1oNPxWb2o4bJ1qEm5jFNjTTg 3ICbGuJii6bFavJhPTxccuJn12PsDmy3JDAUnj8SaQmZLzUcgGj+4z+dvD1bDL33iwte bvmw== X-Gm-Message-State: AOAM530hLdJ/PWahPSDj9I+avUB1w1vSGNTP++yNQTI04SVtJNB9DLSY Lh72QqyQMUGfzBdMb0YGevavtGde X-Google-Smtp-Source: ABdhPJzQU7k3J/eEZ4wbM5JKhrSGrQWN+8DEvnF9Ujt1QKedom/K754xxrZZ7cw6biBNgNi/LQfpIQ== X-Received: by 2002:a17:906:5253:b0:711:ee52:764e with SMTP id y19-20020a170906525300b00711ee52764emr23124697ejm.171.1655070011367; Sun, 12 Jun 2022 14:40:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:9705:b0:70d:ff46:7086 with SMTP id jg5-20020a170907970500b0070dff467086ls1009757ejc.4.gmail; Sun, 12 Jun 2022 14:40:10 -0700 (PDT) X-Received: by 2002:a17:906:72d7:b0:711:f778:113b with SMTP id m23-20020a17090672d700b00711f778113bmr21182127ejl.625.1655070010280; Sun, 12 Jun 2022 14:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655070010; cv=none; d=google.com; s=arc-20160816; b=XBDFvCuqgYbAfniWwjKvGqN6QyFnGrb/nHPlmVA1jwJ4Z5Qw1Ykb0bxaBjVBjUgxrp JmMe255VgQLGTpkwiS+6cWgilWFTW9pZgC0RgjpeXeD2tT2kCRZGXP8Wny//IiDqznS+ mV14yPzw5wG/n1fE6/Af3/+/dnVcGb7ofk2u/u9xiwXecY4NiVMHUdp5TBTrNgt509sO /Y6nygOhSr7lpCioVzclg/l65CvV4HFUkinGL6HvHiMd8XWzPrEvxAvf1wxj4HHmKKuc yWGeSek9fE1tmvEpTxkDdN73+P1iLWDIqQMX/ea3qyuUVa/BIPBGcdKGQn9aDzjfeq9m BP2w== 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=AAKaIth+G/AmEuzfr70Dsvzk4FxXYLQFFVrvRHhl0zE=; b=cq+BEzSFVpzO3H0TP0TzivBi4cL2PWaODZNxPJIPk3oOxLPAZtvbdvrTW7hC7w/upJ 3C6cdfEykMpueijFtAbpZTPqknpm97NgJaLht13LYnuWKgFBqmTePXodEA+V8wL8acyJ L74ffYZJjH0+ahdkM9jYPL9Iy+oQEoyDiOGS9d/rpMwuxHtIPVEY2ToI93LRHFrpjSaV cdrZ4+dwLSs7ryX2+X90/86CaBCPxKyKNiycQ6jT3gCSmY4UFsDgD9p33VaMeCGVglxj JrcIxFVo21CApKzOKbf5BBTleMENJe64JhKHs8J7ymZAJBwGNfIJLG/HKYeRVGV9Km6H C63g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Qr//VDTJ"; 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 y19-20020a1709063a9300b006e89145b218sor1314899ejd.46.2022.06.12.14.40.10 for (Google Transport Security); Sun, 12 Jun 2022 14:40:10 -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:1c9:b0:712:1115:42a5 with SMTP id 9-20020a17090601c900b00712111542a5mr15154695ejj.662.1655070010102; Sun, 12 Jun 2022 14:40:10 -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 u10-20020a1709061daa00b00711d546f8a8sm2909398ejh.139.2022.06.12.14.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 14:40:09 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , 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 v3 08/13] can: slcan: send the open command to the adapter Date: Sun, 12 Jun 2022 23:39:22 +0200 Message-Id: <20220612213927.3004444-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220612213927.3004444-1-dario.binacchi@amarulasolutions.com> References: <20220612213927.3004444-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="Qr//VDTJ"; 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 --- (no changes since v2) Changes in v2: - Improve the commit message. drivers/net/can/slcan.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index be3f7e5c685b..9bbf8f363f58 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -495,14 +495,23 @@ static int slc_open(struct net_device *dev) netdev_err(dev, "failed to send bitrate command 'C\\rS%d\\r'\n", s); - close_candev(dev); - return err; + goto cmd_transmit_failed; + } + + err = slcan_transmit_cmd(sl, "O\r"); + if (err) { + netdev_err(dev, "failed to send open command 'O\\r'\n"); + goto cmd_transmit_failed; } } sl->can.state = CAN_STATE_ERROR_ACTIVE; netif_start_queue(dev); return 0; + +cmd_transmit_failed: + close_candev(dev); + return err; } static void slc_dealloc(struct slcan *sl)