aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/atm/speedtch.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/atm/speedtch.c')
-rw-r--r--drivers/usb/atm/speedtch.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 43ec758b92b5..0e981672f149 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -89,6 +89,7 @@ MODULE_PARM_DESC(sw_buffering,
89 "Enable software buffering (default: " 89 "Enable software buffering (default: "
90 __MODULE_STRING(DEFAULT_SW_BUFFERING) ")"); 90 __MODULE_STRING(DEFAULT_SW_BUFFERING) ")");
91 91
92#define INTERFACE_DATA 1
92#define ENDPOINT_INT 0x81 93#define ENDPOINT_INT 0x81
93#define ENDPOINT_DATA 0x07 94#define ENDPOINT_DATA 0x07
94#define ENDPOINT_FIRMWARE 0x05 95#define ENDPOINT_FIRMWARE 0x05
@@ -98,6 +99,8 @@ MODULE_PARM_DESC(sw_buffering,
98struct speedtch_instance_data { 99struct speedtch_instance_data {
99 struct usbatm_data *usbatm; 100 struct usbatm_data *usbatm;
100 101
102 unsigned int altsetting;
103
101 struct work_struct status_checker; 104 struct work_struct status_checker;
102 105
103 unsigned char last_status; 106 unsigned char last_status;
@@ -270,6 +273,11 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
270 because we're in our own kernel thread anyway. */ 273 because we're in our own kernel thread anyway. */
271 msleep_interruptible(1000); 274 msleep_interruptible(1000);
272 275
276 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
277 usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret);
278 goto out_free;
279 }
280
273 /* Enable software buffering, if requested */ 281 /* Enable software buffering, if requested */
274 if (sw_buffering) 282 if (sw_buffering)
275 speedtch_set_swbuff(instance, 1); 283 speedtch_set_swbuff(instance, 1);
@@ -586,11 +594,6 @@ static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_de
586 594
587 atm_dbg(usbatm, "%s entered\n", __func__); 595 atm_dbg(usbatm, "%s entered\n", __func__);
588 596
589 if ((ret = usb_set_interface(usb_dev, 1, altsetting)) < 0) {
590 atm_dbg(usbatm, "%s: usb_set_interface returned %d!\n", __func__, ret);
591 return ret;
592 }
593
594 /* Set MAC address, it is stored in the serial number */ 597 /* Set MAC address, it is stored in the serial number */
595 memset(atm_dev->esi, 0, sizeof(atm_dev->esi)); 598 memset(atm_dev->esi, 0, sizeof(atm_dev->esi));
596 if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { 599 if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) {
@@ -725,6 +728,23 @@ static int speedtch_bind(struct usbatm_data *usbatm,
725 728
726 instance->usbatm = usbatm; 729 instance->usbatm = usbatm;
727 730
731 /* altsetting may change at any moment, so take a snapshot */
732 instance->altsetting = altsetting;
733
734 if (instance->altsetting)
735 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
736 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->altsetting, ret);
737 instance->altsetting = 0; /* fall back to default */
738 }
739
740 if (!instance->altsetting) {
741 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ALTSETTING)) < 0) {
742 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ALTSETTING, ret);
743 goto fail_free;
744 }
745 instance->altsetting = DEFAULT_ALTSETTING;
746 }
747
728 INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); 748 INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
729 749
730 instance->status_checker.timer.function = speedtch_status_poll; 750 instance->status_checker.timer.function = speedtch_status_poll;