}
static int cxacru_bind(struct usbatm_data *usbatm_instance,
- struct usb_interface *intf, const struct usb_device_id *id,
- int *need_heavy_init)
+ struct usb_interface *intf, const struct usb_device_id *id)
{
struct cxacru_data *instance;
struct usb_device *usb_dev = interface_to_usbdev(intf);
usbatm_instance->driver_data = instance;
- *need_heavy_init = cxacru_card_status(instance);
+ usbatm_instance->flags = (cxacru_card_status(instance) ? 0 : UDSL_SKIP_HEAVY_INIT);
return 0;
static int speedtch_bind(struct usbatm_data *usbatm,
struct usb_interface *intf,
- const struct usb_device_id *id,
- int *need_heavy_init)
+ const struct usb_device_id *id)
{
struct usb_device *usb_dev = interface_to_usbdev(intf);
struct usb_interface *cur_intf;
0x12, 0xc0, 0x07, 0x00,
instance->scratch_buffer + OFFSET_7, SIZE_7, 500);
- *need_heavy_init = (ret != SIZE_7);
+ usbatm->flags = (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0);
- usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, need_heavy_init ? "not" : "already");
+ usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not");
- if (*need_heavy_init)
+ if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT))
if ((ret = usb_reset_device(usb_dev)) < 0) {
usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret);
goto fail_free;
}
static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
- const struct usb_device_id *id, int *heavy)
+ const struct usb_device_id *id)
{
struct usb_device *usb = interface_to_usbdev(intf);
struct uea_softc *sc;
if (ifnum != UEA_INTR_IFACE_NO)
return -ENODEV;
- *heavy = sync_wait[modem_index];
+ usbatm_instance->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT);
/* interface 1 is for outbound traffic */
ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO);
char *buf;
int error = -ENOMEM;
int i, length;
- int need_heavy;
dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n",
__func__, driver->driver_name,
snprintf(buf, length, ")");
bind:
- need_heavy = 1;
- if (driver->bind && (error = driver->bind(instance, intf, id, &need_heavy)) < 0) {
+ if (driver->bind && (error = driver->bind(instance, intf, id)) < 0) {
dev_err(dev, "%s: bind failed: %d!\n", __func__, error);
goto fail_free;
}
__func__, urb->transfer_buffer, urb->transfer_buffer_length, urb);
}
- if (need_heavy && driver->heavy_init) {
+ if (!(instance->flags & UDSL_SKIP_HEAVY_INIT) && driver->heavy_init) {
error = usbatm_heavy_init(instance);
} else {
complete(&instance->thread_exited); /* pretend that heavy_init was run */
#endif
+/* flags, set by mini-driver in bind() */
+
+#define UDSL_SKIP_HEAVY_INIT (1<<0)
+
+
/* mini driver */
struct usbatm_data;
const char *driver_name;
- /*
- * init device ... can sleep, or cause probe() failure. Drivers with a heavy_init
- * method can avoid having it called by setting need_heavy_init to zero.
- */
+ /* init device ... can sleep, or cause probe() failure */
int (*bind) (struct usbatm_data *, struct usb_interface *,
- const struct usb_device_id *id, int *need_heavy_init);
+ const struct usb_device_id *id);
/* additional device initialization that is too slow to be done in probe() */
int (*heavy_init) (struct usbatm_data *, struct usb_interface *);
struct usbatm_driver *driver;
void *driver_data;
char driver_name[16];
+ unsigned int flags; /* set by mini-driver in bind() */
/* USB device */
struct usb_device *usb_dev;
}
static int xusbatm_bind(struct usbatm_data *usbatm,
- struct usb_interface *intf, const struct usb_device_id *id,
- int *need_heavy_init)
+ struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_device *usb_dev = interface_to_usbdev(intf);
int drv_ix = id - xusbatm_usb_ids;