@@ -297,6 +297,7 @@ struct st_lsm6dsx_hw {
u8 enable_mask;
u8 ts_sip;
u8 sip;
+ int drdy_pin;
u8 *buff;
@@ -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;
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(-)