Skip to contentSkip to conversation

UIO: uio_pdrv_genirq: allow custom irq_flags

PATCH In review Mike Frysinger 2 participants 2 messages Oct 29, 2008 Userspace I/O (UIO)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 UIO: uio_pdrv_genirq: allow custom irq_flags

I can't think of a reason why the driver prevents people from setting any custom bits in their platform device, but I can think of some reasons for allowing custom flags. Like setting the IRQF_TRIGGER_... bits.

---
v2
- disallow IRQF_SHARED in irq_flags

 drivers/uio/uio_pdrv_genirq.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/uio/uio_pdrv_genirq.c +3 -2
index 1f82c83..3f06818 100644
@@ -81,7 +81,8 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 		goto bad0;
 	}
 
-	if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) {
+	if (uioinfo->handler || uioinfo->irqcontrol ||
+	    uioinfo->irq_flags & IRQF_SHARED) {
 		dev_err(&pdev->dev, "interrupt configuration error\n");
 		goto bad0;
 	}
@@ -132,7 +133,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	 * Interrupt sharing is not supported.
 	 */
 
-	uioinfo->irq_flags = IRQF_DISABLED;
+	uioinfo->irq_flags |= IRQF_DISABLED;
 	uioinfo->handler = uio_pdrv_genirq_handler;
 	uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol;
 	uioinfo->priv = priv;
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 3 lines · Mike Frysinger

I can't think of a reason why the driver prevents people from setting any custom bits in their platform device, but I can think of some reasons for allowing custom flags. Like setting the IRQF_TRIGGER_... bits.

We wanted to prevent users from setting IRQF_SHARED in their platform code, because uio_pdrv_genirq.c explicitly relies on an interrupt not being shared. This code explicitly checks for IRQF_SHARED and lets uio_pdrv_genirq_probe() fail if it's set. This allows users to set other IRQF_* flags. That's an improvement and looks alright to me.

Quoted 2 lines
Quoted 32 lines

---
v2
- disallow IRQF_SHARED in irq_flags

 drivers/uio/uio_pdrv_genirq.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/uio/uio_pdrv_genirq.c +3 -2
index 1f82c83..3f06818 100644
@@ -81,7 +81,8 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 		goto bad0;
 	}
 
-	if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) {
+	if (uioinfo->handler || uioinfo->irqcontrol ||
+	    uioinfo->irq_flags & IRQF_SHARED) {
 		dev_err(&pdev->dev, "interrupt configuration error\n");
 		goto bad0;
 	}
@@ -132,7 +133,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	 * Interrupt sharing is not supported.
 	 */
 
-	uioinfo->irq_flags = IRQF_DISABLED;
+	uioinfo->irq_flags |= IRQF_DISABLED;
 	uioinfo->handler = uio_pdrv_genirq_handler;
 	uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol;
 	uioinfo->priv = priv;
Signature · 1 line
1.6.0.2