Message ID | f7c16e9f25debe726645f25df6c9c18aa44f0a1f.1586082819.git.lorenzo@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iio: imu: st_lsm6dsx: remove duplicated macro | expand |
On Sun, 5 Apr 2020 12:36:26 +0200 Lorenzo Bianconi <lorenzo@kernel.org> wrote: > Remove ST_LSM6DSX_REG_WHOAMI_ADDR duplicated macro and rely on ST sensor > common definitions > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Applied. Thanks, Jonathan > --- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > index 84d219ae6aee..f3cf13b29d18 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > @@ -58,12 +58,11 @@ > #include <linux/regmap.h> > #include <linux/bitfield.h> > > +#include <linux/iio/common/st_sensors.h> > #include <linux/platform_data/st_sensors_pdata.h> > > #include "st_lsm6dsx.h" > > -#define ST_LSM6DSX_REG_WHOAMI_ADDR 0x0f > - > #define ST_LSM6DSX_TS_SENSITIVITY 25000UL /* 25us */ > > static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = { > @@ -1364,7 +1363,7 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, > return -ENODEV; > } > > - err = regmap_read(hw->regmap, ST_LSM6DSX_REG_WHOAMI_ADDR, &data); > + err = regmap_read(hw->regmap, ST_SENSORS_DEFAULT_WAI_ADDRESS, &data); > if (err < 0) { > dev_err(hw->dev, "failed to read whoami register\n"); > return err;
On Sun, 5 Apr 2020 13:07:24 +0100 Jonathan Cameron <jic23@kernel.org> wrote: > On Sun, 5 Apr 2020 12:36:26 +0200 > Lorenzo Bianconi <lorenzo@kernel.org> wrote: > > > Remove ST_LSM6DSX_REG_WHOAMI_ADDR duplicated macro and rely on ST sensor > > common definitions > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > Applied. Actually no. I'd rather duplicate the value than have this largerly unconnected driver include that header with lots of other stuff in it. So dropped. Thanks, Jonathan > > Thanks, > > Jonathan > > > --- > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > index 84d219ae6aee..f3cf13b29d18 100644 > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > @@ -58,12 +58,11 @@ > > #include <linux/regmap.h> > > #include <linux/bitfield.h> > > > > +#include <linux/iio/common/st_sensors.h> > > #include <linux/platform_data/st_sensors_pdata.h> > > > > #include "st_lsm6dsx.h" > > > > -#define ST_LSM6DSX_REG_WHOAMI_ADDR 0x0f > > - > > #define ST_LSM6DSX_TS_SENSITIVITY 25000UL /* 25us */ > > > > static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = { > > @@ -1364,7 +1363,7 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, > > return -ENODEV; > > } > > > > - err = regmap_read(hw->regmap, ST_LSM6DSX_REG_WHOAMI_ADDR, &data); > > + err = regmap_read(hw->regmap, ST_SENSORS_DEFAULT_WAI_ADDRESS, &data); > > if (err < 0) { > > dev_err(hw->dev, "failed to read whoami register\n"); > > return err; >
> > On Sun, 5 Apr 2020 13:07:24 +0100 > Jonathan Cameron <jic23@kernel.org> wrote: > > > On Sun, 5 Apr 2020 12:36:26 +0200 > > Lorenzo Bianconi <lorenzo@kernel.org> wrote: > > > > > Remove ST_LSM6DSX_REG_WHOAMI_ADDR duplicated macro and rely on ST sensor > > > common definitions > > > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > Applied. > > Actually no. I'd rather duplicate the value than have this > largerly unconnected driver include that header with lots of other > stuff in it. > > So dropped. actually I was thinking about it too but I guess we have the same issue in shub for LIS3MDL so I just aligned to it: https://github.com/LorenzoBianconi/linux-iio/blob/st_lsm6dsx_default_wai/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c#L96 Regards, Lorenzo > > Thanks, > > Jonathan > > > > > Thanks, > > > > Jonathan > > > > > --- > > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++--- > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > index 84d219ae6aee..f3cf13b29d18 100644 > > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > @@ -58,12 +58,11 @@ > > > #include <linux/regmap.h> > > > #include <linux/bitfield.h> > > > > > > +#include <linux/iio/common/st_sensors.h> > > > #include <linux/platform_data/st_sensors_pdata.h> > > > > > > #include "st_lsm6dsx.h" > > > > > > -#define ST_LSM6DSX_REG_WHOAMI_ADDR 0x0f > > > - > > > #define ST_LSM6DSX_TS_SENSITIVITY 25000UL /* 25us */ > > > > > > static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = { > > > @@ -1364,7 +1363,7 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, > > > return -ENODEV; > > > } > > > > > > - err = regmap_read(hw->regmap, ST_LSM6DSX_REG_WHOAMI_ADDR, &data); > > > + err = regmap_read(hw->regmap, ST_SENSORS_DEFAULT_WAI_ADDRESS, &data); > > > if (err < 0) { > > > dev_err(hw->dev, "failed to read whoami register\n"); > > > return err; > > >
On Sun, 5 Apr 2020 14:35:51 +0200 Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote: > > > > On Sun, 5 Apr 2020 13:07:24 +0100 > > Jonathan Cameron <jic23@kernel.org> wrote: > > > > > On Sun, 5 Apr 2020 12:36:26 +0200 > > > Lorenzo Bianconi <lorenzo@kernel.org> wrote: > > > > > > > Remove ST_LSM6DSX_REG_WHOAMI_ADDR duplicated macro and rely on ST sensor > > > > common definitions > > > > > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > > Applied. > > > > Actually no. I'd rather duplicate the value than have this > > largerly unconnected driver include that header with lots of other > > stuff in it. > > > > So dropped. > > actually I was thinking about it too but I guess we have the same > issue in shub for LIS3MDL so I just aligned to it: > https://github.com/LorenzoBianconi/linux-iio/blob/st_lsm6dsx_default_wai/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c#L96 Ah. I'd like to drop that include rather than introduce it in the other file. Thanks, Jonathan > > Regards, > Lorenzo > > > > > Thanks, > > > > Jonathan > > > > > > > > Thanks, > > > > > > Jonathan > > > > > > > --- > > > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++--- > > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > index 84d219ae6aee..f3cf13b29d18 100644 > > > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > @@ -58,12 +58,11 @@ > > > > #include <linux/regmap.h> > > > > #include <linux/bitfield.h> > > > > > > > > +#include <linux/iio/common/st_sensors.h> > > > > #include <linux/platform_data/st_sensors_pdata.h> > > > > > > > > #include "st_lsm6dsx.h" > > > > > > > > -#define ST_LSM6DSX_REG_WHOAMI_ADDR 0x0f > > > > - > > > > #define ST_LSM6DSX_TS_SENSITIVITY 25000UL /* 25us */ > > > > > > > > static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = { > > > > @@ -1364,7 +1363,7 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, > > > > return -ENODEV; > > > > } > > > > > > > > - err = regmap_read(hw->regmap, ST_LSM6DSX_REG_WHOAMI_ADDR, &data); > > > > + err = regmap_read(hw->regmap, ST_SENSORS_DEFAULT_WAI_ADDRESS, &data); > > > > if (err < 0) { > > > > dev_err(hw->dev, "failed to read whoami register\n"); > > > > return err; > > > > > >
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 84d219ae6aee..f3cf13b29d18 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -58,12 +58,11 @@ #include <linux/regmap.h> #include <linux/bitfield.h> +#include <linux/iio/common/st_sensors.h> #include <linux/platform_data/st_sensors_pdata.h> #include "st_lsm6dsx.h" -#define ST_LSM6DSX_REG_WHOAMI_ADDR 0x0f - #define ST_LSM6DSX_TS_SENSITIVITY 25000UL /* 25us */ static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = { @@ -1364,7 +1363,7 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, return -ENODEV; } - err = regmap_read(hw->regmap, ST_LSM6DSX_REG_WHOAMI_ADDR, &data); + err = regmap_read(hw->regmap, ST_SENSORS_DEFAULT_WAI_ADDRESS, &data); if (err < 0) { dev_err(hw->dev, "failed to read whoami register\n"); return err;
Remove ST_LSM6DSX_REG_WHOAMI_ADDR duplicated macro and rely on ST sensor common definitions Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)