that way all our IRQ handling will happen in thread. Signed-off-by: Felipe Balbi <balbi@xxxxxx> --- drivers/i2c/busses/i2c-omap.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index a9c1fa6..6e0b406 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -865,7 +865,23 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes, } static irqreturn_t -omap_i2c_isr(int this_irq, void *dev_id) +omap_i2c_isr(int irq, void *_dev) +{ + struct omap_i2c_dev *dev = _dev; + u16 stat; + u16 bits; + + stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); + bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); + + if (stat & bits) + return IRQ_WAKE_THREAD; + + return IRQ_HANDLED; +} + +static irqreturn_t +omap_i2c_threaded_isr(int this_irq, void *dev_id) { struct omap_i2c_dev *dev = dev_id; u16 bits; @@ -1055,7 +1071,6 @@ omap_i2c_probe(struct platform_device *pdev) struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; struct device_node *node = pdev->dev.of_node; const struct of_device_id *match; - irq_handler_t isr; int r; /* NOTE: driver uses the static register mapping */ @@ -1155,9 +1170,12 @@ omap_i2c_probe(struct platform_device *pdev) /* reset ASAP, clearing any IRQs */ omap_i2c_init(dev); - isr = (dev->rev < OMAP_I2C_OMAP1_REV_2) ? omap_i2c_omap1_isr : - omap_i2c_isr; - r = request_irq(dev->irq, isr, 0, pdev->name, dev); + if (dev->rev < OMAP_I2C_OMAP1_REV_2) + r = request_irq(dev->irq, omap_i2c_omap1_isr, 0, + pdev->name, dev); + else + r = request_threaded_irq(dev->irq, omap_i2c_isr, + omap_i2c_threaded_isr, 0, pdev->name, dev); if (r) { dev_err(dev->dev, "failure requesting irq %i\n", dev->irq); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html