drxk: allow loading firmware synchrousnously
authorMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 2 Oct 2012 19:01:15 +0000 (16:01 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 2 Oct 2012 20:15:16 +0000 (17:15 -0300)
Due to udev-182, the firmware load was changed to be async, as
otherwise udev would give up of loading a firmware.

Add an option to return to the previous behaviour, async firmware
loads cause failures with the tda18271 driver.

Antti tested it with the following hardware:
        Hauppauge WinTV HVR 930C
        MaxMedia UB425-TC
        PCTV QuatroStick nano (520e)

Tested-by: Antti Palosaari <crope@iki.fi>
Cc: stable@kernel.org # for Kernel 3.6 - please note that driver location has changed
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb-frontends/drxk.h
drivers/media/dvb-frontends/drxk_hard.c

index d615d7d055a29dfba39b3fd6e9879830cd96a080..94fecfbf14c1278d70669e18d1b5c4a7d6ebdaf7 100644 (file)
@@ -28,6 +28,7 @@
  *                             A value of 0 (default) or lower indicates that
  *                             the correct number of parameters will be
  *                             automatically detected.
+ * @load_firmware_sync:                Force the firmware load to be synchronous.
  *
  * On the *_gpio vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
  * UIO-3.
@@ -39,6 +40,7 @@ struct drxk_config {
        bool    parallel_ts;
        bool    dynamic_clk;
        bool    enable_merr_cfg;
+       bool    load_firmware_sync;
 
        bool    antenna_dvbt;
        u16     antenna_gpio;
index 1ab8154542daebc056912efbdb7866bedae7304d..8b4c6d5f8f3694d330dfd50d36ae9ef870af4339 100644 (file)
@@ -6609,15 +6609,25 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config,
 
        /* Load firmware and initialize DRX-K */
        if (state->microcode_name) {
-               status = request_firmware_nowait(THIS_MODULE, 1,
+               if (config->load_firmware_sync) {
+                       const struct firmware *fw = NULL;
+
+                       status = request_firmware(&fw, state->microcode_name,
+                                                 state->i2c->dev.parent);
+                       if (status < 0)
+                               fw = NULL;
+                       load_firmware_cb(fw, state);
+               } else {
+                       status = request_firmware_nowait(THIS_MODULE, 1,
                                              state->microcode_name,
                                              state->i2c->dev.parent,
                                              GFP_KERNEL,
                                              state, load_firmware_cb);
-               if (status < 0) {
-                       printk(KERN_ERR
-                       "drxk: failed to request a firmware\n");
-                       return NULL;
+                       if (status < 0) {
+                               printk(KERN_ERR
+                                      "drxk: failed to request a firmware\n");
+                               return NULL;
+                       }
                }
        } else if (init_drxk(state) < 0)
                goto error;