[media] adv7180: Do not request the IRQ again during resume
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 23 Jan 2015 15:52:20 +0000 (12:52 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 2 Feb 2015 13:15:03 +0000 (11:15 -0200)
Currently the IRQ is requested from within the init_device() function. This
function is not only called during device probe, but also during resume
causing the driver to try to request the IRQ again. Move requesting the IRQ
from init_device() to the probe function to make sure that it is only
requested once.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/adv7180.c

index 94a3341b091bf0d56ad7cdcac85638096e78abbc..7666d10d3f16b4aa546cb7e264773075df08d864 100644 (file)
@@ -553,11 +553,6 @@ static int init_device(struct i2c_client *client, struct adv7180_state *state)
 
        /* register for interrupts */
        if (state->irq > 0) {
-               ret = request_threaded_irq(state->irq, NULL, adv7180_irq,
-                                          IRQF_ONESHOT, KBUILD_MODNAME, state);
-               if (ret)
-                       return ret;
-
                ret = i2c_smbus_write_byte_data(client, ADV7180_ADI_CTRL_REG,
                                                ADV7180_ADI_CTRL_IRQ_SPACE);
                if (ret < 0)
@@ -597,7 +592,6 @@ static int init_device(struct i2c_client *client, struct adv7180_state *state)
        return 0;
 
 err:
-       free_irq(state->irq, state);
        return ret;
 }
 
@@ -634,6 +628,13 @@ static int adv7180_probe(struct i2c_client *client,
        if (ret)
                goto err_free_ctrl;
 
+       if (state->irq) {
+               ret = request_threaded_irq(client->irq, NULL, adv7180_irq,
+                                          IRQF_ONESHOT, KBUILD_MODNAME, state);
+               if (ret)
+                       goto err_free_ctrl;
+       }
+
        ret = v4l2_async_register_subdev(sd);
        if (ret)
                goto err_free_irq;