From patchwork Tue Oct 29 11:45:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3613 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B1C483F380 for ; Tue, 29 Oct 2024 12:46:37 +0100 (CET) Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2fb652f40f1sf30238811fa.2 for ; Tue, 29 Oct 2024 04:46:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730202397; cv=pass; d=google.com; s=arc-20240605; b=AITulQ0jagjjnNE/rd4vSwgcR1+od2HmNzOW1jkWlAobCGCGpoNGTRkyVU4bdFWqkO 9AZ9l9lIz/CKmUti6tDJr36X0uEwgoYNEAhtkEIH1GbJg13DEtPMpVzhYeR/S73b4jiM Q8ZTvyeV/GcgHukUh6hDiSFEJAiFzsKiqjU6S1KrjthRYUADGm8eyONGFGPitX9/vbvT NapwM/tQi0F2HtyO/Wx01w9Yx+YEjdQUFOwDFkbSNskNSM9ecQuOix8KPsKE89PIBDkb 3EnPeBLEYX8JdZl7w2jif48VXwmHogO4Fx2MN5VGrUhWFPN56kKtdvVjeE75dGrV0GA2 oIMQ== 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=26iPgoH7SqpLp1gxhPmKHGw+jXCTQ+96lwpSps8WP0w=; fh=5r9pV6ubEtCnbA96U+zXSLN5nrK0spgBW+ApfSZEWeM=; b=hUzRkjfI/A50ycHbLXhIrgySHCnKAnWkb6er6CZRBJpKJydqAOOft8memmeZKkNBeF PzjOPubCGro7MoY6dP4WF/7edertUGcqv5TzGlehVoeU+xU1G8mQRqcJ1ghpPPD00NeQ t7P0S/Ww7QLO231lj7Jp9FXdCljWc9aSGt4tJAOMP+QOsxkhTKwFmCgPW/x1iS2sByef zxmt1hzg+nSa0DuhTKHKCppsRcwwKlqZjA7jdoRUgnd/oZlXI47ZLSHBRuJeJfwI7Acb w4GXB0udlfAOCfguPmKeNR8MMToCgFS7C0D9zc5RF6OGwbBNsLolCMTg9KKOSPBxsgpy Uddg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eixpdWdW; 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=1730202397; x=1730807197; 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=26iPgoH7SqpLp1gxhPmKHGw+jXCTQ+96lwpSps8WP0w=; b=YbVuUqHgn+jDHjuqHfJHWW+suD1UNxGtmGSfEA2rVFcQEsrxcL0il3O9rm3uieSvsS 6jb6XzoxI2lLdDbL+I8feIO/0eNZcS4ey1pmyRwx/E1QPXsX7GFhGDcAhaXLPD5ydenI WWcU11R+MVDm60iY0UCuvxnfLoN8YS+2nDn8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730202397; x=1730807197; 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=26iPgoH7SqpLp1gxhPmKHGw+jXCTQ+96lwpSps8WP0w=; b=uEbJ9hLOTny8WDwSuj40VRl8xnoIRP9/kespFrMaOSz1Lf/ROQDqAZjSHbDSrKArjK EtUyUfqmN9nZuY/SvGgoeUPrJANn4b9l2p/PpQajB2vMQ+giMtj/RuDpOJ8srEWSUQmP dCUWoph2716+WQuRHCtKV4xXSY2Ejd7SYlzqECBMUjRGCb5Apiqk9N9i9ql7rVZbA3eA 6/VavK2jtRzdW6ZT8g3Rcmtj8nodlguOV/EgR/f4u6UDLBV66XLLnom1WwfoOhVvej5Y 7G5VklP8DcfsTRhqvs4QuE93XT7FkdFvsp2LVY4brI7Lm1fs2HoBk3sql8oB2atrosbF 6iLw== X-Forwarded-Encrypted: i=2; AJvYcCUwLQwBwQPFbjEeSJOXRwrq4W73eL3sGkWbmJ0DinQdii6a+ZOZHmFBDrNCCMmN6HYEIL1TbPIPJqtz76rk@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzAyWdgrEX2zGW9xDOfZgIb/H9xh6c2QTZJ9q42xFnfEajoVSS7 p20AzLeRuAOSs5BgCPbu04Dbq0+o6TtpdAaVkNAlX/wwb26KOZpiHtLZ3Hn3cOXX7Q== X-Google-Smtp-Source: AGHT+IHRGEqaJ6uDqC4QL6wpdLNksOboNO/vgs0hACVOcasulNA7xPBt5C2YrP2oizpUd1LEiJpdJA== X-Received: by 2002:a2e:a555:0:b0:2f7:4cf1:d6b1 with SMTP id 38308e7fff4ca-2fcbdf66b57mr54326941fa.1.1730202396975; Tue, 29 Oct 2024 04:46:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4304:b0:5c9:3fa:8237 with SMTP id 4fb4d7f45d1cf-5cb999db1b8ls223755a12.1.-pod-prod-06-eu; Tue, 29 Oct 2024 04:46:35 -0700 (PDT) X-Received: by 2002:a05:6402:274b:b0:5cb:7318:800d with SMTP id 4fb4d7f45d1cf-5cbbf944389mr9579756a12.32.1730202395276; Tue, 29 Oct 2024 04:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730202395; cv=none; d=google.com; s=arc-20240605; b=atIN1AxClXy9C7v/8VssQLio4PSXIIPgcHkg1zaHGHhEG9ejcKGysMK2xV2U78+OA1 /0nuShInrno1LgYCkCTqIDlJdsu36jB6aA4+3t0XT0+QzFL3gF/H7aqACcnHON4q+rcQ 8xAJDtA7kdPzGU64zQ2caLPq3uFG5/egI5ZA9JHrOlcRx9IHMSWdXEeHqFpb5NrBtGet RmGHMWmKKe8bakuuuK18RSon+rCqPY/bPMVd5AHr6Vg85PRCU7qdugHQ9DOHdTEgWMDF 1DKJPYiatb6VuXhOWveHUIrSnm7QjmH6y+CLJKeIziu6euIchmoaIZxZzxoXqbi3zaIz kaXg== 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=7adbskWkIDNXIMmiplteQ28nVqw9eSy+g9bzGzeRhzI=; fh=AN9L5CoWavkH0m+VViOuW5WBipm7OLsuifxuoqHOyS4=; b=FDxAawv/3w+5gE69y9GgU+jUuxpjPO80cZv+uQF9JsazMv+GVmBAz/5g/+MJLEWXOb G8UwZ0yt//5czrJGzH+YsIUy0gDc2hf8C7+DjUJgG2Qv638Bu3sco9EFi2CZ8oi3ewWe qWlIQs9oqqlKBbdYRyymSxoGW3ByAKU93rk6e/vtKCxygBcRbp11I6XnX6vuY5ruSKr0 wv5Z0+3GjUJ/inYPp4mYgHQUvQFbBWDcpjvy/nvuYkK+2mRwSEDb9BfXvzFmzfnxEmq/ oQTKi/7gJK5U/FkDay57cmw/GwOjYjG9q0gaLJmENYOL7G38ip9CQ12edcycHDNXqWdV zddQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eixpdWdW; 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 4fb4d7f45d1cf-5cbb630b661sor2969790a12.10.2024.10.29.04.46.35 for (Google Transport Security); Tue, 29 Oct 2024 04:46:35 -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:a05:6402:43cb:b0:5cb:6ca3:af96 with SMTP id 4fb4d7f45d1cf-5cbbf8acc32mr10238323a12.19.1730202394731; Tue, 29 Oct 2024 04:46:34 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.41.207]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cbb6297a09sm3869301a12.21.2024.10.29.04.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 04:46:34 -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 , 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 v3 4/6] can: flexcan: use helpers to setup the error frame Date: Tue, 29 Oct 2024 12:45:28 +0100 Message-ID: <20241029114622.2989827-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029114622.2989827-1-dario.binacchi@amarulasolutions.com> References: <20241029114622.2989827-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=eixpdWdW; 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 --- (no changes since v2) 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);