From: jic23@kernel.org
To: linux-iio@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Subject: [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
Date: Sun, 5 Apr 2020 19:03:19 +0100 [thread overview]
Message-ID: <20200405180321.1737310-5-jic23@kernel.org> (raw)
In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
A mixture of:
* Casts to u8 * for the val parameter which is void * and so needs no cast.
* Explicit sizes when we can use sizeof on the destination / source variable.
Not broken in anyway, I'm just trying to tidy up the is in the subsystem to
avoid it getting cut and paste into new drivers.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index e4b0d368c2f9..d3819b516ec6 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -526,7 +526,7 @@ static int inv_mpu6050_sensor_set(struct inv_mpu6050_state *st, int reg,
__be16 d = cpu_to_be16(val);
ind = (axis - IIO_MOD_X) * 2;
- result = regmap_bulk_write(st->map, reg + ind, (u8 *)&d, 2);
+ result = regmap_bulk_write(st->map, reg + ind, &d, sizeof(d));
if (result)
return -EINVAL;
@@ -540,7 +540,7 @@ static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg,
__be16 d;
ind = (axis - IIO_MOD_X) * 2;
- result = regmap_bulk_read(st->map, reg + ind, (u8 *)&d, 2);
+ result = regmap_bulk_read(st->map, reg + ind, &d, sizeof(d));
if (result)
return -EINVAL;
*val = (short)be16_to_cpup(&d);
--
2.26.0
next prev parent reply other threads:[~2020-04-05 18:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
2020-04-13 4:31 ` Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 2/6] iio:chemical:atlas-sensor: " jic23
2020-04-06 0:54 ` Matt Ranostay
2020-04-05 18:03 ` [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read jic23
2020-04-06 13:08 ` Himanshu Jha
2020-04-05 18:03 ` jic23 [this message]
2020-04-13 4:32 ` [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* jic23
2020-04-13 4:32 ` Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read jic23
2020-04-13 4:33 ` Ardelean, Alexandru
2020-04-12 13:48 ` [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls Jonathan Cameron
2020-04-12 20:59 ` Andy Shevchenko
2020-04-13 4:34 ` Ardelean, Alexandru
2020-04-13 15:07 ` Jonathan Cameron
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=20200405180321.1737310-5-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=jmaneyrol@invensense.com \
--cc=linux-iio@vger.kernel.org \
/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).