[media] dvb_usb_v2: restore .firmware - pointer to name
authorAntti Palosaari <crope@iki.fi>
Fri, 25 May 2012 15:28:43 +0000 (12:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:22 +0000 (07:56 -0300)
Most commonly only one firmware is used by the driver
and it is not needed to selected run time. So restore
old functionality but allow .get_firmware_name() callback
to override it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dvb_usb.h
drivers/media/dvb/dvb-usb/dvb_usb_firmware.c

index 974337ddc5c4b1f919b2ea6f41f0156d709b437c..716f174556697e928296ed397c02de3d4c6ca800 100644 (file)
@@ -219,12 +219,13 @@ struct dvb_usb_device_properties {
 #define CYPRESS_FX2     3
        int        usb_ctrl;
 
+       int size_of_priv;
+
+       const char *firmware;
+       int (*get_firmware_name) (struct dvb_usb_device *, const char **);
 #define RECONNECTS_USB                  1
        int (*download_firmware) (struct dvb_usb_device *,
                        const struct firmware *);
-       int (*get_firmware_name) (struct dvb_usb_device *, const char **);
-
-       int size_of_priv;
 
        int num_adapters;
        int (*get_adapter_count) (struct dvb_usb_device *);
index 62bd865a64622a2d75ff7205dd28fe15e0474a21..e0b43139c0c44d14e0d5c2ddeb4a39b2d6f0e537 100644 (file)
@@ -96,9 +96,13 @@ int dvb_usb_download_firmware(struct dvb_usb_device *d)
        const struct firmware *fw = NULL;
        const char *name;
 
-       ret = d->props.get_firmware_name(d, &name);
-       if (ret < 0)
-               return ret;
+       /* resolve firmware name */
+       name = d->props.firmware;
+       if (d->props.get_firmware_name) {
+               ret = d->props.get_firmware_name(d, &name);
+               if (ret < 0)
+                       return ret;
+       }
 
        ret = request_firmware(&fw, name, &d->udev->dev);
        if (ret != 0) {