From patchwork Tue Oct 29 08:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3606 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 C1F043F360 for ; Tue, 29 Oct 2024 09:47:30 +0100 (CET) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a9e0574854dsf148334066b.2 for ; Tue, 29 Oct 2024 01:47:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730191650; cv=pass; d=google.com; s=arc-20240605; b=YlEmX3Ff2q4IP2so9FI3fEExO89yPICyeZzWS6/xWv4Lxxh3/JYjtolfNxfJan5jBY ktXuuVuxuzCicaC6A6NflHDdSDXuYHZA2YAqVCKdHQPOFVbazdsciqQcacG2kNbPIJJC yh8Um0AX4qEmPJhgwaNO35EOJqaMmUXGKobLAW7jGdEW9d+8x2eNm4e31dIGB4+W7SPU kFf4sclJkzLXse9TSXciWjFFyAjsPlAa/92pxg6tnHZUUM2F6jHLdDb+wRxxeMoktt/b 0XzzVxj7Xa8WpCEvIoSsNxXN6SvYXgk4sErzdbSb11CM7g30SxH2FcnmtypsUZheyEKq VN3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=gg+MJ+TSXe+D38k4ka9t8hLRXdWlGTxIx1sYbRyRMV8=; fh=kAcwznDRUVf6+LptFR3mlCYT+/f9OsGTubZEGKRcruw=; b=EwnR+w3DoRPwANiflbrozAI7IUDBfSVnnTEWGNQxYzUsfNhCg82IaiSXV5a4ot5nQo 3dRq6JWCkV92k4zGcwlK7EfXkeN9Vf4hOXCOr3zS6XYLdKOAkmWChMoKTJ4E5JlFt/qZ QBuJ4VHWf5j/MuIW/EXCZ8ynR/3DBEYCy1rnUTKE0hv5/w3wiln65nsjELzVZXDMBYJL rHveAOdVG2rAr9y/9NQNO2ushp+cbejVDJcxLEYDhiqH++LPpNdwXl8I+iRqReKRHMJ6 eqjO9Lo7XI3JgPRpUmTJ5wuLd/GQeNm7wQRKzU+Z9m0UmbMEkNXCJgq/zTf327yFkh1g 7pXQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=T4fI6TK4; 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; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730191650; x=1730796450; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=gg+MJ+TSXe+D38k4ka9t8hLRXdWlGTxIx1sYbRyRMV8=; b=K7slLe6oeke2A2j/qrsWbafHZcQmMEjtj5sKoHzSlKRtFbhJz2MHzbYjEV3cSL6Z6w Tcyz+IpifDzABUYGsTJYZ5mNtEq8Y11n9JBLUUtTSBRWnw9tBT9sSaHfI/B8JZ2sgCD7 bJ6mWSZUiDL3nEiox9WxJEa8jjiaYJmVl/Pwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730191650; x=1730796450; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gg+MJ+TSXe+D38k4ka9t8hLRXdWlGTxIx1sYbRyRMV8=; b=GE7KJ4Sj5ll9N2/UpmTz+10wQbXlFvMw77QBhdXtrkrZNwLXrbOSmgBjEKxvITf/TB zAnVI63RG9hpxRTUMy4KV5yp/D7famDh1yfGDxPlOd2TZOv6oQWeLHiI2WcM6+A/W09Q yCMIz8EGhYwh6Ih6sN9pcJ1k0kuINkm/ynM7fyCE2PIAdv6JKzZpVC2+c68D3Ah/DUHN dCRWf/ONn94KHB92PUWP+66jJpfYmUCy1Tx+0ERE+dNa4QtuDt8sfU7YF0P1bso95tQ1 NsTW0LxHc/L69ITjYCV01UM30q81xWvfG7DHiH0aT4QZIHgRGZ0vypU7aRq9rErhW2Vs KWKw== X-Forwarded-Encrypted: i=2; AJvYcCUQK7gJHZj2NgGTrG+Uig/tmB4a7qRnbPHzoLGvbMA/oL/nTjRYyixnUBmUxD1ld7cZgHI/NGRe9wZAh+2I@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxXwylhFz+P1P8dGAOLP1Kar3uWTj40MMulCZjdbi9S7gRMLkh+ z8/ddi4XE+EnaSqVwVSvtyORWOnfsNVFv1ldfZxKdXI8Cy2hZ10B6mmGmCX3R3kXqA== X-Google-Smtp-Source: AGHT+IE4+iEmRrrxmEqdbiLnxyzQLeWZT3zbKmkra+9nsN/YX2wGes8H+sW9k2BqqrP4EmazeJNELw== X-Received: by 2002:a17:906:dace:b0:a9a:38e6:2fdf with SMTP id a640c23a62f3a-a9de619bb45mr1071787866b.64.1730191650264; Tue, 29 Oct 2024 01:47:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34d1:b0:5c8:acf3:1296 with SMTP id 4fb4d7f45d1cf-5cb999fd8e0ls531828a12.2.-pod-prod-03-eu; Tue, 29 Oct 2024 01:47:29 -0700 (PDT) X-Received: by 2002:a17:906:6a1d:b0:a9a:4f78:b8 with SMTP id a640c23a62f3a-a9de5c922c6mr984904666b.2.1730191648728; Tue, 29 Oct 2024 01:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730191648; cv=none; d=google.com; s=arc-20240605; b=h3r3SPdCUw/irN1yqbp/O2S10aY94MWJF8TvyEmiYAb/GNPZAw1WIsBH8h3684nh8I 7YBYCKh1ya/1Yv08mC1LgzYhuc2esEkYdosX/1pV9iF/LcmkRS8kzlLYy12TZzpHr8Sx 3pjqxDxWU/4zmG45EzRS9dNCx1NedcDPnXSq0fE63LCVZujVHnjdrUFwuW6k1TwJbj5a uDTUN82QGj5u6Ej/dihJnAVgKFSWd0moZZ2D+LBAsWSOmYVvqYTNdWcYCJrzjDdX/EP+ 7/usV48cY/mUz+d4u4f5Sg2sdXf3D09skTwkh517XW317ioQ7V373j3uTZEJWU1YxwWJ gKxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=CK//WN8U4xdL+REXrdvFlQyVdfbEwHB2hFl4Gz57z6E=; fh=FeUWJrdb2mnsUU1M2Yj5gKiGdZHsuZcwDxPV0cEnyco=; b=KFLki/T3t9HrV18Uq0HaqS5pixn2p+H0QQM6eofVKNJjec7lDU8TLt+2M3OPECDIdK kyQC/CgC0UXcRQLss+dEE+itQZNSXVJzwx8ioqlgvX0xhaMBHKF48BgHkRzJHfm0yIIi B1+zf3D/S7oNWl/9FLH2BSeZ/Pm60AfsqwIybEz3/qwQKhZ/dSow7/y256nDhPvVBN/F JBEALvcOJG/jKASbaKWbBxWqbMq+UVdDTEIuqKvTE1iF/K0OjwlNz/i+qho3BjIq20Sl 3UABrukJlSuE6JDHYTLG0cjpqOu0y5VN+AVRIRBvnm/igh7OFHa1sGT8wXw6RdPFtV6v 8ZlA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=T4fI6TK4; 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; dara=pass header.i=@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 a640c23a62f3a-a9b1f0679d3sor366180166b.12.2024.10.29.01.47.28 for (Google Transport Security); Tue, 29 Oct 2024 01:47:28 -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:2d93:b0:a9a:3f9d:62f8 with SMTP id a640c23a62f3a-a9de5ce1831mr1160141666b.19.1730191648241; Tue, 29 Oct 2024 01:47:28 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-40-68-117.business.telecomitalia.it. [79.40.68.117]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dec7dacsm450134166b.9.2024.10.29.01.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 01:47:27 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Frank Li , Haibo Chen , Han Xu , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Rob Herring , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH v2 4/6] can: flexcan: use helpers to setup the error frame Date: Tue, 29 Oct 2024 09:44:48 +0100 Message-ID: <20241029084525.2858224-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029084525.2858224-1-dario.binacchi@amarulasolutions.com> References: <20241029084525.2858224-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=T4fI6TK4; 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; dara=pass header.i=@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: , The patch replaces the code that directly accesses cf->data[] for setting up the CAN error frame with the appropriate helpers. Signed-off-by: Dario Binacchi --- Changes in v2: - Replace the macros with static inline funcions calls. - Update the commit message drivers/net/can/flexcan/flexcan-core.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c index 790b8e162d73..85a124a31752 100644 --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -828,33 +828,31 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) if (unlikely(!skb)) return; - cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; + can_frame_error_init(cf); if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { netdev_dbg(dev, "BIT1_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT1; + can_frame_set_err_bit1(cf); } if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { netdev_dbg(dev, "BIT0_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT0; + can_frame_set_err_bit0(cf); } if (reg_esr & FLEXCAN_ESR_ACK_ERR) { netdev_dbg(dev, "ACK_ERR irq\n"); - cf->can_id |= CAN_ERR_ACK; - cf->data[3] = CAN_ERR_PROT_LOC_ACK; + can_frame_set_err_ack(cf); } if (reg_esr & FLEXCAN_ESR_CRC_ERR) { netdev_dbg(dev, "CRC_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT; - cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + can_frame_set_err_crc(cf); } if (reg_esr & FLEXCAN_ESR_FRM_ERR) { netdev_dbg(dev, "FRM_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_FORM; + can_frame_set_err_form(cf); } if (reg_esr & FLEXCAN_ESR_STF_ERR) { netdev_dbg(dev, "STF_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_STUFF; + can_frame_set_err_stuff(cf); } can_update_bus_error_stats(dev, cf);