diff mbox series

[v2,2/6] iio: imu: st_lsm6dsx: save drdy_pin in device struct

Message ID 20190715081514.81129-2-sean@geanix.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/6] iio: imu: st_lsm6dsx: move interrupt thread to core | expand

Commit Message

Sean Nyekjaer July 15, 2019, 8:15 a.m. UTC
This prepares the use of the drdy_pin for selecting the correct
event interrupt register.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---

Changes since v1:
 * new commit

 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h      | 1 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
index af379a5429ed..738bed4a9752 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -297,6 +297,7 @@  struct st_lsm6dsx_hw {
 	u8 enable_mask;
 	u8 ts_sip;
 	u8 sip;
+	int drdy_pin;
 
 	u8 *buff;
 
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index e67341802fc6..2c11addf568b 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -871,17 +871,17 @@  static int st_lsm6dsx_of_get_drdy_pin(struct st_lsm6dsx_hw *hw, int *drdy_pin)
 
 static int st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw, u8 *drdy_reg)
 {
-	int err = 0, drdy_pin;
+	int err = 0;
 
-	if (st_lsm6dsx_of_get_drdy_pin(hw, &drdy_pin) < 0) {
+	if (st_lsm6dsx_of_get_drdy_pin(hw, &hw->drdy_pin) < 0) {
 		struct st_sensors_platform_data *pdata;
 		struct device *dev = hw->dev;
 
 		pdata = (struct st_sensors_platform_data *)dev->platform_data;
-		drdy_pin = pdata ? pdata->drdy_int_pin : 1;
+		hw->drdy_pin = pdata ? pdata->drdy_int_pin : 1;
 	}
 
-	switch (drdy_pin) {
+	switch (hw->drdy_pin) {
 	case 1:
 		*drdy_reg = ST_LSM6DSX_REG_INT1_ADDR;
 		break;