From patchwork Thu Jun 2 16:04:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1993 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 23C943F1D5 for ; Thu, 2 Jun 2022 18:04:48 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id bt15-20020a170906b14f00b006fe9c3afbc2sf2698612ejb.17 for ; Thu, 02 Jun 2022 09:04:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654185888; cv=pass; d=google.com; s=arc-20160816; b=IOTDxRcAc6Y0CZDeZcp03kdG4/Bmqa+1gqHxL/46hBD4XYU/2joSbXl6qa2xVHokuM bHovi8yABFp47ORey6vMN65UtwEDfoO9HonIjBnWjKRbksn4wPs5Opb5KjjmIyKBcWAV AFF69g67C90OKjMTgvffP2v9Y4AO9jQhZPUqXIAI2cUGP3/X7hYQXUNZpZag2kmbfBEG YsUkSr5Op2fsrm8avZpaRgv8dOj+OKxftg2ni8fboi1F48P1qKcWDMDrLTxhfoKsw7tP 4JPRVMnDP8efqxPdR0M9uJNjdj59ZkVVLdqtfAYVRvhPX+liDsn96iT0Q0adzBLa6yrf 9uSQ== 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=gXRu1B3Vr6aQRB6HppiYd3pdw3btgMng1UOrWgCWEyI=; b=ThRxrIsEUyyUF3kLXTy1PLqHmr1FZHSAgUEv+jNuREEtpeRQ4VMwqWdCpiBQOR8+wn 0E9KnU65pGrK+ov1rVs4OomCffFmgspJfXH4P7F69XDbsDG8GhAhw3ZLCztGdN1BMAra P+xPnNtSKSw4z9gvaRo9/CP5NPbbceZdr0kgmwmnDZPDEwgdKWOcsMWdF7Jbt8xm7PKL phukH0Ot6Kb7Pl6eX4XARgpX64DvLr0xv+bvGBabpU8KmIaKZq5nyPSCFbCQU8xL8EZi U0qSTuH0g6B9GjKA0L+gKjxuAQUPITZuJBv6E5E2cs13pmiipxzlj8+vXhk7G+MDWuHT oHlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=q5UzCBl6; 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=gXRu1B3Vr6aQRB6HppiYd3pdw3btgMng1UOrWgCWEyI=; b=ZXQKIsb+loqqG/hsMXB4cxCogBwSNJNvWLWvFhG7rXIvPkqQd9k74Ex/XD/symDzXJ UjwdzWJyq2oTpyHxVUawOPRJCVdBNZiWJ3AFGfRdW5RCoMTL4HJmwSNYg4rWoXRaiw8P KDWNvqAX4veCIp9qpSDD99ZKKdQqU8qwt7R+k= 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=gXRu1B3Vr6aQRB6HppiYd3pdw3btgMng1UOrWgCWEyI=; b=RfA/tIICIpfiGFkTSj0HtuAExAjvC0tsQt/hvoqLFY0J7hXQbfRWkeP39o36VxKgMV GZnXItbVUeSQM75eeqeQ5CJf7uGIVgy5QL7iIdLVzLHI9HhTB0FUpgHNilu9sSNB/Jp6 S4cnp+tcX5jNtWDHi5iN/bmJwkjuBAt/mvJ9Qh/D9X4KdaXpCFHKeA+a9u2lp2EE9LAo CswKHAlUilQYmSNmVB5xP2yeTsQroS3l8wiZbtvPsGnuRzkpepAsD1skvaiNX4sGrQqg 6v5n6cqzqfstmwIC/OLE/UYcKRpnvtGrOVTl+wFYIjtJ92yrwnZK+XCGn/FhmB1utBN/ JtwQ== X-Gm-Message-State: AOAM533OJi98px231+il+zYYn/9DtGLjdsYH8ZHldiRZtmReDuTbvo5+ EepC8a/8tonKNbwT8yTw89i5XAYp X-Google-Smtp-Source: ABdhPJz1x0MDp1k1xLnczcyYiosNx7WSCbd6x8zHn4K6je8RuDgQoB370z5BudIHUekM5Hv4ZeXr8Q== X-Received: by 2002:a17:907:969f:b0:6ff:2027:3c8c with SMTP id hd31-20020a170907969f00b006ff20273c8cmr5098972ejc.31.1654185887944; Thu, 02 Jun 2022 09:04:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5205:b0:42a:c2bb:3d7f with SMTP id s5-20020a056402520500b0042ac2bb3d7fls2363404edd.1.gmail; Thu, 02 Jun 2022 09:04:47 -0700 (PDT) X-Received: by 2002:a05:6402:5242:b0:42b:729a:f89c with SMTP id t2-20020a056402524200b0042b729af89cmr6283931edd.5.1654185886762; Thu, 02 Jun 2022 09:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654185886; cv=none; d=google.com; s=arc-20160816; b=gam8HNKgQW2Og6RUL4TIKQiR+YLftm2VVwml2pKsluAfLaxLuUr10ZuFNAoTZZ3DTn SvP35iyqttvrOlKtmiT+XxLG7BWSbtdfre1dJCy0rBtAV/7tWM6JexTZsFbmMNFXqLjS yol1xmwuu/LEioGV8B6HZL7nQZXRGmNgkBeSy+vpv0vG+7qwtvHcuaREhPxw9CO2zmKD dPPngqoh+mu23MCXj4KLE6frGdvVK/LH+sKJRMCp8XFryGgDK8uQx+tFL1JaYOmfSlEt fAlcm+BcHaHoW42dTdUembfy0+WQbQ92m3ftvkzjJoTRe0iBmUR9KCy0d2VlzUZT+a42 oiNg== 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=3luMHVxzafdMhwAtVLu7Y4ClLwrUkpqcy72s1ZUJoU0=; b=WYOLPpAupFgjjKMtFolQiHJYgdxG7W66BlyFIVPPUU6tq15JqnLbIf6j7EfBdGb3CC 8K4EwB2CCQKOlNshovGRZMQ6CEWMJgMycsFRUvQiCTCwF5VLg9PMJ5NWJwtnLbd0oGuR trzk+qxdUoJ0pd7Vo8so9SOiFTMJbRUDa5GNrbL5ltnJXuwdwjrLvXyIXr8H8muCrIuC CBD4KApXrJ95SjQfE8+yvXMfeaQQiNPu02eA9Fx3lqRcRZ+ypM9VEKZJkEgzKcMiieD/ mQRUA4YX11OMPevdx1HpEroPB/Kn4ufvIu9QBrWekNbKQmEPOFlOAJJhsUWCWWkqni0x D7IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=q5UzCBl6; 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 s9-20020a170906960900b0070afac782cesor1037848ejx.5.2022.06.02.09.04.46 for (Google Transport Security); Thu, 02 Jun 2022 09:04:46 -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:907:6d8e:b0:6fe:c382:1fab with SMTP id sb14-20020a1709076d8e00b006fec3821fabmr4878843ejc.483.1654185886241; Thu, 02 Jun 2022 09:04:46 -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 f3-20020a056402150300b0042dd3bf1403sm2637095edw.54.2022.06.02.09.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 09:04:45 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: dario.binacchi@amarulasolutions.com, michael@amarulasolutions.com, tommaso.merciai@amarulasolutions.com Subject: [RFC PATCH v2 08/13] can: slcan: send the open command to the adapter Date: Thu, 2 Jun 2022 18:04:29 +0200 Message-Id: <20220602160434.225417-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220602160434.225417-1-dario.binacchi@amarulasolutions.com> References: <20220602160434.225417-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=q5UzCBl6; 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 --- Changes in v2: - Fix the spin_unlock() path in the slcan_exit(). 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) {