aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/atm/cxacru.c5
-rw-r--r--drivers/usb/atm/speedtch.c9
-rw-r--r--drivers/usb/atm/ueagle-atm.c4
-rw-r--r--drivers/usb/atm/usbatm.c6
-rw-r--r--drivers/usb/atm/usbatm.h13
-rw-r--r--drivers/usb/atm/xusbatm.c3
6 files changed, 19 insertions, 21 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 139be1207d22..fc130b2171aa 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -666,8 +666,7 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
666} 666}
667 667
668static int cxacru_bind(struct usbatm_data *usbatm_instance, 668static int cxacru_bind(struct usbatm_data *usbatm_instance,
669 struct usb_interface *intf, const struct usb_device_id *id, 669 struct usb_interface *intf, const struct usb_device_id *id)
670 int *need_heavy_init)
671{ 670{
672 struct cxacru_data *instance; 671 struct cxacru_data *instance;
673 struct usb_device *usb_dev = interface_to_usbdev(intf); 672 struct usb_device *usb_dev = interface_to_usbdev(intf);
@@ -726,7 +725,7 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
726 725
727 usbatm_instance->driver_data = instance; 726 usbatm_instance->driver_data = instance;
728 727
729 *need_heavy_init = cxacru_card_status(instance); 728 usbatm_instance->flags = (cxacru_card_status(instance) ? 0 : UDSL_SKIP_HEAVY_INIT);
730 729
731 return 0; 730 return 0;
732 731
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 211d467311e2..7b60d159dbed 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -681,8 +681,7 @@ static void speedtch_release_interfaces(struct usb_device *usb_dev, int num_inte
681 681
682static int speedtch_bind(struct usbatm_data *usbatm, 682static int speedtch_bind(struct usbatm_data *usbatm,
683 struct usb_interface *intf, 683 struct usb_interface *intf,
684 const struct usb_device_id *id, 684 const struct usb_device_id *id)
685 int *need_heavy_init)
686{ 685{
687 struct usb_device *usb_dev = interface_to_usbdev(intf); 686 struct usb_device *usb_dev = interface_to_usbdev(intf);
688 struct usb_interface *cur_intf; 687 struct usb_interface *cur_intf;
@@ -754,11 +753,11 @@ static int speedtch_bind(struct usbatm_data *usbatm,
754 0x12, 0xc0, 0x07, 0x00, 753 0x12, 0xc0, 0x07, 0x00,
755 instance->scratch_buffer + OFFSET_7, SIZE_7, 500); 754 instance->scratch_buffer + OFFSET_7, SIZE_7, 500);
756 755
757 *need_heavy_init = (ret != SIZE_7); 756 usbatm->flags = (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0);
758 757
759 usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, need_heavy_init ? "not" : "already"); 758 usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not");
760 759
761 if (*need_heavy_init) 760 if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT))
762 if ((ret = usb_reset_device(usb_dev)) < 0) { 761 if ((ret = usb_reset_device(usb_dev)) < 0) {
763 usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret); 762 usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret);
764 goto fail_free; 763 goto fail_free;
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 7d2a679989ed..3ba896291eb4 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1617,7 +1617,7 @@ static void create_fs_entries(struct uea_softc *sc, struct usb_interface *intf)
1617} 1617}
1618 1618
1619static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, 1619static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1620 const struct usb_device_id *id, int *heavy) 1620 const struct usb_device_id *id)
1621{ 1621{
1622 struct usb_device *usb = interface_to_usbdev(intf); 1622 struct usb_device *usb = interface_to_usbdev(intf);
1623 struct uea_softc *sc; 1623 struct uea_softc *sc;
@@ -1629,7 +1629,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1629 if (ifnum != UEA_INTR_IFACE_NO) 1629 if (ifnum != UEA_INTR_IFACE_NO)
1630 return -ENODEV; 1630 return -ENODEV;
1631 1631
1632 *heavy = sync_wait[modem_index]; 1632 usbatm_instance->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT);
1633 1633
1634 /* interface 1 is for outbound traffic */ 1634 /* interface 1 is for outbound traffic */
1635 ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO); 1635 ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO);
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 779f86ecdd76..2eb8552dac12 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -969,7 +969,6 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
969 char *buf; 969 char *buf;
970 int error = -ENOMEM; 970 int error = -ENOMEM;
971 int i, length; 971 int i, length;
972 int need_heavy;
973 972
974 dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", 973 dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n",
975 __func__, driver->driver_name, 974 __func__, driver->driver_name,
@@ -1014,8 +1013,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1014 snprintf(buf, length, ")"); 1013 snprintf(buf, length, ")");
1015 1014
1016 bind: 1015 bind:
1017 need_heavy = 1; 1016 if (driver->bind && (error = driver->bind(instance, intf, id)) < 0) {
1018 if (driver->bind && (error = driver->bind(instance, intf, id, &need_heavy)) < 0) {
1019 dev_err(dev, "%s: bind failed: %d!\n", __func__, error); 1017 dev_err(dev, "%s: bind failed: %d!\n", __func__, error);
1020 goto fail_free; 1018 goto fail_free;
1021 } 1019 }
@@ -1098,7 +1096,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1098 __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb); 1096 __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb);
1099 } 1097 }
1100 1098
1101 if (need_heavy && driver->heavy_init) { 1099 if (!(instance->flags & UDSL_SKIP_HEAVY_INIT) && driver->heavy_init) {
1102 error = usbatm_heavy_init(instance); 1100 error = usbatm_heavy_init(instance);
1103 } else { 1101 } else {
1104 complete(&instance->thread_exited); /* pretend that heavy_init was run */ 1102 complete(&instance->thread_exited); /* pretend that heavy_init was run */
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h
index ebb79da4cb15..b29eb807f203 100644
--- a/drivers/usb/atm/usbatm.h
+++ b/drivers/usb/atm/usbatm.h
@@ -84,6 +84,11 @@
84#endif 84#endif
85 85
86 86
87/* flags, set by mini-driver in bind() */
88
89#define UDSL_SKIP_HEAVY_INIT (1<<0)
90
91
87/* mini driver */ 92/* mini driver */
88 93
89struct usbatm_data; 94struct usbatm_data;
@@ -99,12 +104,9 @@ struct usbatm_driver {
99 104
100 const char *driver_name; 105 const char *driver_name;
101 106
102 /* 107 /* init device ... can sleep, or cause probe() failure */
103 * init device ... can sleep, or cause probe() failure. Drivers with a heavy_init
104 * method can avoid having it called by setting need_heavy_init to zero.
105 */
106 int (*bind) (struct usbatm_data *, struct usb_interface *, 108 int (*bind) (struct usbatm_data *, struct usb_interface *,
107 const struct usb_device_id *id, int *need_heavy_init); 109 const struct usb_device_id *id);
108 110
109 /* additional device initialization that is too slow to be done in probe() */ 111 /* additional device initialization that is too slow to be done in probe() */
110 int (*heavy_init) (struct usbatm_data *, struct usb_interface *); 112 int (*heavy_init) (struct usbatm_data *, struct usb_interface *);
@@ -152,6 +154,7 @@ struct usbatm_data {
152 struct usbatm_driver *driver; 154 struct usbatm_driver *driver;
153 void *driver_data; 155 void *driver_data;
154 char driver_name[16]; 156 char driver_name[16];
157 unsigned int flags; /* set by mini-driver in bind() */
155 158
156 /* USB device */ 159 /* USB device */
157 struct usb_device *usb_dev; 160 struct usb_device *usb_dev;
diff --git a/drivers/usb/atm/xusbatm.c b/drivers/usb/atm/xusbatm.c
index 8f55642f376f..172c82174397 100644
--- a/drivers/usb/atm/xusbatm.c
+++ b/drivers/usb/atm/xusbatm.c
@@ -62,8 +62,7 @@ static int usb_intf_has_ep(const struct usb_interface *intf, u8 ep)
62} 62}
63 63
64static int xusbatm_bind(struct usbatm_data *usbatm, 64static int xusbatm_bind(struct usbatm_data *usbatm,
65 struct usb_interface *intf, const struct usb_device_id *id, 65 struct usb_interface *intf, const struct usb_device_id *id)
66 int *need_heavy_init)
67{ 66{
68 struct usb_device *usb_dev = interface_to_usbdev(intf); 67 struct usb_device *usb_dev = interface_to_usbdev(intf);
69 int drv_ix = id - xusbatm_usb_ids; 68 int drv_ix = id - xusbatm_usb_ids;