Re: [PATCH] iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER

2021-04-18 Thread Jonathan Cameron
On Thu, 15 Apr 2021 09:58:33 -0700
Srinivas Pandruvada  wrote:

> On Wed, 2021-04-14 at 11:49 +0300, Alexandru Ardelean wrote:
> > During commit 067fda1c065ff ("iio: hid-sensors: move triggered buffer
> > setup into hid_sensor_setup_trigger"), the
> > iio_triggered_buffer_{setup,cleanup}() functions got moved under the
> > hid-sensor-trigger module.
> > 
> > The above change works fine, if any of the sensors get built.
> > However, when
> > only the common hid-sensor-trigger module gets built (and none of the
> > drivers), then the IIO_TRIGGERED_BUFFER symbol isn't
> > selected/enforced.
> > 
> > Previously, each driver would enforce/select the IIO_TRIGGERED_BUFFER
> > symbol. With this change the HID_SENSOR_IIO_TRIGGER (for the
> > hid-sensor-trigger module) will enforce that IIO_TRIGGERED_BUFFER
> > gets
> > selected.
> > 
> > All HID sensor drivers select the HID_SENSOR_IIO_TRIGGER symbol. So,
> > this
> > change removes the IIO_TRIGGERED_BUFFER enforcement from each driver.
> > 
> > Fixes: 067fda1c065ff ("iio: hid-sensors: move triggered buffer setup
> > into hid_sensor_setup_trigger")
> > Reported-by: Thomas Deutschmann 
> > Cc: Srinivas Pandruvada 
> > Signed-off-by: Alexandru Ardelean   
> Acked-by: Srinivas Pandruvada 
Applied to the fixes-togreg branch of iio.git.

Always good to see the autobuilders can find corners no one sane would ever
hit :)

Jonathan

> 
> > ---
> >  drivers/iio/accel/Kconfig  | 1 -
> >  drivers/iio/common/hid-sensors/Kconfig | 1 +
> >  drivers/iio/gyro/Kconfig   | 1 -
> >  drivers/iio/humidity/Kconfig   | 1 -
> >  drivers/iio/light/Kconfig  | 2 --
> >  drivers/iio/magnetometer/Kconfig   | 1 -
> >  drivers/iio/orientation/Kconfig| 2 --
> >  drivers/iio/pressure/Kconfig   | 1 -
> >  drivers/iio/temperature/Kconfig| 1 -
> >  9 files changed, 1 insertion(+), 10 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> > index cceda3cecbcf..8b1723635cce 100644
> > --- a/drivers/iio/accel/Kconfig
> > +++ b/drivers/iio/accel/Kconfig
> > @@ -229,7 +229,6 @@ config DMARD10
> >  config HID_SENSOR_ACCEL_3D
> > depends on HID_SENSOR_HUB
> > select IIO_BUFFER
> > -   select IIO_TRIGGERED_BUFFER
> > select HID_SENSOR_IIO_COMMON
> > select HID_SENSOR_IIO_TRIGGER
> > tristate "HID Accelerometers 3D"
> > diff --git a/drivers/iio/common/hid-sensors/Kconfig
> > b/drivers/iio/common/hid-sensors/Kconfig
> > index 24d492567336..2a3dd3b907be 100644
> > --- a/drivers/iio/common/hid-sensors/Kconfig
> > +++ b/drivers/iio/common/hid-sensors/Kconfig
> > @@ -19,6 +19,7 @@ config HID_SENSOR_IIO_TRIGGER
> > tristate "Common module (trigger) for all HID Sensor IIO
> > drivers"
> > depends on HID_SENSOR_HUB && HID_SENSOR_IIO_COMMON &&
> > IIO_BUFFER
> > select IIO_TRIGGER
> > +   select IIO_TRIGGERED_BUFFER
> > help
> >   Say yes here to build trigger support for HID sensors.
> >   Triggers will be send if all requested attributes were read.
> > diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
> > index 5824f2edf975..20b5ac7ab66a 100644
> > --- a/drivers/iio/gyro/Kconfig
> > +++ b/drivers/iio/gyro/Kconfig
> > @@ -111,7 +111,6 @@ config FXAS21002C_SPI
> >  config HID_SENSOR_GYRO_3D
> > depends on HID_SENSOR_HUB
> > select IIO_BUFFER
> > -   select IIO_TRIGGERED_BUFFER
> > select HID_SENSOR_IIO_COMMON
> > select HID_SENSOR_IIO_TRIGGER
> > tristate "HID Gyroscope 3D"
> > diff --git a/drivers/iio/humidity/Kconfig
> > b/drivers/iio/humidity/Kconfig
> > index 6549fcf6db69..2de5494e7c22 100644
> > --- a/drivers/iio/humidity/Kconfig
> > +++ b/drivers/iio/humidity/Kconfig
> > @@ -52,7 +52,6 @@ config HID_SENSOR_HUMIDITY
> > tristate "HID Environmental humidity sensor"
> > depends on HID_SENSOR_HUB
> > select IIO_BUFFER
> > -   select IIO_TRIGGERED_BUFFER
> > select HID_SENSOR_IIO_COMMON
> > select HID_SENSOR_IIO_TRIGGER
> > help
> > diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
> > index 33ad4dd0b5c7..917f9becf9c7 100644
> > --- a/drivers/iio/light/Kconfig
> > +++ b/drivers/iio/light/Kconfig
> > @@ -256,7 +256,6 @@ config ISL29125
> >  config HID_SENSOR_ALS
> > depends on HID_SENSOR_HUB
> > select IIO_BUFFER
> > -   select IIO_TRIGGERED_BUFFER
> > select HID_SENSOR_IIO_COMMON
> > select HID_SENSOR_IIO_TRIGGER
> > tristate "HID ALS"
> > @@ -270,7 +269,6 @@ config HID_SENSOR_ALS
> >  config HID_SENSOR_PROX
> > depends on HID_SENSOR_HUB
> > select IIO_BUFFER
> > -   select IIO_TRIGGERED_BUFFER
> > select HID_SENSOR_IIO_COMMON
> > select HID_SENSOR_IIO_TRIGGER
> > tristate "HID PROX"
> > diff --git a/drivers/iio/magnetometer/Kconfig
> > b/drivers/iio/magnetometer/Kconfig
> > index 5d4ffd66032e..74ad5701c6c2 100644
> > --- a/drivers/iio/magnetometer/Kconfig
> > +++ b/drivers/iio/magnetometer/Kconfig
> > @@ -95,7 +95,6 @@ config MAG3110
> >  config 

Re: [PATCH] iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER

2021-04-15 Thread Srinivas Pandruvada
On Wed, 2021-04-14 at 11:49 +0300, Alexandru Ardelean wrote:
> During commit 067fda1c065ff ("iio: hid-sensors: move triggered buffer
> setup into hid_sensor_setup_trigger"), the
> iio_triggered_buffer_{setup,cleanup}() functions got moved under the
> hid-sensor-trigger module.
> 
> The above change works fine, if any of the sensors get built.
> However, when
> only the common hid-sensor-trigger module gets built (and none of the
> drivers), then the IIO_TRIGGERED_BUFFER symbol isn't
> selected/enforced.
> 
> Previously, each driver would enforce/select the IIO_TRIGGERED_BUFFER
> symbol. With this change the HID_SENSOR_IIO_TRIGGER (for the
> hid-sensor-trigger module) will enforce that IIO_TRIGGERED_BUFFER
> gets
> selected.
> 
> All HID sensor drivers select the HID_SENSOR_IIO_TRIGGER symbol. So,
> this
> change removes the IIO_TRIGGERED_BUFFER enforcement from each driver.
> 
> Fixes: 067fda1c065ff ("iio: hid-sensors: move triggered buffer setup
> into hid_sensor_setup_trigger")
> Reported-by: Thomas Deutschmann 
> Cc: Srinivas Pandruvada 
> Signed-off-by: Alexandru Ardelean 
Acked-by: Srinivas Pandruvada 

> ---
>  drivers/iio/accel/Kconfig  | 1 -
>  drivers/iio/common/hid-sensors/Kconfig | 1 +
>  drivers/iio/gyro/Kconfig   | 1 -
>  drivers/iio/humidity/Kconfig   | 1 -
>  drivers/iio/light/Kconfig  | 2 --
>  drivers/iio/magnetometer/Kconfig   | 1 -
>  drivers/iio/orientation/Kconfig| 2 --
>  drivers/iio/pressure/Kconfig   | 1 -
>  drivers/iio/temperature/Kconfig| 1 -
>  9 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index cceda3cecbcf..8b1723635cce 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -229,7 +229,6 @@ config DMARD10
>  config HID_SENSOR_ACCEL_3D
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   tristate "HID Accelerometers 3D"
> diff --git a/drivers/iio/common/hid-sensors/Kconfig
> b/drivers/iio/common/hid-sensors/Kconfig
> index 24d492567336..2a3dd3b907be 100644
> --- a/drivers/iio/common/hid-sensors/Kconfig
> +++ b/drivers/iio/common/hid-sensors/Kconfig
> @@ -19,6 +19,7 @@ config HID_SENSOR_IIO_TRIGGER
>   tristate "Common module (trigger) for all HID Sensor IIO
> drivers"
>   depends on HID_SENSOR_HUB && HID_SENSOR_IIO_COMMON &&
> IIO_BUFFER
>   select IIO_TRIGGER
> + select IIO_TRIGGERED_BUFFER
>   help
> Say yes here to build trigger support for HID sensors.
> Triggers will be send if all requested attributes were read.
> diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
> index 5824f2edf975..20b5ac7ab66a 100644
> --- a/drivers/iio/gyro/Kconfig
> +++ b/drivers/iio/gyro/Kconfig
> @@ -111,7 +111,6 @@ config FXAS21002C_SPI
>  config HID_SENSOR_GYRO_3D
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   tristate "HID Gyroscope 3D"
> diff --git a/drivers/iio/humidity/Kconfig
> b/drivers/iio/humidity/Kconfig
> index 6549fcf6db69..2de5494e7c22 100644
> --- a/drivers/iio/humidity/Kconfig
> +++ b/drivers/iio/humidity/Kconfig
> @@ -52,7 +52,6 @@ config HID_SENSOR_HUMIDITY
>   tristate "HID Environmental humidity sensor"
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   help
> diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
> index 33ad4dd0b5c7..917f9becf9c7 100644
> --- a/drivers/iio/light/Kconfig
> +++ b/drivers/iio/light/Kconfig
> @@ -256,7 +256,6 @@ config ISL29125
>  config HID_SENSOR_ALS
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   tristate "HID ALS"
> @@ -270,7 +269,6 @@ config HID_SENSOR_ALS
>  config HID_SENSOR_PROX
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   tristate "HID PROX"
> diff --git a/drivers/iio/magnetometer/Kconfig
> b/drivers/iio/magnetometer/Kconfig
> index 5d4ffd66032e..74ad5701c6c2 100644
> --- a/drivers/iio/magnetometer/Kconfig
> +++ b/drivers/iio/magnetometer/Kconfig
> @@ -95,7 +95,6 @@ config MAG3110
>  config HID_SENSOR_MAGNETOMETER_3D
>   depends on HID_SENSOR_HUB
>   select IIO_BUFFER
> - select IIO_TRIGGERED_BUFFER
>   select HID_SENSOR_IIO_COMMON
>   select HID_SENSOR_IIO_TRIGGER
>   tristate "HID Magenetometer 3D"
> diff --git a/drivers/iio/orientation/Kconfig
> b/drivers/iio/orientation/Kconfig
> index a505583cc2fd..396cbbb867f4 100644
> --- 

[PATCH] iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER

2021-04-14 Thread Alexandru Ardelean
During commit 067fda1c065ff ("iio: hid-sensors: move triggered buffer
setup into hid_sensor_setup_trigger"), the
iio_triggered_buffer_{setup,cleanup}() functions got moved under the
hid-sensor-trigger module.

The above change works fine, if any of the sensors get built. However, when
only the common hid-sensor-trigger module gets built (and none of the
drivers), then the IIO_TRIGGERED_BUFFER symbol isn't selected/enforced.

Previously, each driver would enforce/select the IIO_TRIGGERED_BUFFER
symbol. With this change the HID_SENSOR_IIO_TRIGGER (for the
hid-sensor-trigger module) will enforce that IIO_TRIGGERED_BUFFER gets
selected.

All HID sensor drivers select the HID_SENSOR_IIO_TRIGGER symbol. So, this
change removes the IIO_TRIGGERED_BUFFER enforcement from each driver.

Fixes: 067fda1c065ff ("iio: hid-sensors: move triggered buffer setup into 
hid_sensor_setup_trigger")
Reported-by: Thomas Deutschmann 
Cc: Srinivas Pandruvada 
Signed-off-by: Alexandru Ardelean 
---
 drivers/iio/accel/Kconfig  | 1 -
 drivers/iio/common/hid-sensors/Kconfig | 1 +
 drivers/iio/gyro/Kconfig   | 1 -
 drivers/iio/humidity/Kconfig   | 1 -
 drivers/iio/light/Kconfig  | 2 --
 drivers/iio/magnetometer/Kconfig   | 1 -
 drivers/iio/orientation/Kconfig| 2 --
 drivers/iio/pressure/Kconfig   | 1 -
 drivers/iio/temperature/Kconfig| 1 -
 9 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index cceda3cecbcf..8b1723635cce 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -229,7 +229,6 @@ config DMARD10
 config HID_SENSOR_ACCEL_3D
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
tristate "HID Accelerometers 3D"
diff --git a/drivers/iio/common/hid-sensors/Kconfig 
b/drivers/iio/common/hid-sensors/Kconfig
index 24d492567336..2a3dd3b907be 100644
--- a/drivers/iio/common/hid-sensors/Kconfig
+++ b/drivers/iio/common/hid-sensors/Kconfig
@@ -19,6 +19,7 @@ config HID_SENSOR_IIO_TRIGGER
tristate "Common module (trigger) for all HID Sensor IIO drivers"
depends on HID_SENSOR_HUB && HID_SENSOR_IIO_COMMON && IIO_BUFFER
select IIO_TRIGGER
+   select IIO_TRIGGERED_BUFFER
help
  Say yes here to build trigger support for HID sensors.
  Triggers will be send if all requested attributes were read.
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
index 5824f2edf975..20b5ac7ab66a 100644
--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -111,7 +111,6 @@ config FXAS21002C_SPI
 config HID_SENSOR_GYRO_3D
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
tristate "HID Gyroscope 3D"
diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig
index 6549fcf6db69..2de5494e7c22 100644
--- a/drivers/iio/humidity/Kconfig
+++ b/drivers/iio/humidity/Kconfig
@@ -52,7 +52,6 @@ config HID_SENSOR_HUMIDITY
tristate "HID Environmental humidity sensor"
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
help
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
index 33ad4dd0b5c7..917f9becf9c7 100644
--- a/drivers/iio/light/Kconfig
+++ b/drivers/iio/light/Kconfig
@@ -256,7 +256,6 @@ config ISL29125
 config HID_SENSOR_ALS
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
tristate "HID ALS"
@@ -270,7 +269,6 @@ config HID_SENSOR_ALS
 config HID_SENSOR_PROX
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
tristate "HID PROX"
diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig
index 5d4ffd66032e..74ad5701c6c2 100644
--- a/drivers/iio/magnetometer/Kconfig
+++ b/drivers/iio/magnetometer/Kconfig
@@ -95,7 +95,6 @@ config MAG3110
 config HID_SENSOR_MAGNETOMETER_3D
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select HID_SENSOR_IIO_COMMON
select HID_SENSOR_IIO_TRIGGER
tristate "HID Magenetometer 3D"
diff --git a/drivers/iio/orientation/Kconfig b/drivers/iio/orientation/Kconfig
index a505583cc2fd..396cbbb867f4 100644
--- a/drivers/iio/orientation/Kconfig
+++ b/drivers/iio/orientation/Kconfig
@@ -9,7 +9,6 @@ menu "Inclinometer sensors"
 config HID_SENSOR_INCLINOMETER_3D
depends on HID_SENSOR_HUB
select IIO_BUFFER
-   select IIO_TRIGGERED_BUFFER
select