From patchwork Mon Oct 14 15:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3579 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BF8E73F382 for ; Mon, 14 Oct 2024 17:24:50 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-539e7dc83ecsf1278053e87.2 for ; Mon, 14 Oct 2024 08:24:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728919490; cv=pass; d=google.com; s=arc-20240605; b=gHDSQZUrxzKp6Ove8g60rBupZDfMvIGcWr9eiCw5dfaCzJvypx9u0kMJdvvOTJCduo TFD1BYTk806ey6Hi2FUBjr57V1j0NRyVpuA7Q6pyq+4uMZoF33NYAWIhMs3bcEdHu7yY I70EmVuhaGH8Lkep1/5ipDtCle1yTf3cCSx85rwy5q8M97C+pO++INkLOWn7+45WA92n Abe8PmX6sZy3lESnKGT6qU4yTwCrKlyB35qKR3jf8AvChoiwpZPjGixIdFVt+dGIln7u JU8I2jqYHMNDFyrC3JWTTbbF0QTzkvp2zmOdz0a59qrM/OIr8gR72fs6+EvGRw0Zoh3N Mlrg== 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=iwdnFC3vnP41mR9clko7M3+nPlR25BAzxypGIl8ERDU=; fh=AUoyFMw4Om7Z8KdXtKpNlfEidlVe7DoGIfM4QgYoAQI=; b=ZQ2U/hmon0n3yLvR7QdudoUgnBCAM0QMbDukqhObO8MqgV8EAyJ3xM5GM5cGpuLGFN UrSDzDJqQWhaq6FdFen3DQHFMhvArhIlbpQuns9jXllRbT6OpLT1bG2iVoVYtlNKB0pM CTBPiC98r0Lv/bea/BHiZBxEE2qrYi7MsrGjaGHETBonLE1ijx1kJshU2gZ3kQBdHLSu UtNmM3G2wmVVsqJoB0+RHMFExw9P2Z1F7DLAhnSZtsbZUwo58rNGYhRaKaZrVjqIZKIu +tGIRTYYBgsrYzhloWdOowzUEuNmEzrTh3JuYIoM+nuBzJ2hSzhQmaE+4CdqkzjCD1Zh VrRw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gy663W2Z; 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=1728919490; x=1729524290; 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=iwdnFC3vnP41mR9clko7M3+nPlR25BAzxypGIl8ERDU=; b=DOx8npRLCq+MTRXveVvbJ7g1q9UEyisfG1pPL+b+FaeKATW68NhxxWk1ksKH7pZ+YM dGILi2QRQleLEpS8QcRe4FrmIuI8rJngfc2F6eDonu1ZTKxQfNb+Ied/9tJ3IPoLVLPm bA0Jwbfm+tHd2ClS3tBs5pGD/Xv7f0xC/qSI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728919490; x=1729524290; 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=iwdnFC3vnP41mR9clko7M3+nPlR25BAzxypGIl8ERDU=; b=By63Sqx0lP1YMOYZR5xGQ7UZUsQLnqycAVBYlF79dnFrSkzC9isMDbxnFnDz066DwT aZV/Ev/2CY7Wi0B502OQhlKX7tLZqV521lHEEec1psxPixA0LFagfUt58DKywxVjmdfx 4WVHL6l2UWk+v3FbtEX3/kGfJHYcOlYYubIrOujPCz0CsN9bkAKuhv5rWu4U+ndkzjBw L6NFHMhrBVmhnvRA44xTYVJU3dLw/uikJlyZdcEfs+GMRLulGTGCAIGduGL44GX5HVfw 7bjKaj8yL9vwBwuzFyOMSEokBjK5YGb0vUMYLr0X89D6aqqzfoTU8Om6weO5/dUOxpBv OJoA== X-Forwarded-Encrypted: i=2; AJvYcCXsvDbVI0b7QqGP7oF5tvEP2j6Y/JFpcoU/x/Ev3hb9R9dYXmdik3vZOiAwpRIwVgy1mahDaWEcgwPUb3dS@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzUXqX4lLgIT6E1lz75OJ13UDu48zoiyvoH2QYAinIVpJAv+GbP ek2PtJC9Dl4ZVixIAdnaUCgk5rGyyU1LLWaERuw3g7XqBvxs4Coihbj+IjmwWoMDCw== X-Google-Smtp-Source: AGHT+IHOB2vWJUwuFuJTK3FXROJC/rMNcCZ9IWqtzn259fm+h/fNuclA7gr/5bXG7oZTFFtP1EM+tg== X-Received: by 2002:ac2:4e10:0:b0:536:9ef0:d829 with SMTP id 2adb3069b0e04-539da565caamr5754029e87.44.1728919489957; Mon, 14 Oct 2024 08:24:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:544e:0:b0:377:2d98:7c90 with SMTP id ffacd0b85a97d-37d4823c5d8ls1091232f8f.2.-pod-prod-09-eu; Mon, 14 Oct 2024 08:24:48 -0700 (PDT) X-Received: by 2002:adf:ea8d:0:b0:37c:ccad:733a with SMTP id ffacd0b85a97d-37d55304285mr8305370f8f.59.1728919488420; Mon, 14 Oct 2024 08:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728919488; cv=none; d=google.com; s=arc-20240605; b=KCb3kITs/lr0M8H+thWvlQcUWmWPJ35D0o6EpCHNZdMxCF05vt8gzrZ0rJtNCLXX8A 3M2zZt+/HNSc+B9B3hFyIbw4pWfm0yjD/8Zzx0ZyJ2eieZHJlaQcumrDI0LjYKl8Lg7u 0QbymKDY2YERHg/6QSt6iVYid0gSflXW4DngpLiPR5bC1o9lYEwE1CbEVGNj3F4vknfr siZhAgOK2QzmTf4PhQl2QJ4ElQ2efdLrrhGdJJJ2pToN4ukHRiZoPTuKIPuO5Jy7Adin +SxBCT+edoiqSt7+H0bcBNTWAnmERkxY7RUVDQegByyJ9VHAUcL8+F3lMVWOtr42ePUu 0GMQ== 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=aYG5/yu0pXXht36spug+Xg/mIMYx6ohdGwedIw0qEKE=; fh=Jid8/Oyej7OOEmKUXpNOQAkY2aWd+afIoYehnXdDHyQ=; b=P0V04fqLB+pgGSKh81Sej2LqMoqzvYKG9VN0/o7TkvwgeUYqbXtCPyzl5zphEVg1iR TerbwP11ue1GMo70i64CxberQLHAmsQMXVqFRgLtTmA33Hgx7GzMSkrxAPUKAZkbJesc hRW8CZL4989P3lVsKlMbwyRqjYgyZPGjtHk0KOMpCeaJN88nQf77pDH3e52fe8rO4CzL H7gvGC96ChOdAAF39BCu2ZooZMbCXarVko7/V/dpuVAih6j+j1lL+1G6dEoaSH8EL1Df IbKjhU3UDQ4G9RibNHtS+IcJR4ssaCWENDfgW10drYmQ4eHiAvEen8jAbRhVtZLMdtLf 8b4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gy663W2Z; 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 ffacd0b85a97d-37d4b9a73e2sor1947952f8f.9.2024.10.14.08.24.48 for (Google Transport Security); Mon, 14 Oct 2024 08:24:48 -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:a5d:54c2:0:b0:37d:542c:559 with SMTP id ffacd0b85a97d-37d551b6a0fmr8141214f8f.18.1728919487917; Mon, 14 Oct 2024 08:24:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.133]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6bd1b7sm11629911f8f.37.2024.10.14.08.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 08:24:47 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , "David S. Miller" , Eric Dumazet , Frank Li , Haibo Chen , Han Xu , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Rob Herring , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 4/6] can: flexcan: use helper macros to setup the error frame Date: Mon, 14 Oct 2024 17:24:19 +0200 Message-ID: <20241014152431.2045377-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014152431.2045377-1-dario.binacchi@amarulasolutions.com> References: <20241014152431.2045377-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=gy663W2Z; 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 helper macros. Se hai bisogno di ulteriori traduzioni o modifiche, non esitare a chiedere! Signed-off-by: Dario Binacchi --- 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..ca620c8f028c 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);