Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp72978pxb; Thu, 21 Jan 2021 01:21:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjVh8SfTjJHYMiPG3u8vmfD6J/+NVZTBjyIBzYSLgPreoVxNQGffbbsdfU9vA9CwRtoa/U X-Received: by 2002:a17:906:2a06:: with SMTP id j6mr8206944eje.164.1611220896440; Thu, 21 Jan 2021 01:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611220896; cv=none; d=google.com; s=arc-20160816; b=SFnCnhgyvS2iyxk4o1QXSMIUz6h64zJRlfgRId9xlDpDPsFVOb1COHQU/hMkNtPU4A I33ItH5Cp2BUF85chd9zlQPzrs11mVC2+wxqKsKvJJI1xDTw29inzc5Sw3gvkx0+MUoU pAO51mMkYz6i1ZWi/ZqNtE88dmKmDnXGTE59m/f2mJ5zUEQnKPzs5Kc9/gmFaync2HGj KdzrOJzDIk0+f1aYV1tVMEpBfERqWrFkaKSdN9aF7QtLW7GcViyWX9E/a0zBIbiY0nDW N+1krcpMKLxlzpcf+liXqJdT+qT11mxdi818E2NjFaLQveoNL6JqdmsvMwNBDM9V8G53 90Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+h3XO1KHkOJ1WE2lVC/8D0t/DmItYejrYEfvh5uWFfA=; b=coFUG7gAW8uuZrupxH3BMHbI6dM1VEDm/v5yEJMVdX2OY162I4XUqF28f8YW4tTulR Mu8swcPrgI6Tmq7v4cwfUfuZ/W++cO7Ty8E2z8Mm+R8uxY/Du7qNrKtKbmyemEYKKD8V 00S1HbwPL3xTJ3g/53BPs58txoXKsWusdloNs4q+9wZEHcUljzcNSbMN+3U36/OcGtx9 6Zap0da15ySf+tPCheWiTNvujW+N2JPlnfJANrynxQi94M8T0iwTqjKInP3p4PPiGGCi oRQJ5JhCZaq/BP8hDAaifhUbaFM7QAeoBClGv7ZFFycH9//V9K7h1JyxHJAB8K2eJ0ae ymSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="CefFG/UZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js1si1552765ejc.88.2021.01.21.01.21.12; Thu, 21 Jan 2021 01:21:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="CefFG/UZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728466AbhAUJRK (ORCPT + 99 others); Thu, 21 Jan 2021 04:17:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbhAUJLI (ORCPT ); Thu, 21 Jan 2021 04:11:08 -0500 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 063A3C0613ED; Thu, 21 Jan 2021 01:10:28 -0800 (PST) Received: by mail-qv1-xf2d.google.com with SMTP id l14so584653qvh.2; Thu, 21 Jan 2021 01:10:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+h3XO1KHkOJ1WE2lVC/8D0t/DmItYejrYEfvh5uWFfA=; b=CefFG/UZeDEyOZR6R1hkPmmASHVpA8OFOj2xdj3iY7d4oQ5ctaUKOQLkEisCJrPe/+ RK8rKKh0qkgfztY9mZ9gj82lD2fPGlkmWJPhilA2HvvYnxCBwF8o0VI5fWuE/GX2sYnw M9ja4/mLLTugc5nmForFBjElcVeFsQQdC+mLclAN6Rmukt9wUtRMp+VAQW2zZK5E5iFM wraCd8m4gBTEmDYMjzUn1fm/4ukVUEm8zZB8srJtU6ZYFoOXeAjw8UE6HzZiZNFRj4oT 0z8AMM2uSB/bA48XUdFEGtLjWXw8IadTltZ36zdh7fj2Xa5XeR0UvUGT66aGrPet04B5 YUJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+h3XO1KHkOJ1WE2lVC/8D0t/DmItYejrYEfvh5uWFfA=; b=OUne90d4yzOGoIBc6ya9683FC3PcchXV5+cRpFyIP3/zr+LRm55Cu2smnu2ago/PZ8 PgYRTsDr7G9Y85lpdUbSQnGJ0hGbD92KG26By2kcnzbPSDoBf8X1C9U0mw8HGORT2rn5 +5oTBDKyJOTHSnGjoJ4yZCMq/Gh2i+HqCf9uuvBnqQQ+u0l0pVWoZxCZQJRBHBGsIv8f qMK6kb8EkEPHAPe2+G+sxlQvr1NSA0Q2YdvAMmv4xVkhGDEUfAX+k+63oPc0xQUMtPED GMp0QDkF47AjFnq6PapcV5BoMHB1J7zNTHfxLB3syc+M2+BpsUNG7Tqr70j+KSPHJlTH Uz5w== X-Gm-Message-State: AOAM5310C+cbXHswyS+Ih/YlJlYDlc16tmZ7WgTJoKZW9X35MGMdEpe3 10GuZibc0g7pBhuSvxWcStk= X-Received: by 2002:ad4:5187:: with SMTP id b7mr13655408qvp.2.1611220227359; Thu, 21 Jan 2021 01:10:27 -0800 (PST) Received: from localhost.localdomain ([45.32.7.59]) by smtp.gmail.com with ESMTPSA id b16sm2903733qtx.85.2021.01.21.01.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 01:10:26 -0800 (PST) From: Su Yanjun To: mkl@pengutronix.de, manivannan.sadhasivam@linaro.org, thomas.kopp@microchip.com, wg@grandegger.com, davem@davemloft.net, kuba@kernel.org, lgirdwood@gmail.com, broonie@kernel.org Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Su Yanjun Subject: [PATCH v2] can: mcp251xfd: replace sizeof(u32) with val_bytes in regmap Date: Thu, 21 Jan 2021 17:10:05 +0800 Message-Id: <20210121091005.74417-1-suyanjun218@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional effect. Signed-off-by: Su Yanjun --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index f07e8b737d31..b15bfd50b863 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -181,6 +181,12 @@ static int mcp251xfd_clks_and_vdd_disable(const struct mcp251xfd_priv *priv) return 0; } +static inline int +mcp251xfd_get_val_bytes(const struct mcp251xfd_priv *priv) +{ + return regmap_get_val_bytes(priv->map_reg); +} + static inline u8 mcp251xfd_cmd_prepare_write_reg(const struct mcp251xfd_priv *priv, union mcp251xfd_write_reg_buf *write_reg_buf, @@ -1308,6 +1314,7 @@ mcp251xfd_tef_obj_read(const struct mcp251xfd_priv *priv, const u8 offset, const u8 len) { const struct mcp251xfd_tx_ring *tx_ring = priv->tx; + int val_bytes = mcp251xfd_get_val_bytes(priv); if (IS_ENABLED(CONFIG_CAN_MCP251XFD_SANITY) && (offset > tx_ring->obj_num || @@ -1322,7 +1329,7 @@ mcp251xfd_tef_obj_read(const struct mcp251xfd_priv *priv, return regmap_bulk_read(priv->map_rx, mcp251xfd_get_tef_obj_addr(offset), hw_tef_obj, - sizeof(*hw_tef_obj) / sizeof(u32) * len); + sizeof(*hw_tef_obj) / val_bytes * len); } static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) @@ -1511,11 +1518,12 @@ mcp251xfd_rx_obj_read(const struct mcp251xfd_priv *priv, const u8 offset, const u8 len) { int err; + int val_bytes = mcp251xfd_get_val_bytes(priv); err = regmap_bulk_read(priv->map_rx, mcp251xfd_get_rx_obj_addr(ring, offset), hw_rx_obj, - len * ring->obj_size / sizeof(u32)); + len * ring->obj_size / val_bytes); return err; } @@ -2139,6 +2147,7 @@ static irqreturn_t mcp251xfd_irq(int irq, void *dev_id) struct mcp251xfd_priv *priv = dev_id; irqreturn_t handled = IRQ_NONE; int err; + int val_bytes = mcp251xfd_get_val_bytes(priv); if (priv->rx_int) do { @@ -2162,7 +2171,7 @@ static irqreturn_t mcp251xfd_irq(int irq, void *dev_id) err = regmap_bulk_read(priv->map_reg, MCP251XFD_REG_INT, &priv->regs_status, sizeof(priv->regs_status) / - sizeof(u32)); + val_bytes); if (err) goto out_fail; -- 2.25.1