ChangeSet 1.1673.8.58, 2004/03/30 17:18:44-08:00, david-b@pacbell.net [PATCH] USB: fix dvb-ttusb-budget driver due to set_configuration locking cleanups > Oops, you forgot to grep: > > CC [M] drivers/media/dvb/ttusb-dec/ttusb_dec.o > drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c: In function `ttusb_setup_interfaces': > drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c:1011: warning: implicit declaration of function `usb_set_configuration' Well, when I did the grep that bug wasn't there; it was just integrated on Feb 26! > Care to send a patch to fix it up before Andrew gets grumpy with me for > breaking his build? :) The first part makes it use usb_reset_configuration() like it did before ... I'm surprised this driver hasn't been generating "it deadlocks during probe" reports. The second part prints a diagnostic if the configuration wasn't set right; the fix would use hotplug and sysfs. drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) diff -Nru a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c Wed Apr 14 14:35:12 2004 +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c Wed Apr 14 14:35:12 2004 @@ -1008,7 +1008,7 @@ static int ttusb_setup_interfaces(struct ttusb *ttusb) { - usb_set_configuration(ttusb->dev, 1); + usb_reset_configuration(ttusb->dev); usb_set_interface(ttusb->dev, 1, 1); ttusb->bulk_out_pipe = usb_sndbulkpipe(ttusb->dev, 1); @@ -1076,6 +1076,17 @@ dprintk("%s: TTUSB DVB connected\n", __FUNCTION__); udev = interface_to_usbdev(intf); + + /* Device has already been reset; its configuration was chosen. + * If this fault happens, use a hotplug script to choose the + * right configuration (write bConfigurationValue in sysfs). + */ + if (udev->actconfig->desc.bConfigurationValue != 1) { + dev_err(&intf->dev, "device config is #%d, need #1\n", + udev->actconfig->desc.bConfigurationValue); + return -ENODEV; + } + if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) return -ENOMEM;