[media] dvb_usb_v2: implement .get_firmware_name()
authorAntti Palosaari <crope@iki.fi>
Thu, 24 May 2012 12:31:45 +0000 (09:31 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:21 +0000 (07:56 -0300)
Use callback to return firmware name instead of static firmware name.
There is some chips that needs to select firmware name according to
chip revision.

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 e3d55525dec595bc9cf173a2bf8d5f59e0687889..c538e113bd5882a1dd0c05f5c8b50e5f1d70833f 100644 (file)
@@ -278,7 +278,7 @@ struct dvb_usb_device_properties {
 
 #define RECONNECTS_USB                  1
        int        (*download_firmware) (struct dvb_usb_device *, const struct firmware *);
-       const char *firmware;
+       int (*get_firmware_name) (struct dvb_usb_device *, const char **);
 
        int size_of_priv;
 
index dd9f8220adeae508487b9758585f211da5715418..b9b169c8f0da9e11790ecfd14635ba36ff3a1263 100644 (file)
@@ -79,15 +79,20 @@ int dvb_usb_download_firmware(struct dvb_usb_device *d)
 {
        int ret;
        const struct firmware *fw = NULL;
+       const char *name;
 
-       if ((ret = request_firmware(&fw, d->props.firmware, &d->udev->dev)) != 0) {
+       ret = d->props.get_firmware_name(d, &name);
+       if (ret < 0)
+               return ret;
+
+       if ((ret = request_firmware(&fw, name, &d->udev->dev)) != 0) {
                err("did not find the firmware file. (%s) "
                        "Please see linux/Documentation/dvb/ for more details on firmware-problems. (%d)",
-                       d->props.firmware,ret);
+                       name,ret);
                return ret;
        }
 
-       info("downloading firmware from file '%s'", d->props.firmware);
+       info("downloading firmware from file '%s'", name);
 
        switch (d->props.usb_ctrl) {
                case CYPRESS_AN2135: