diff mbox series

[04/15] iio: common: st: use irq_get_trigger_type()

Message ID 20240901135950.797396-5-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: use irq_get_trigger_type() instead of opencoding. | expand

Commit Message

Jonathan Cameron Sept. 1, 2024, 1:59 p.m. UTC
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(-)

Comments

Andy Shevchenko Sept. 2, 2024, 11:44 a.m. UTC | #1
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.
Jonathan Cameron Sept. 7, 2024, 2:19 p.m. UTC | #2
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.
>
diff mbox series

Patch

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.