linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: kernel@pengutronix.de, Dan Murphy <dmurphy@ti.com>,
	Sriram Dash <sriram.dash@samsung.com>,
	Sean Nyekjaer <sean@geanix.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [can-next-rfc 09/16] can: tcan4x5x: tcan4x5x_regmap_write(): remove not needed casts and replace 4 by sizeof
Date: Wed, 16 Dec 2020 00:17:39 +0100	[thread overview]
Message-ID: <20201215231746.1132907-10-mkl@pengutronix.de> (raw)
In-Reply-To: <20201215231746.1132907-1-mkl@pengutronix.de>

This patch simplifies the tcan4x5x_regmap_write(0 function by removing not
needed casts and replaces hardcoded "4" by appropriate sizeof()s.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/tcan4x5x-regmap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c
index 8f718f4395c3..6345bcb7704f 100644
--- a/drivers/net/can/m_can/tcan4x5x-regmap.c
+++ b/drivers/net/can/m_can/tcan4x5x-regmap.c
@@ -38,10 +38,9 @@ static int tcan4x5x_regmap_gather_write(void *context, const void *reg,
 
 static int tcan4x5x_regmap_write(void *context, const void *data, size_t count)
 {
-	u16 *reg = (u16 *)(data);
-	const u32 *val = data + 4;
-
-	return tcan4x5x_regmap_gather_write(context, reg, 4, val, count - 4);
+	return tcan4x5x_regmap_gather_write(context, data, sizeof(u32),
+					    data + sizeof(u32),
+					    count - sizeof(u32));
 }
 
 static int tcan4x5x_regmap_read(void *context,
-- 
2.29.2



  parent reply	other threads:[~2020-12-16  0:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 23:17 [RFC]: tcan4x5x: rework regmap support Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 01/16] can: tcan4x5x: replace DEVICE_NAME by KBUILD_MODNAME Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 02/16] can: tcan4x5x: beautify indention of tcan4x5x_of_match and tcan4x5x_id_table Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 03/16] can: tcan4x5x: rename tcan4x5x.c -> tcan4x5x-core.c Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 04/16] can: tcan4x5x: move regmap code into seperate file Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 05/16] can: tcan4x5x: mark struct regmap_bus tcan4x5x_bus as constant Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 06/16] can: tcan4x5x: tcan4x5x_bus: remove not needed read_flag_mask Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 07/16] can: tcan4x5x: remove regmap async support Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 08/16] can: tcan4x5x: rename regmap_spi_gather_write() -> tcan4x5x_regmap_gather_write() Marc Kleine-Budde
2020-12-15 23:17 ` Marc Kleine-Budde [this message]
2020-12-15 23:17 ` [can-next-rfc 10/16] can: tcan4x5x: tcan4x5x_regmap_init(): use spi as context pointer Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 11/16] can: tcan4x5x: fix max register value Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 12/16] can: tcan4x5x: tcan4x5x_regmap: set reg_stride to 4 Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 13/16] can: tcan4x5x: add max_raw_{read,write} of 256 Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 14/16] can: tcan4x5x: add {wr,rd}_table Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 15/16] can: tcan4x5x: rework SPI access Marc Kleine-Budde
2020-12-15 23:17 ` [can-next-rfc 16/16] can: tcan4x5x: add support for half-duplex controllers Marc Kleine-Budde
2020-12-17 15:33 ` [RFC]: tcan4x5x: rework regmap support Dan Murphy
2020-12-18  8:50 ` Sean Nyekjaer

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=20201215231746.1132907-10-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dmurphy@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=sean@geanix.com \
    --cc=sriram.dash@samsung.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;
as well as URLs for NNTP newsgroup(s).