mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "baozhu.liu" <lucas.liu@siengine.com>
To: <mkl@pengutronix.de>
Cc: <wg@grandegger.com>, <davem@davemloft.net>, <edumazet@google.com>,
	<kuba@kernel.org>, <linux-can@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	"baozhu.liu" <lucas.liu@siengine.com>
Subject: [PATCH] can: flexcan: simplify the calculation of priv->mb_count
Date: Mon, 4 Nov 2024 16:47:05 +0800	[thread overview]
Message-ID: <20241104084705.5005-1-lucas.liu@siengine.com> (raw)

Since mb is a fixed-size two-dimensional array (u8 mb[2][512]),
"priv->mb_count = sizeof(priv->regs->mb)/priv->mb_size;",
this expression calculates mb_count correctly and is more concise.

Signed-off-by: baozhu.liu <lucas.liu@siengine.com>
---
 drivers/net/can/flexcan/flexcan-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 6d638c939..e3a8bad21 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -1371,8 +1371,7 @@ static int flexcan_rx_offload_setup(struct net_device *dev)
 	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_MB_16)
 		priv->mb_count = 16;
 	else
-		priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) +
-				 (sizeof(priv->regs->mb[1]) / priv->mb_size);
+		priv->mb_count = sizeof(priv->regs->mb) / priv->mb_size;
 
 	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX)
 		priv->tx_mb_reserved =
-- 
2.17.1


             reply	other threads:[~2024-11-04  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  8:47 baozhu.liu [this message]
2024-11-04 10:31 ` Vincent Mailhol
2024-11-04 10:39   ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104084705.5005-1-lucas.liu@siengine.com \
    --to=lucas.liu@siengine.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®