[media] em28xx: Move ir/rc related initialization to em28xx_ir_init()
authorEzequiel García <elezegarcia@gmail.com>
Mon, 26 Mar 2012 12:13:32 +0000 (09:13 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 10 Apr 2012 23:41:39 +0000 (20:41 -0300)
Moving this helps isolating em28xx_input and will help
converting it into a separate module.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-i2c.c
drivers/media/video/em28xx/em28xx-input.c

index 9fd8cc7dbb23aaba65c3a09883bcb13500b07590..e3df8594ba26da57dfe45ca557f96b291b86cc32 100644 (file)
@@ -2849,13 +2849,6 @@ void em28xx_card_setup(struct em28xx *dev)
                break;
        }
 
-#if defined(CONFIG_MODULES) && defined(MODULE)
-       if (dev->board.has_ir_i2c && !disable_ir)
-               request_module("ir-kbd-i2c");
-#endif
-       if (dev->board.has_snapshot_button)
-               em28xx_register_snapshot_button(dev);
-
        if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
                em28xx_errdev("\n\n");
                em28xx_errdev("The support for this board weren't "
@@ -2972,9 +2965,6 @@ static void flush_request_modules(struct em28xx *dev)
 */
 void em28xx_release_resources(struct em28xx *dev)
 {
-       if (dev->sbutton_input_dev)
-               em28xx_deregister_snapshot_button(dev);
-
        if (dev->ir)
                em28xx_ir_fini(dev);
 
index a88e169dba23b74b15c710d88d23fd38e414680e..185db65b766ef5b58ab2f124d3c20491e8aaceeb 100644 (file)
@@ -553,9 +553,6 @@ int em28xx_i2c_register(struct em28xx *dev)
        if (i2c_scan)
                em28xx_do_i2c_scan(dev);
 
-       /* Instantiate the IR receiver device, if present */
-       em28xx_register_i2c_ir(dev);
-
        return 0;
 }
 
index 2630b265b0e813c5c6f450927367d3899933c013..dd6e3f2dfba9e476b99a71af2e3f971a1af1d6b1 100644 (file)
@@ -448,6 +448,15 @@ int em28xx_ir_init(struct em28xx *dev)
        if (err)
                goto err_out_stop;
 
+       em28xx_register_i2c_ir(dev);
+
+#if defined(CONFIG_MODULES) && defined(MODULE)
+       if (dev->board.has_ir_i2c)
+               request_module("ir-kbd-i2c");
+#endif
+       if (dev->board.has_snapshot_button)
+               em28xx_register_snapshot_button(dev);
+
        return 0;
 
  err_out_stop:
@@ -462,6 +471,8 @@ int em28xx_ir_fini(struct em28xx *dev)
 {
        struct em28xx_IR *ir = dev->ir;
 
+       em28xx_deregister_snapshot_button(dev);
+
        /* skip detach on non attached boards */
        if (!ir)
                return 0;