Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1386040iol; Sun, 12 Jun 2022 14:56:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZH1CsCziRVrYg4ne+Mw38TxqQhLad2O574wiz6shrtbAn7xGaEuUQFYlHw7k0aRyTNpUq X-Received: by 2002:a17:90b:3701:b0:1ea:9f82:59ef with SMTP id mg1-20020a17090b370100b001ea9f8259efmr7192719pjb.239.1655070991289; Sun, 12 Jun 2022 14:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655070991; cv=none; d=google.com; s=arc-20160816; b=SYbnNa2b43k+ECdN6+XthC8e9qSxICUSiR+7I4Po6KUNyh1zLxDKXwDA6ADi0/lW6w 1AmAiftAAVjh2uCSCSrvFWTfnNwTGEdyidqVUOfBT0406V9JrYizGGAShJzVBoxwDLsp 8R2HH1NzUPj2XW+/whvs0Z+X7Vi4OCw5hAdHzVTEJnTl8vv8Sr/xzCQwg5SMJeakwAxy ttdKWUoztJG19BpUm9C72UUiPDVu7rMoRKKQWqgos9p2uK7dhfUTTWhhr4GzPmnVSa/J BVMz1T5FzCgf7IbwzXhArMIZt5uNQ/YHqB6Jx0xAIKlS/iN9wCfmx9qutPdqcJRafMEe mGaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AAKaIth+G/AmEuzfr70Dsvzk4FxXYLQFFVrvRHhl0zE=; b=SV9P77Ix3xcuUpvSRMMsvGCds20mzTI9bihMQ8SgoZynM8JCAc8vGK9rnbMDdkPpA1 S/dN55vpCjXFWJ8EZQ1MhA0hzSVfvdULCywncZOQyXpmVUVX09xqPtTcAVDLAdb8zJSh cSnC2ml4H6lKlmK8qt/H4kIZY9q6OdA3Gdog+ohT5SDQSztoI6n7qzM0cBbjGku8kTJK yOa+oMbBFbiN8Bc1nu+J64tJ0EOGVHeu882RTBuR5K/hKyG08Gx8BjnWShykWDNiFHQO XUa9dzorn3Idt15g7v9da0ekPi0x6KQvl0Z+VzBhktuVkuqoS1rYeyAExkjCuBkxy0yS ylpg== 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 linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h128-20020a636c86000000b003fd7b18c39dsi7331192pgc.854.2022.06.12.14.56.09; Sun, 12 Jun 2022 14:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Qr//VDTJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236780AbiFLVlE (ORCPT + 99 others); Sun, 12 Jun 2022 17:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237117AbiFLVkV (ORCPT ); Sun, 12 Jun 2022 17:40:21 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA8542A724 for ; Sun, 12 Jun 2022 14:40:10 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id kq6so7662738ejb.11 for ; Sun, 12 Jun 2022 14:40:10 -0700 (PDT) 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:content-transfer-encoding; bh=AAKaIth+G/AmEuzfr70Dsvzk4FxXYLQFFVrvRHhl0zE=; b=Qr//VDTJlM3yW6NMOsV6Ote3kssYtDIpQaISCw/bS+xF96jzFDXuevaWjaTtWkVcSK vYCwdE4iWIVd8vDsjmjwW5ejgo2/mhUw09BsmMuB+Nxt2mmnRL+VB8nLL30uTe4MXkU7 dRU9p68g51DFLMOdk5sBrL8dgNnxp5yqS/Aec= 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:content-transfer-encoding; bh=AAKaIth+G/AmEuzfr70Dsvzk4FxXYLQFFVrvRHhl0zE=; b=KtggBO25YFZzGakH4RB+PY4arLQe/2vz8mlCXWfO0zy8dJdSFV6ZPBnsXsY9Xr3YST 44A9NVovMbhZcBjfLa+rVh23vFtzswQIaDMSP01qpuwFx0EB7bVZqYJSouy/QMKg4U71 wouw1vDKo9DXWl6NIIB5rzZl4JpIXBK0xTmnYDPefEGrSDJ5Rx2HAy8OnLMVoenFdHgb YZG/RfqwnLsTKYqd3ZTT0rW864L9pUeUAvbslS8956sONnsuyk/ZBqhzMLu3STmNz8Gu QtWIPFzWw908283tKK5c0NRd2QwYWiPEgUjJbsimkFASDbCMqop7o6u6I/XjVKzojSiA 61IA== X-Gm-Message-State: AOAM531qbgzQmLtwYsdYPrzlg4HmCaNYjUxe9VPCydQoZZ0nusT13lGy ImhmG0Vp0IXNOWanLNDRejmrOlpGAQM1qA== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.32.0