All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: humidity: hts221: remove unnecessary get_unaligned_le16()
@ 2018-01-01 14:19 Lorenzo Bianconi
  2018-01-06 11:47 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-01-01 14:19 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio

Remove unnecessary unaligned access routine in hts221_read_oneshot() and
the related include

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/iio/humidity/hts221_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 75d442e7b510..6df59e12c5e2 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -14,7 +14,6 @@
 #include <linux/iio/sysfs.h>
 #include <linux/delay.h>
 #include <linux/pm.h>
-#include <asm/unaligned.h>
 #include <linux/regmap.h>
 #include <linux/bitfield.h>
 
@@ -404,7 +403,7 @@ static int hts221_get_sensor_offset(struct hts221_hw *hw,
 
 static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
 {
-	u8 data[HTS221_DATA_SIZE];
+	__le16 data;
 	int err;
 
 	err = hts221_set_enable(hw, true);
@@ -413,13 +412,13 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
 
 	msleep(50);
 
-	err = regmap_bulk_read(hw->regmap, addr, data, sizeof(data));
+	err = regmap_bulk_read(hw->regmap, addr, &data, sizeof(data));
 	if (err < 0)
 		return err;
 
 	hts221_set_enable(hw, false);
 
-	*val = (s16)get_unaligned_le16(data);
+	*val = (s16)le16_to_cpu(data);
 
 	return IIO_VAL_INT;
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-06 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-01 14:19 [PATCH] iio: humidity: hts221: remove unnecessary get_unaligned_le16() Lorenzo Bianconi
2018-01-06 11:47 ` Jonathan Cameron
2018-01-06 12:01   ` Jonathan Cameron
2018-01-06 13:42     ` Lorenzo Bianconi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.