diff options
author | Irina Tirdea <irina.tirdea@intel.com> | 2015-04-13 18:41:01 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-06-14 15:59:28 +0100 |
commit | c0d901cce736cb628d2e15f07ae00ea1029f64df (patch) | |
tree | 2423b38805326992393eed63e73799553ab59b77 /drivers/iio/accel/mma9553.c | |
parent | 1ca0259b18478b2bab6d5c81ca1de52dd519ae5e (diff) | |
download | linux-c0d901cce736cb628d2e15f07ae00ea1029f64df.tar.bz2 |
iio: accel: mma9551_core: use size in words for word buffers
Change the prototype for the mma9551_read/write_*_words functions
to receive the length of the buffer in words (instead of bytes) since
we are using a word buffer. This will prevent users from sending an
odd number of bytes for a word array.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel/mma9553.c')
-rw-r--r-- | drivers/iio/accel/mma9553.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 8bfc61824fb2..06c870789383 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -322,7 +322,8 @@ static int mma9553_read_activity_stepcnt(struct mma9553_data *data, int ret; ret = mma9551_read_status_words(data->client, MMA9551_APPID_PEDOMETER, - MMA9553_REG_STATUS, sizeof(u32), buf); + MMA9553_REG_STATUS, ARRAY_SIZE(buf), + buf); if (ret < 0) { dev_err(&data->client->dev, "error reading status and stepcnt\n"); @@ -397,7 +398,8 @@ static int mma9553_init(struct mma9553_data *data) ret = mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER, MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf), (u16 *) &data->conf); + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to read configuration registers\n"); @@ -430,7 +432,8 @@ static int mma9553_init(struct mma9553_data *data) ret = mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER, MMA9553_REG_CONF_SLEEPMIN, - sizeof(data->conf), (u16 *) &data->conf); + sizeof(data->conf) / sizeof(u16), + (u16 *)&data->conf); if (ret < 0) { dev_err(&data->client->dev, "failed to write configuration registers\n"); |