Skip to contentSkip to conversation

Use functionality of irq_get_trigger_type()

PATCH In review Vasileios Amoiridis 2 participants 6 messages Sep 12, 2024 – Sep 13, 2024 Userspace I/O (UIO)

lore
Share & tools
lore
#0 lore raw

cover Use functionality of irq_get_trigger_type()

Use the irq_get_trigger_type() function which internally calls the irq_get_trigger_data(), to remove check and remove the irqd_get_trigger_type().

The series is compile tested.

Vasileios Amoiridis (2):
uio: uio_dmem_genirq: Make use of irq_get_trigger_type()
uio: uio_pdrv_genirq: Make use of irq_get_trigger_type()

 drivers/uio/uio_dmem_genirq.c | 5 +----
 drivers/uio/uio_pdrv_genirq.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

base-commit: 57f962b956f1d116cd64d5c406776c4975de549d

Signature · 1 line
2.25.1
#1 lore raw

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

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.

---
 drivers/uio/uio_dmem_genirq.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/uio/uio_dmem_genirq.c +1 -4
index 13cc35ab5d29..c70dd81bfc61 100644
@@ -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

Signature · 1 line
2.25.1
#2 lore raw

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

Quoted 8 lines · Vasileios Amoiridis

Convert the following case:

        struct irq_data *irq_data = irq_get_irq_data(irq);

        if (irq_data && irqd_get_trigger_type(irq_data) ... ) {
                ...
        }
Quoted 7 lines

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

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

Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Vasileios Amoiridis

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:

Quoted 13 lines
Quoted 5 lines
        if (irq_get_trigger_type(irq) ... ) {
                ...
        }

by using the irq_get_trigger_type() function.

Btw, can you add a coccinelle ruleset for this?

Signature · 2 lines
With Best Regards,
Andy Shevchenko

Hi Andy!

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

Cheers,
Vasilis

#4 lore raw

PATCH 2/2 uio: uio_pdrv_genirq: Make use of irq_get_trigger_type()

In reply to Vasileios Amoiridis

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.

---
 drivers/uio/uio_pdrv_genirq.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/uio/uio_pdrv_genirq.c +1 -4
index 796f5be0a086..2ec7d25e8264 100644
@@ -173,8 +173,6 @@ static int uio_pdrv_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
@@ -182,8 +180,7 @@ static int uio_pdrv_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);
 		}
Signature · 1 line
2.25.1