linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding.
@ 2024-09-01 13:59 Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 01/15] iio: accel: adxl380: use irq_get_trigger_type() Jonathan Cameron
                   ` (15 more replies)
  0 siblings, 16 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Andy pointed out in a review that there is an irq_get_trigger_type()
helper that first gets the irq data then extracts the type from it.
This saves on opencoding those two steps when the irq data isn't used
for anything else.

Update all the sites this pattern occurs in IIO to use the helper.
In a few cases there will be a slightly different error message is
somehow there is a valid irq number passed to this call and it doesn't
have the data associated with it.

Jonathan Cameron (15):
  iio: accel: adxl380: use irq_get_trigger_type()
  iio: accel: fxls8962af: use irq_get_trigger_type()
  iio: adc: ti-ads1015: use irq_get_trigger_type()
  iio: common: st: use irq_get_trigger_type()
  iio: gyro: fxas21002c: use irq_get_trigger_type()
  iio: gyro: mpu3050: use irq_get_trigger_type()
  iio: humidity: hts221: use irq_get_trigger_type()
  iio: imu: bmi160: use irq_get_trigger_type()
  iio: imu: bmi323: use irq_get_trigger_type()
  iio: imu: inv_icm42600: use irq_get_trigger_type()
  iio: imu: inv_mpu6050: use irq_get_trigger_type()
  iio: imu: st_lsm6dsx: use irq_get_trigger_type()
  iio: light: st_uvis25: use irq_get_trigger_type()
  iio: magn: ak8974: use irq_get_trigger_type()
  iio: pressure: bmp280: use irq_get_trigger_type()

 drivers/iio/accel/adxl380.c                        |  7 +------
 drivers/iio/accel/fxls8962af-core.c                |  2 +-
 drivers/iio/adc/ti-ads1015.c                       |  2 +-
 drivers/iio/common/st_sensors/st_sensors_trigger.c |  2 +-
 drivers/iio/gyro/fxas21002c_core.c                 |  2 +-
 drivers/iio/gyro/mpu3050-core.c                    |  2 +-
 drivers/iio/humidity/hts221_buffer.c               |  2 +-
 drivers/iio/imu/bmi160/bmi160_core.c               | 11 +----------
 drivers/iio/imu/bmi323/bmi323_core.c               |  8 +-------
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c   | 10 +---------
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c         |  9 +--------
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c       |  2 +-
 drivers/iio/light/st_uvis25_core.c                 |  2 +-
 drivers/iio/magnetometer/ak8974.c                  |  2 +-
 drivers/iio/pressure/bmp280-core.c                 |  2 +-
 15 files changed, 15 insertions(+), 50 deletions(-)

-- 
2.46.0


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

* [PATCH 01/15] iio: accel: adxl380: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 02/15] iio: accel: fxls8962af: " Jonathan Cameron
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/adxl380.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
index 98863e22bb6b..9c9bee993fde 100644
--- a/drivers/iio/accel/adxl380.c
+++ b/drivers/iio/accel/adxl380.c
@@ -1719,7 +1719,6 @@ static int adxl380_config_irq(struct iio_dev *indio_dev)
 {
 	struct adxl380_state *st = iio_priv(indio_dev);
 	unsigned long irq_flag;
-	struct irq_data *desc;
 	u32 irq_type;
 	u8 polarity;
 	int ret;
@@ -1737,11 +1736,7 @@ static int adxl380_config_irq(struct iio_dev *indio_dev)
 		st->int_map[1] = ADXL380_INT1_MAP1_REG;
 	}
 
-	desc = irq_get_irq_data(st->irq);
-	if (!desc)
-		return dev_err_probe(st->dev, -EINVAL, "Could not find IRQ %d\n", st->irq);
-
-	irq_type = irqd_get_trigger_type(desc);
+	irq_type = irq_get_trigger_type(st->irq);
 	if (irq_type == IRQ_TYPE_LEVEL_HIGH) {
 		polarity = 0;
 		irq_flag = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
-- 
2.46.0


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

* [PATCH 02/15] iio: accel: fxls8962af: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 01/15] iio: accel: adxl380: use irq_get_trigger_type() Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02  9:20   ` Sean Nyekjaer
  2024-09-02 11:41   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 03/15] iio: adc: ti-ads1015: " Jonathan Cameron
                   ` (13 subsequent siblings)
  15 siblings, 2 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/fxls8962af-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index acadabec4df7..a50c47f5179f 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -1103,7 +1103,7 @@ static int fxls8962af_irq_setup(struct iio_dev *indio_dev, int irq)
 	if (ret)
 		return ret;
 
-	irq_type = irqd_get_trigger_type(irq_get_irq_data(irq));
+	irq_type = irq_get_trigger_type(irq);
 
 	switch (irq_type) {
 	case IRQF_TRIGGER_HIGH:
-- 
2.46.0


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

* [PATCH 03/15] iio: adc: ti-ads1015: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 01/15] iio: accel: adxl380: use irq_get_trigger_type() Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 02/15] iio: accel: fxls8962af: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:42   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 04/15] iio: common: st: " Jonathan Cameron
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/ti-ads1015.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index ca432c49eab1..70f60d018049 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -1033,7 +1033,7 @@ static int ads1015_probe(struct i2c_client *client)
 
 	if (client->irq && chip->has_comparator) {
 		unsigned long irq_trig =
-			irqd_get_trigger_type(irq_get_irq_data(client->irq));
+			irq_get_trigger_type(client->irq);
 		unsigned int cfg_comp_mask = ADS1015_CFG_COMP_QUE_MASK |
 			ADS1015_CFG_COMP_LAT_MASK | ADS1015_CFG_COMP_POL_MASK;
 		unsigned int cfg_comp =
-- 
2.46.0


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

* [PATCH 04/15] iio: common: st: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (2 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 03/15] iio: adc: ti-ads1015: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:44   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 05/15] iio: gyro: fxas21002c: " Jonathan Cameron
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/common/st_sensors/st_sensors_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index a0df9250a69f..1c51ac110078 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -134,7 +134,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 	iio_trigger_set_drvdata(sdata->trig, indio_dev);
 	sdata->trig->ops = trigger_ops;
 
-	irq_trig = irqd_get_trigger_type(irq_get_irq_data(sdata->irq));
+	irq_trig = irq_get_trigger_type(sdata->irq);
 	/*
 	 * If the IRQ is triggered on falling edge, we need to mark the
 	 * interrupt as active low, if the hardware supports this.
-- 
2.46.0


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

* [PATCH 05/15] iio: gyro: fxas21002c: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (3 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 04/15] iio: common: st: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:44   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 06/15] iio: gyro: mpu3050: " Jonathan Cameron
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/gyro/fxas21002c_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c
index c28d17ca6f5e..877a2b07cb23 100644
--- a/drivers/iio/gyro/fxas21002c_core.c
+++ b/drivers/iio/gyro/fxas21002c_core.c
@@ -849,7 +849,7 @@ static int fxas21002c_trigger_probe(struct fxas21002c_data *data)
 	if (!data->dready_trig)
 		return -ENOMEM;
 
-	irq_trig = irqd_get_trigger_type(irq_get_irq_data(data->irq));
+	irq_trig = irq_get_trigger_type(data->irq);
 
 	if (irq_trig == IRQF_TRIGGER_RISING) {
 		ret = regmap_field_write(data->regmap_fields[F_IPOL], 1);
-- 
2.46.0


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

* [PATCH 06/15] iio: gyro: mpu3050: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (4 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 05/15] iio: gyro: fxas21002c: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02  9:13   ` Linus Walleij
  2024-09-02 11:46   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 07/15] iio: humidity: hts221: " Jonathan Cameron
                   ` (9 subsequent siblings)
  15 siblings, 2 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/gyro/mpu3050-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 35af68b41408..b38d0678277e 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -1059,7 +1059,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
 	/* Check if IRQ is open drain */
 	mpu3050->irq_opendrain = device_property_read_bool(dev, "drive-open-drain");
 
-	irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
+	irq_trig = irq_get_trigger_type(irq);
 	/*
 	 * Configure the interrupt generator hardware to supply whatever
 	 * the interrupt is configured for, edges low/high level low/high,
-- 
2.46.0


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

* [PATCH 07/15] iio: humidity: hts221: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (5 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 06/15] iio: gyro: mpu3050: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:46   ` Andy Shevchenko
  2024-09-02 13:42   ` Lorenzo Bianconi
  2024-09-01 13:59 ` [PATCH 08/15] iio: imu: bmi160: " Jonathan Cameron
                   ` (8 subsequent siblings)
  15 siblings, 2 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/humidity/hts221_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index 11ef38994a95..0272065cc44a 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -81,7 +81,7 @@ int hts221_allocate_trigger(struct iio_dev *iio_dev)
 	unsigned long irq_type;
 	int err;
 
-	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
+	irq_type = irq_get_trigger_type(hw->irq);
 
 	switch (irq_type) {
 	case IRQF_TRIGGER_HIGH:
-- 
2.46.0


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

* [PATCH 08/15] iio: imu: bmi160: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (6 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 07/15] iio: humidity: hts221: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:45   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 09/15] iio: imu: bmi323: " Jonathan Cameron
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/bmi160/bmi160_core.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 495e8a74ac67..3665fcd5ff0d 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -690,17 +690,8 @@ static int bmi160_config_device_irq(struct iio_dev *indio_dev, int irq_type,
 static int bmi160_setup_irq(struct iio_dev *indio_dev, int irq,
 			    enum bmi160_int_pin pin)
 {
-	struct irq_data *desc;
-	u32 irq_type;
 	int ret;
-
-	desc = irq_get_irq_data(irq);
-	if (!desc) {
-		dev_err(&indio_dev->dev, "Could not find IRQ %d\n", irq);
-		return -EINVAL;
-	}
-
-	irq_type = irqd_get_trigger_type(desc);
+	u32 irq_type = irq_get_trigger_type(irq);
 
 	ret = bmi160_config_device_irq(indio_dev, irq_type, pin);
 	if (ret)
-- 
2.46.0


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

* [PATCH 09/15] iio: imu: bmi323: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (7 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 08/15] iio: imu: bmi160: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 10/15] iio: imu: inv_icm42600: " Jonathan Cameron
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/bmi323/bmi323_core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index 671401ce80dc..89eab40bcfdf 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -1881,7 +1881,6 @@ static int bmi323_trigger_probe(struct bmi323_data *data,
 	struct fwnode_handle *fwnode;
 	enum bmi323_irq_pin irq_pin;
 	int ret, irq, irq_type;
-	struct irq_data *desc;
 
 	fwnode = dev_fwnode(data->dev);
 	if (!fwnode)
@@ -1898,12 +1897,7 @@ static int bmi323_trigger_probe(struct bmi323_data *data,
 		irq_pin = BMI323_IRQ_INT2;
 	}
 
-	desc = irq_get_irq_data(irq);
-	if (!desc)
-		return dev_err_probe(data->dev, -EINVAL,
-				     "Could not find IRQ %d\n", irq);
-
-	irq_type = irqd_get_trigger_type(desc);
+	irq_type = irq_get_trigger_type(irq);
 	switch (irq_type) {
 	case IRQF_TRIGGER_RISING:
 		latch = false;
-- 
2.46.0


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

* [PATCH 10/15] iio: imu: inv_icm42600: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (8 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 09/15] iio: imu: bmi323: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 11/15] iio: imu: inv_mpu6050: " Jonathan Cameron
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index c3924cc6190e..93b5d7a3339c 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -673,7 +673,6 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
 {
 	struct device *dev = regmap_get_device(regmap);
 	struct inv_icm42600_state *st;
-	struct irq_data *irq_desc;
 	int irq_type;
 	bool open_drain;
 	int ret;
@@ -683,14 +682,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
 		return -ENODEV;
 	}
 
-	/* get irq properties, set trigger falling by default */
-	irq_desc = irq_get_irq_data(irq);
-	if (!irq_desc) {
-		dev_err(dev, "could not find IRQ %d\n", irq);
-		return -EINVAL;
-	}
-
-	irq_type = irqd_get_trigger_type(irq_desc);
+	irq_type = irq_get_trigger_type(irq);
 	if (!irq_type)
 		irq_type = IRQF_TRIGGER_FALLING;
 
-- 
2.46.0


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

* [PATCH 11/15] iio: imu: inv_mpu6050: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (9 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 10/15] iio: imu: inv_icm42600: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-01 13:59 ` [PATCH 12/15] iio: imu: st_lsm6dsx: " Jonathan Cameron
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 14d95f34e981..fdb48c5e5686 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1859,7 +1859,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	struct inv_mpu6050_platform_data *pdata;
 	struct device *dev = regmap_get_device(regmap);
 	int result;
-	struct irq_data *desc;
 	int irq_type;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
@@ -1893,13 +1892,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	if (irq > 0) {
-		desc = irq_get_irq_data(irq);
-		if (!desc) {
-			dev_err(dev, "Could not find IRQ %d\n", irq);
-			return -EINVAL;
-		}
-
-		irq_type = irqd_get_trigger_type(desc);
+		irq_type = irq_get_trigger_type(irq);
 		if (!irq_type)
 			irq_type = IRQF_TRIGGER_RISING;
 	} else {
-- 
2.46.0


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

* [PATCH 12/15] iio: imu: st_lsm6dsx: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (10 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 11/15] iio: imu: inv_mpu6050: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:40   ` Lorenzo Bianconi
  2024-09-02 11:47   ` Andy Shevchenko
  2024-09-01 13:59 ` [PATCH 13/15] iio: light: st_uvis25: " Jonathan Cameron
                   ` (3 subsequent siblings)
  15 siblings, 2 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index ed0267929725..ca1a2c24d7ce 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2531,7 +2531,7 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
 	bool irq_active_low;
 	int err;
 
-	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
+	irq_type = irq_get_trigger_type(hw->irq);
 
 	switch (irq_type) {
 	case IRQF_TRIGGER_HIGH:
-- 
2.46.0


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

* [PATCH 13/15] iio: light: st_uvis25: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (11 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 12/15] iio: imu: st_lsm6dsx: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 11:47   ` Andy Shevchenko
  2024-09-02 13:42   ` Lorenzo Bianconi
  2024-09-01 13:59 ` [PATCH 14/15] iio: magn: ak8974: " Jonathan Cameron
                   ` (2 subsequent siblings)
  15 siblings, 2 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c
index fba3997574bb..4a58591c3bea 100644
--- a/drivers/iio/light/st_uvis25_core.c
+++ b/drivers/iio/light/st_uvis25_core.c
@@ -174,7 +174,7 @@ static int st_uvis25_allocate_trigger(struct iio_dev *iio_dev)
 	unsigned long irq_type;
 	int err;
 
-	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
+	irq_type = irq_get_trigger_type(hw->irq);
 
 	switch (irq_type) {
 	case IRQF_TRIGGER_HIGH:
-- 
2.46.0


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

* [PATCH 14/15] iio: magn: ak8974: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (12 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 13/15] iio: light: st_uvis25: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02  9:14   ` Linus Walleij
  2024-09-01 13:59 ` [PATCH 15/15] iio: pressure: bmp280: " Jonathan Cameron
  2024-09-02 11:49 ` [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Andy Shevchenko
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/magnetometer/ak8974.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index 961b1e0bfb13..8306a18706ac 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -910,7 +910,7 @@ static int ak8974_probe(struct i2c_client *i2c)
 
 	/* If we have a valid DRDY IRQ, make use of it */
 	if (irq > 0) {
-		irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
+		irq_trig = irq_get_trigger_type(irq);
 		if (irq_trig == IRQF_TRIGGER_RISING) {
 			dev_info(&i2c->dev, "enable rising edge DRDY IRQ\n");
 		} else if (irq_trig == IRQF_TRIGGER_FALLING) {
-- 
2.46.0


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

* [PATCH 15/15] iio: pressure: bmp280: use irq_get_trigger_type()
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (13 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 14/15] iio: magn: ak8974: " Jonathan Cameron
@ 2024-09-01 13:59 ` Jonathan Cameron
  2024-09-02 17:21   ` Vasileios Amoiridis
  2024-09-02 11:49 ` [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Andy Shevchenko
  15 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-01 13:59 UTC (permalink / raw)
  To: linux-iio
  Cc: Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Use irq_get_trigger_type() to replace getting the irq data then the
type in two steps.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/pressure/bmp280-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index da379230c837..b156dd763cf3 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -2596,7 +2596,7 @@ static int bmp085_fetch_eoc_irq(struct device *dev,
 	unsigned long irq_trig;
 	int ret;
 
-	irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
+	irq_trig = irq_get_trigger_type(irq);
 	if (irq_trig != IRQF_TRIGGER_RISING) {
 		dev_err(dev, "non-rising trigger given for EOC interrupt, trying to enforce it\n");
 		irq_trig = IRQF_TRIGGER_RISING;
-- 
2.46.0


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

* Re: [PATCH 06/15] iio: gyro: mpu3050: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 06/15] iio: gyro: mpu3050: " Jonathan Cameron
@ 2024-09-02  9:13   ` Linus Walleij
  2024-09-02 11:46   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Linus Walleij @ 2024-09-02  9:13 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 1, 2024 at 4:00 PM Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 14/15] iio: magn: ak8974: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 14/15] iio: magn: ak8974: " Jonathan Cameron
@ 2024-09-02  9:14   ` Linus Walleij
  0 siblings, 0 replies; 38+ messages in thread
From: Linus Walleij @ 2024-09-02  9:14 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 1, 2024 at 4:01 PM Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 02/15] iio: accel: fxls8962af: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 02/15] iio: accel: fxls8962af: " Jonathan Cameron
@ 2024-09-02  9:20   ` Sean Nyekjaer
  2024-09-02 11:41   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Sean Nyekjaer @ 2024-09-02  9:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:37PM UTC, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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

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

* Re: [PATCH 12/15] iio: imu: st_lsm6dsx: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 12/15] iio: imu: st_lsm6dsx: " Jonathan Cameron
@ 2024-09-02 11:40   ` Lorenzo Bianconi
  2024-09-02 11:47   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Lorenzo Bianconi @ 2024-09-02 11:40 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Linus Walleij,
	Danila Tikhonov, Jagath Jog J, Jean-Baptiste Maneyrol,
	Vasileios Amoiridis, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

On Sep 01, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index ed0267929725..ca1a2c24d7ce 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2531,7 +2531,7 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
>  	bool irq_active_low;
>  	int err;
>  
> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);
>  
>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:
> -- 
> 2.46.0
> 
> 

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 02/15] iio: accel: fxls8962af: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 02/15] iio: accel: fxls8962af: " Jonathan Cameron
  2024-09-02  9:20   ` Sean Nyekjaer
@ 2024-09-02 11:41   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:37PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(irq));
> +	irq_type = irq_get_trigger_type(irq);

>  

While at it, I would drop this blank line as well. Because the next line is
quite coupled with the previous one.

>  	switch (irq_type) {

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 03/15] iio: adc: ti-ads1015: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 03/15] iio: adc: ti-ads1015: " Jonathan Cameron
@ 2024-09-02 11:42   ` Andy Shevchenko
  0 siblings, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:38PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

>  		unsigned long irq_trig =
> -			irqd_get_trigger_type(irq_get_irq_data(client->irq));
> +			irq_get_trigger_type(client->irq);

Now a single line?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/15] iio: common: st: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 04/15] iio: common: st: " Jonathan Cameron
@ 2024-09-02 11:44   ` Andy Shevchenko
  2024-09-07 14:19     ` Jonathan Cameron
  0 siblings, 1 reply; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:44 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:39PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_trig = irqd_get_trigger_type(irq_get_irq_data(sdata->irq));
> +	irq_trig = irq_get_trigger_type(sdata->irq);

Usually I think the

	/* ...comment on flow... */
	foo = bar();
	...something with foo that is commented above...

is slightly better as after reading the comment we immediately see where the
foo comes from.

>  	/*
>  	 * If the IRQ is triggered on falling edge, we need to mark the
>  	 * interrupt as active low, if the hardware supports this.

But, it's not a big deal.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 05/15] iio: gyro: fxas21002c: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 05/15] iio: gyro: fxas21002c: " Jonathan Cameron
@ 2024-09-02 11:44   ` Andy Shevchenko
  0 siblings, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:44 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:40PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_trig = irqd_get_trigger_type(irq_get_irq_data(data->irq));
> +	irq_trig = irq_get_trigger_type(data->irq);

>  

No blank line?

>  	if (irq_trig == IRQF_TRIGGER_RISING) {
>  		ret = regmap_field_write(data->regmap_fields[F_IPOL], 1);

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 08/15] iio: imu: bmi160: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 08/15] iio: imu: bmi160: " Jonathan Cameron
@ 2024-09-02 11:45   ` Andy Shevchenko
  2024-09-07 14:26     ` Jonathan Cameron
  0 siblings, 1 reply; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:45 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:43PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

>  {
> -	struct irq_data *desc;
> -	u32 irq_type;
>  	int ret;
> -
> -	desc = irq_get_irq_data(irq);
> -	if (!desc) {
> -		dev_err(&indio_dev->dev, "Could not find IRQ %d\n", irq);
> -		return -EINVAL;
> -	}
> -
> -	irq_type = irqd_get_trigger_type(desc);
> +	u32 irq_type = irq_get_trigger_type(irq);

Hmm... You broke the reversed xmas tree ordering.
Anyway, can we actually

>  	ret = bmi160_config_device_irq(indio_dev, irq_type, pin);

	ret = bmi160_config_device_irq(indio_dev, irq_get_trigger_type(irq), pin);

instead?

>  	if (ret)

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 07/15] iio: humidity: hts221: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 07/15] iio: humidity: hts221: " Jonathan Cameron
@ 2024-09-02 11:46   ` Andy Shevchenko
  2024-09-02 13:42   ` Lorenzo Bianconi
  1 sibling, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:42PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);

>  

No blank line?

>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 06/15] iio: gyro: mpu3050: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 06/15] iio: gyro: mpu3050: " Jonathan Cameron
  2024-09-02  9:13   ` Linus Walleij
@ 2024-09-02 11:46   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:41PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
> +	irq_trig = irq_get_trigger_type(irq);

Same remark about comment vs. assignment.

>  	/*
>  	 * Configure the interrupt generator hardware to supply whatever
>  	 * the interrupt is configured for, edges low/high level low/high,

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 12/15] iio: imu: st_lsm6dsx: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 12/15] iio: imu: st_lsm6dsx: " Jonathan Cameron
  2024-09-02 11:40   ` Lorenzo Bianconi
@ 2024-09-02 11:47   ` Andy Shevchenko
  1 sibling, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:47PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);

>  

No blank line?

>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 13/15] iio: light: st_uvis25: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 13/15] iio: light: st_uvis25: " Jonathan Cameron
@ 2024-09-02 11:47   ` Andy Shevchenko
  2024-09-02 18:19     ` Jonathan Cameron
  2024-09-02 13:42   ` Lorenzo Bianconi
  1 sibling, 1 reply; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:48PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.

...

> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);

>  

No blank line?

>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding.
  2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
                   ` (14 preceding siblings ...)
  2024-09-01 13:59 ` [PATCH 15/15] iio: pressure: bmp280: " Jonathan Cameron
@ 2024-09-02 11:49 ` Andy Shevchenko
  2024-09-07 14:35   ` Jonathan Cameron
  15 siblings, 1 reply; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-02 11:49 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:35PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Andy pointed out in a review that there is an irq_get_trigger_type()
> helper that first gets the irq data then extracts the type from it.
> This saves on opencoding those two steps when the irq data isn't used
> for anything else.
> 
> Update all the sites this pattern occurs in IIO to use the helper.
> In a few cases there will be a slightly different error message is
> somehow there is a valid irq number passed to this call and it doesn't
> have the data associated with it.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

There are some nit-picks, up to you how to proceed with them (only one seems
better to address is where the reversed xmas tree ordering is broken).

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 07/15] iio: humidity: hts221: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 07/15] iio: humidity: hts221: " Jonathan Cameron
  2024-09-02 11:46   ` Andy Shevchenko
@ 2024-09-02 13:42   ` Lorenzo Bianconi
  1 sibling, 0 replies; 38+ messages in thread
From: Lorenzo Bianconi @ 2024-09-02 13:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Linus Walleij,
	Danila Tikhonov, Jagath Jog J, Jean-Baptiste Maneyrol,
	Vasileios Amoiridis, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]

On Sep 01, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/humidity/hts221_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
> index 11ef38994a95..0272065cc44a 100644
> --- a/drivers/iio/humidity/hts221_buffer.c
> +++ b/drivers/iio/humidity/hts221_buffer.c
> @@ -81,7 +81,7 @@ int hts221_allocate_trigger(struct iio_dev *iio_dev)
>  	unsigned long irq_type;
>  	int err;
>  
> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);
>  
>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:
> -- 
> 2.46.0
> 
> 

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 13/15] iio: light: st_uvis25: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 13/15] iio: light: st_uvis25: " Jonathan Cameron
  2024-09-02 11:47   ` Andy Shevchenko
@ 2024-09-02 13:42   ` Lorenzo Bianconi
  1 sibling, 0 replies; 38+ messages in thread
From: Lorenzo Bianconi @ 2024-09-02 13:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Linus Walleij,
	Danila Tikhonov, Jagath Jog J, Jean-Baptiste Maneyrol,
	Vasileios Amoiridis, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

On Sep 01, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/light/st_uvis25_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c
> index fba3997574bb..4a58591c3bea 100644
> --- a/drivers/iio/light/st_uvis25_core.c
> +++ b/drivers/iio/light/st_uvis25_core.c
> @@ -174,7 +174,7 @@ static int st_uvis25_allocate_trigger(struct iio_dev *iio_dev)
>  	unsigned long irq_type;
>  	int err;
>  
> -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> +	irq_type = irq_get_trigger_type(hw->irq);
>  
>  	switch (irq_type) {
>  	case IRQF_TRIGGER_HIGH:
> -- 
> 2.46.0
> 

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 15/15] iio: pressure: bmp280: use irq_get_trigger_type()
  2024-09-01 13:59 ` [PATCH 15/15] iio: pressure: bmp280: " Jonathan Cameron
@ 2024-09-02 17:21   ` Vasileios Amoiridis
  0 siblings, 0 replies; 38+ messages in thread
From: Vasileios Amoiridis @ 2024-09-02 17:21 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Antoniu Miclaus, Sean Nyekjaer,
	Marek Vasut, Denis Ciocca, Rui Miguel Silva, Linus Walleij,
	Danila Tikhonov, Jagath Jog J, Jean-Baptiste Maneyrol,
	Lorenzo Bianconi, Vasileios Amoiridis, Jonathan Cameron

On Sun, Sep 01, 2024 at 02:59:50PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Use irq_get_trigger_type() to replace getting the irq data then the
> type in two steps.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/pressure/bmp280-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index da379230c837..b156dd763cf3 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -2596,7 +2596,7 @@ static int bmp085_fetch_eoc_irq(struct device *dev,
>  	unsigned long irq_trig;
>  	int ret;
>  
> -	irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
> +	irq_trig = irq_get_trigger_type(irq);
>  	if (irq_trig != IRQF_TRIGGER_RISING) {
>  		dev_err(dev, "non-rising trigger given for EOC interrupt, trying to enforce it\n");
>  		irq_trig = IRQF_TRIGGER_RISING;
> -- 
> 2.46.0
> 

Hi Jonathan,

Tested-by: Vasileios Amoiridis <vassilisamir@gmail.com>

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

* Re: [PATCH 13/15] iio: light: st_uvis25: use irq_get_trigger_type()
  2024-09-02 11:47   ` Andy Shevchenko
@ 2024-09-02 18:19     ` Jonathan Cameron
  2024-09-03 14:12       ` Andy Shevchenko
  0 siblings, 1 reply; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-02 18:19 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Mon, 2 Sep 2024 14:47:59 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Sep 01, 2024 at 02:59:48PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Use irq_get_trigger_type() to replace getting the irq data then the
> > type in two steps.  
> 
> ...
> 
> > -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> > +	irq_type = irq_get_trigger_type(hw->irq);  
> 
> >    
> 
> No blank line?
> 
Might was well roll it into the switch now you mention it!

Jonathan

> >  	switch (irq_type) {
> >  	case IRQF_TRIGGER_HIGH:  
> 


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

* Re: [PATCH 13/15] iio: light: st_uvis25: use irq_get_trigger_type()
  2024-09-02 18:19     ` Jonathan Cameron
@ 2024-09-03 14:12       ` Andy Shevchenko
  0 siblings, 0 replies; 38+ messages in thread
From: Andy Shevchenko @ 2024-09-03 14:12 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Mon, Sep 02, 2024 at 07:19:26PM +0100, Jonathan Cameron wrote:
> On Mon, 2 Sep 2024 14:47:59 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > On Sun, Sep 01, 2024 at 02:59:48PM +0100, Jonathan Cameron wrote:

...

> > > -	irq_type = irqd_get_trigger_type(irq_get_irq_data(hw->irq));
> > > +	irq_type = irq_get_trigger_type(hw->irq);  
> > 
> > >    
> > 
> > No blank line?

> Might was well roll it into the switch now you mention it!

I think it's discussable (from the readability perspective), but FWIW, I'm fine
with any of your choices here.

> > >  	switch (irq_type) {
> > >  	case IRQF_TRIGGER_HIGH:  

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/15] iio: common: st: use irq_get_trigger_type()
  2024-09-02 11:44   ` Andy Shevchenko
@ 2024-09-07 14:19     ` Jonathan Cameron
  0 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-07 14:19 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Mon, 2 Sep 2024 14:44:06 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Sep 01, 2024 at 02:59:39PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Use irq_get_trigger_type() to replace getting the irq data then the
> > type in two steps.  
> 
> ...
> 
> > -	irq_trig = irqd_get_trigger_type(irq_get_irq_data(sdata->irq));
> > +	irq_trig = irq_get_trigger_type(sdata->irq);  
> 
> Usually I think the
> 
> 	/* ...comment on flow... */
> 	foo = bar();
> 	...something with foo that is commented above...
> 
> is slightly better as after reading the comment we immediately see where the
> foo comes from.
> 
> >  	/*
> >  	 * If the IRQ is triggered on falling edge, we need to mark the
> >  	 * interrupt as active low, if the hardware supports this.  
> 
> But, it's not a big deal.
Agreed it makes sense.

This just goes to show how little I looked at surrounding code
when putting this set together.

I've reordered and added a note on that to the description.
> 


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

* Re: [PATCH 08/15] iio: imu: bmi160: use irq_get_trigger_type()
  2024-09-02 11:45   ` Andy Shevchenko
@ 2024-09-07 14:26     ` Jonathan Cameron
  0 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-07 14:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Mon, 2 Sep 2024 14:45:52 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Sep 01, 2024 at 02:59:43PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Use irq_get_trigger_type() to replace getting the irq data then the
> > type in two steps.  
> 
> ...
> 
> >  {
> > -	struct irq_data *desc;
> > -	u32 irq_type;
> >  	int ret;
> > -
> > -	desc = irq_get_irq_data(irq);
> > -	if (!desc) {
> > -		dev_err(&indio_dev->dev, "Could not find IRQ %d\n", irq);
> > -		return -EINVAL;
> > -	}
> > -
> > -	irq_type = irqd_get_trigger_type(desc);
> > +	u32 irq_type = irq_get_trigger_type(irq);  
> 
> Hmm... You broke the reversed xmas tree ordering.
> Anyway, can we actually
I put this back.
> 
> >  	ret = bmi160_config_device_irq(indio_dev, irq_type, pin);  
> 
> 	ret = bmi160_config_device_irq(indio_dev, irq_get_trigger_type(irq), pin);
> 
> instead?
Nope. irq_type is passed into the probe_trigger function outside the context
we can see in the patch.

Jonathan
> 
> >  	if (ret)  
> 


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

* Re: [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding.
  2024-09-02 11:49 ` [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Andy Shevchenko
@ 2024-09-07 14:35   ` Jonathan Cameron
  0 siblings, 0 replies; 38+ messages in thread
From: Jonathan Cameron @ 2024-09-07 14:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Antoniu Miclaus, Sean Nyekjaer, Marek Vasut,
	Denis Ciocca, Rui Miguel Silva, Linus Walleij, Danila Tikhonov,
	Jagath Jog J, Jean-Baptiste Maneyrol, Lorenzo Bianconi,
	Vasileios Amoiridis, Jonathan Cameron

On Mon, 2 Sep 2024 14:49:19 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Sep 01, 2024 at 02:59:35PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Andy pointed out in a review that there is an irq_get_trigger_type()
> > helper that first gets the irq data then extracts the type from it.
> > This saves on opencoding those two steps when the irq data isn't used
> > for anything else.
> > 
> > Update all the sites this pattern occurs in IIO to use the helper.
> > In a few cases there will be a slightly different error message is
> > somehow there is a valid irq number passed to this call and it doesn't
> > have the data associated with it.  
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> There are some nit-picks, up to you how to proceed with them (only one seems
> better to address is where the reversed xmas tree ordering is broken).
> 
I made the changes suggested.  Applied to the togreg branch of iio.git.

I think these will probably wait for next cycle now given timing.

Jonathan



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

end of thread, other threads:[~2024-09-07 14:35 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-01 13:59 [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Jonathan Cameron
2024-09-01 13:59 ` [PATCH 01/15] iio: accel: adxl380: use irq_get_trigger_type() Jonathan Cameron
2024-09-01 13:59 ` [PATCH 02/15] iio: accel: fxls8962af: " Jonathan Cameron
2024-09-02  9:20   ` Sean Nyekjaer
2024-09-02 11:41   ` Andy Shevchenko
2024-09-01 13:59 ` [PATCH 03/15] iio: adc: ti-ads1015: " Jonathan Cameron
2024-09-02 11:42   ` Andy Shevchenko
2024-09-01 13:59 ` [PATCH 04/15] iio: common: st: " Jonathan Cameron
2024-09-02 11:44   ` Andy Shevchenko
2024-09-07 14:19     ` Jonathan Cameron
2024-09-01 13:59 ` [PATCH 05/15] iio: gyro: fxas21002c: " Jonathan Cameron
2024-09-02 11:44   ` Andy Shevchenko
2024-09-01 13:59 ` [PATCH 06/15] iio: gyro: mpu3050: " Jonathan Cameron
2024-09-02  9:13   ` Linus Walleij
2024-09-02 11:46   ` Andy Shevchenko
2024-09-01 13:59 ` [PATCH 07/15] iio: humidity: hts221: " Jonathan Cameron
2024-09-02 11:46   ` Andy Shevchenko
2024-09-02 13:42   ` Lorenzo Bianconi
2024-09-01 13:59 ` [PATCH 08/15] iio: imu: bmi160: " Jonathan Cameron
2024-09-02 11:45   ` Andy Shevchenko
2024-09-07 14:26     ` Jonathan Cameron
2024-09-01 13:59 ` [PATCH 09/15] iio: imu: bmi323: " Jonathan Cameron
2024-09-01 13:59 ` [PATCH 10/15] iio: imu: inv_icm42600: " Jonathan Cameron
2024-09-01 13:59 ` [PATCH 11/15] iio: imu: inv_mpu6050: " Jonathan Cameron
2024-09-01 13:59 ` [PATCH 12/15] iio: imu: st_lsm6dsx: " Jonathan Cameron
2024-09-02 11:40   ` Lorenzo Bianconi
2024-09-02 11:47   ` Andy Shevchenko
2024-09-01 13:59 ` [PATCH 13/15] iio: light: st_uvis25: " Jonathan Cameron
2024-09-02 11:47   ` Andy Shevchenko
2024-09-02 18:19     ` Jonathan Cameron
2024-09-03 14:12       ` Andy Shevchenko
2024-09-02 13:42   ` Lorenzo Bianconi
2024-09-01 13:59 ` [PATCH 14/15] iio: magn: ak8974: " Jonathan Cameron
2024-09-02  9:14   ` Linus Walleij
2024-09-01 13:59 ` [PATCH 15/15] iio: pressure: bmp280: " Jonathan Cameron
2024-09-02 17:21   ` Vasileios Amoiridis
2024-09-02 11:49 ` [PATCH 00/15] IIO: use irq_get_trigger_type() instead of opencoding Andy Shevchenko
2024-09-07 14:35   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).