[PATCH 3/5] i2c: pmcmsp: fix-IRQ-check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The driver's probe() method is written as if platform_get_irq() returns 0
on error, while actually it returns a negative error code (with all the
other values considered valid IRQs).  Rewrite the driver's IRQ checking
code to pass the positive IRQ #s to request_irq(), propagate -EPROBE_DEFER
upstream, and use the polling mode when platform_get_irq() returns negative
error code or 0...

Fixes: 1b144df1d7d6 ("i2c: New PMC MSP71xx TWI bus driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx>

---
 drivers/i2c/busses/i2c-pmcmsp.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux/drivers/i2c/busses/i2c-pmcmsp.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-pmcmsp.c
+++ linux/drivers/i2c/busses/i2c-pmcmsp.c
@@ -291,8 +291,13 @@ static int pmcmsptwi_probe(struct platfo
 	}
 
 	/* request the irq */
-	pmcmsptwi_data.irq = platform_get_irq(pldev, 0);
-	if (pmcmsptwi_data.irq) {
+	rc = platform_get_irq(pldev, 0);
+	if (rc == -EPROBE_DEFER)
+		return rc;
+	if (rc <= 0) {
+		pmcmsptwi_data.irq = 0;
+	} else {
+		pmcmsptwi_data.irq = rc;
 		rc = request_irq(pmcmsptwi_data.irq, &pmcmsptwi_interrupt,
 				 IRQF_SHARED, pldev->name, &pmcmsptwi_data);
 		if (rc == 0) {





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux