From patchwork Fri Oct 11 16:23:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3569 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EC55641586 for ; Fri, 11 Oct 2024 18:23:49 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c9452d6344sf818144a12.3 for ; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663829; cv=pass; d=google.com; s=arc-20240605; b=dOkKedZswimWy2/OmpI/ku1i1DQw6qFLYAzWbzke3I38/GY4w+l3zpGNoaLUHF9LPm GXP7Tl5PJ8qej8GbbFMAoTHszO/Q31+NLYYtdSZ6U+IoqNRAuph3Vr1xxWk93SdI17Ab +Lq5xqGo2dncCihFj9vZjObcAjvKsbHldBKHcfRMivSsMNKV1tCO8YyMbeXKj3CRpjcm echu3GJXuSOly0/rgBbkG2O6yfVTVwimWkcKfj4uIulWxB9ZuuLIPQp+t+9SjE+QdegK DxrYwjDq4ZHWbfPQctKgu21XdbQQKyZTBrzGNkB9i2jL6hGB9ckXja013u5iveh9VeBP OXTw== 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; fh=0pNUiW1Yr7RzCm+ma9G7TV0Mb5S49+ciu3zWgTDbgxA=; b=HzGy2GF55KUEeUYUYSU4gi2VKVRECzcbd9VjwrKSvx9eNg8BdM0nAvisNqdWllsACp sKa/C2j6fUGBHdyc3DU5GOzezn1i5pmYCqIl5tDnJZLSCD1uRp7m/0jtsnc9WCEHK63i OIg67893CrAvzGRQoB64nV+6z2B7yHWSHqM+2Ru3mSwWWDfkcMl59Dl7zjXNary9kgZW SKJOatUw/4jyGLQhRyhJspZ9Hrhx5mcrqFb3e6Ujyi4CEnvUwSlttHQ9SG3tFOW4to6j ekShC/ZvsZpwbSjsIY8kBox4ko+FdJ48MzRwP91hAIiFrf+OUN/g1zhG6GmuFPQIpb/E msqA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hkAvJf2Y; 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=1728663829; x=1729268629; 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; b=EBuOi0VL+4FAM9T7hSJ0f2EEC3GkGmj30SWCOt1fDyyziHqWe92H0bhygjI48PeoNk HyFAKdzj5OrDTWjWc4VjbP4lvKf8TMb7pnSpcZg56v3FBshiskAskCEUpVHCIjDswdMz BZZ8AewVvy4zlscicJ63SeZPiRGLUCPX1Pqxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663829; x=1729268629; 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; b=q6mYigyl61Pt5nZosKv0ogdduYsT+fWYnX/ADms/JbZkK4bssYxITiYTWWtcjZQk3p IxIU/ze8w0SFOD+0E5p9AfMnrWv0sU2/RSjUqx1tOIiNCQVcpJ9NvkrSHw4HFQvdPn7l 9BmNfuRXjo/2Aliikg2m+X7j6xDyReHNC5EZo3G84NQLjauhYcKiS85JqB8jt47h2hn4 u1p6yp9+tQW773l6XekB3tCLAeHWs7D2kWhzCETZMD5ZyVlaqLoza5EGYqHtLQyZUhnr 49dqjWDJjw95FRBohZHrd15f22r6NjZI7749T4pCOKDySAlnHV84okH8YpZ32tKcm0nB DVuA== X-Forwarded-Encrypted: i=2; AJvYcCXugYhuI9Ik4Hhu3rkzXCsEdQXlgkAmXqc0GAcRFU82mNmGxcBlQjxoRdzGz5+MBpKzqkopUR2Usqsepxkb@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxFLSi0JxaHAqh4sZi+iiI8gX3ObI/13fvInyIZJPQ5ghARc6h6 NaY3QgdgQ2WdY1LLFX+7W52VpTfzCnP540HAm92QEQXUWX4PJDUA8zJaw1gzpddDUw== X-Google-Smtp-Source: AGHT+IHg2o95vBnwwRHpnF/XUL1Axl2jPUxyuVK4z3wVo+Btj/K3mMg2vmQpitaq8SSFTFgmUPWqgg== X-Received: by 2002:a05:6402:5ce:b0:5c9:3f2:15fb with SMTP id 4fb4d7f45d1cf-5c948d4a129mr2392996a12.24.1728663829239; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2683:b0:5c4:6c19:f742 with SMTP id 4fb4d7f45d1cf-5c933d473cbls242842a12.2.-pod-prod-02-eu; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) X-Received: by 2002:a17:907:d2e8:b0:a8a:4e39:a462 with SMTP id a640c23a62f3a-a99b943bc4bmr267023366b.7.1728663827596; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663827; cv=none; d=google.com; s=arc-20240605; b=SFf6yIu/KC73Udx4HjjfEeNJDQrZwpLfsFFzVrD/Io96h43W/hxYPbppXA+wkYwYFK 7Wqobse6S4loSVbg0mxLdYdQmH/cOfJamvxDKgJ4ZQce+3cJNmTa35xJt8BvCaRln3PV PlMWIl7lxAvMU+kn9UXxIZCCmk84petuRdb64t84ZPHmK5aTwm1itzfI0+Lj9RRUpZEN osnfy2pNpw+Ah73j6KxpBp+cRazuQ+n7/cAfkxB3yU3wq3l7Co4F+I6X56P1aZtdpmFR vQSkAz3s8KTLWWbgrrtK5pFnj4DeqzcPq6cz3b+2LzYon68PxlrBiYfcbzhXlagaVIlI PvSA== 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=d6+BtLEOvVaPgyhiafPGcVcII/P+adzXivzmieD9IXo=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=ZMXhSgXpg3af6fcvJSIF4DFP1ltZMASCoh/bvUm5nNj+PH4sVfX6SmQGe8nM/qAFqd gJ6qUUw2m3UwB0tZmSsN3gTNaLbQQhwysUtHCIe8X/HsO3xMzVqbmGeRtTHUQcd6UZD+ CWXkh3CJcFty38NozwhthmoFnHPBz1RfCcEu2YoGK86UW/7NYYsOaKG9yBjCMSmQK0my AsuiM+ysToAO8vT3uBn40wmKiHg/UoffyWxpSfa531sWgm5jhgQq9PF7PjZ7cKy2APdz g6vgQ2X0caDoh0Ny6yGRMQgKvRDGBoW236Wf87wauGazdeaqZfhxfo8lcE6j5JbGXm6V LW8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hkAvJf2Y; 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-a99a80c01f6sor141826766b.16.2024.10.11.09.23.47 for (Google Transport Security); Fri, 11 Oct 2024 09:23:47 -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:c14c:b0:a99:53cf:26bc with SMTP id a640c23a62f3a-a99b96b0c3emr314189866b.44.1728663826967; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:46 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 4/6] can: flexcan: use helper macros to setup the error frame Date: Fri, 11 Oct 2024 18:23:39 +0200 Message-ID: <20241011162341.606443-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=hkAvJf2Y; 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: , Signed-off-by: Dario Binacchi Change-Id: I129dbe666df6e8ad6edf8ecf4fc3e5a08e8f6c13 --- drivers/net/can/flexcan.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index a67b1a26200f..416d60fe59e2 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -580,33 +580,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);