[PATCH v1 1/2] uio: uio_dmem_genirq: Make use of irq_get_trigger_type()

Vasileios Amoiridis posted 2 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH v1 1/2] uio: uio_dmem_genirq: Make use of irq_get_trigger_type()
Posted by Vasileios Amoiridis 2 months, 2 weeks ago
Convert the following case:

        struct irq_data *irq_data = irq_get_irq_data(irq);

        if (irq_data && irqd_get_trigger_type(irq_data) ... ) {
                ...
        }

to the simpler:

        if (irq_get_trigger_type(irq) ... ) {
                ...
        }

by using the irq_get_trigger_type() function.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 drivers/uio/uio_dmem_genirq.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index 13cc35ab5d29..c70dd81bfc61 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -210,8 +210,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 	}
 
 	if (uioinfo->irq) {
-		struct irq_data *irq_data = irq_get_irq_data(uioinfo->irq);
-
 		/*
 		 * If a level interrupt, dont do lazy disable. Otherwise the
 		 * irq will fire again since clearing of the actual cause, on
@@ -219,8 +217,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 		 * irqd_is_level_type() isn't used since isn't valid until
 		 * irq is configured.
 		 */
-		if (irq_data &&
-		    irqd_get_trigger_type(irq_data) & IRQ_TYPE_LEVEL_MASK) {
+		if (irq_get_trigger_type(uioinfo->irq) & IRQ_TYPE_LEVEL_MASK) {
 			dev_dbg(&pdev->dev, "disable lazy unmask\n");
 			irq_set_status_flags(uioinfo->irq, IRQ_DISABLE_UNLAZY);
 		}

base-commit: 57f962b956f1d116cd64d5c406776c4975de549d
-- 
2.25.1
Re: [PATCH v1 1/2] uio: uio_dmem_genirq: Make use of irq_get_trigger_type()
Posted by Andy Shevchenko 2 months, 2 weeks ago
On Fri, Sep 13, 2024 at 01:59:24AM +0200, Vasileios Amoiridis wrote:
> Convert the following case:
> 
>         struct irq_data *irq_data = irq_get_irq_data(irq);
> 
>         if (irq_data && irqd_get_trigger_type(irq_data) ... ) {
>                 ...
>         }
> 
> to the simpler:
> 
>         if (irq_get_trigger_type(irq) ... ) {
>                 ...
>         }
> 
> by using the irq_get_trigger_type() function.

Btw, can you add a coccinelle ruleset for this?

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v1 1/2] uio: uio_dmem_genirq: Make use of irq_get_trigger_type()
Posted by Vasileios Amoiridis 2 months, 2 weeks ago
On Fri, Sep 13, 2024 at 12:40:09PM +0300, Andy Shevchenko wrote:
> On Fri, Sep 13, 2024 at 01:59:24AM +0200, Vasileios Amoiridis wrote:
> > Convert the following case:
> > 
> >         struct irq_data *irq_data = irq_get_irq_data(irq);
> > 
> >         if (irq_data && irqd_get_trigger_type(irq_data) ... ) {
> >                 ...
> >         }
> > 
> > to the simpler:
> > 
> >         if (irq_get_trigger_type(irq) ... ) {
> >                 ...
> >         }
> > 
> > by using the irq_get_trigger_type() function.
> 
> Btw, can you add a coccinelle ruleset for this?
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Hi Andy!

Thanks for the time for the review! Yes, I would like to try it.

Cheers,
Vasilis