diff mbox series

[13/15] iio: light: st_uvis25: use irq_get_trigger_type()

Message ID 20240901135950.797396-14-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/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko Sept. 2, 2024, 11:47 a.m. UTC | #1
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:
Lorenzo Bianconi Sept. 2, 2024, 1:42 p.m. UTC | #2
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>
Jonathan Cameron Sept. 2, 2024, 6:19 p.m. UTC | #3
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:  
>
Andy Shevchenko Sept. 3, 2024, 2:12 p.m. UTC | #4
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:
diff mbox series

Patch

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: