diff options
author | Antti Palosaari <crope@iki.fi> | 2012-06-14 19:07:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-04 06:56:32 -0400 |
commit | ffe4ac92ee5a4a0a236b9583c3173902e158e14b (patch) | |
tree | d99f699360823a2a560951705f3e2905ace06abb /drivers/media/dvb | |
parent | c65bcb95beec39402cb574faa2e17aa1e56c1534 (diff) |
[media] dvb_usb_v2: do not release USB interface when device reconnects
USB core will call disconnect and remove driver for us as device
will disconnect itself. After that it is loaded again as a new
device but it is warm and no firmware loading needed.
Reported-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb_usb_init.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c index 0ac1a72a7d81..e9bb006bb725 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c | |||
@@ -431,11 +431,24 @@ static void dvb_usbv2_init_work(struct work_struct *work) | |||
431 | KBUILD_MODNAME, d->name); | 431 | KBUILD_MODNAME, d->name); |
432 | ret = dvb_usbv2_download_firmware(d); | 432 | ret = dvb_usbv2_download_firmware(d); |
433 | if (ret == 0) { | 433 | if (ret == 0) { |
434 | /* device is warm, continue initialization */ | ||
434 | ; | 435 | ; |
435 | } else if (ret == RECONNECTS_USB) { | 436 | } else if (ret == RECONNECTS_USB) { |
436 | ret = 0; | 437 | /* |
437 | goto exit_usb_driver_release_interface; | 438 | * USB core will call disconnect() and then probe() |
439 | * as device reconnects itself from the USB bus. | ||
440 | * disconnect() will release all driver resources | ||
441 | * and probe() is called for 'new' device. As 'new' | ||
442 | * device is warm we should never go here again. | ||
443 | */ | ||
444 | return; | ||
438 | } else { | 445 | } else { |
446 | /* Unexpected fatal error. We must unregister driver | ||
447 | * manually from the device, because device is already | ||
448 | * register by returning from probe() with success. | ||
449 | * usb_driver_release_interface() finally calls | ||
450 | * disconnect() in order to free resources. | ||
451 | */ | ||
439 | goto err_usb_driver_release_interface; | 452 | goto err_usb_driver_release_interface; |
440 | } | 453 | } |
441 | } | 454 | } |
@@ -453,8 +466,7 @@ static void dvb_usbv2_init_work(struct work_struct *work) | |||
453 | err_usb_driver_release_interface: | 466 | err_usb_driver_release_interface: |
454 | pr_info("%s: '%s' error while loading driver (%d)\n", KBUILD_MODNAME, | 467 | pr_info("%s: '%s' error while loading driver (%d)\n", KBUILD_MODNAME, |
455 | d->name, ret); | 468 | d->name, ret); |
456 | exit_usb_driver_release_interface: | 469 | /* it finally calls disconnect() which frees mem */ |
457 | /* it finally calls .disconnect() which frees mem */ | ||
458 | usb_driver_release_interface(to_usb_driver(d->intf->dev.driver), | 470 | usb_driver_release_interface(to_usb_driver(d->intf->dev.driver), |
459 | d->intf); | 471 | d->intf); |
460 | pr_debug("%s: failed=%d\n", __func__, ret); | 472 | pr_debug("%s: failed=%d\n", __func__, ret); |