struct baseband_usb *baseband_usb_open(struct baseband_usb *usb,int index, unsigned int intf) { // struct baseband_usb *usb; int err; pr_debug("baseband_usb_open {\n"); /* allocate baseband usb structure */ // usb = kzalloc(sizeof(struct baseband_usb), // GFP_KERNEL); // if (!usb) // return (struct baseband_usb *) 0; /* open usb driver */ /* sprintf(baseband_usb_driver_name[index], "baseband_usb_%x_%x_%x", vid, pid, intf); baseband_usb_driver_id_table[index][0].match_flags = USB_DEVICE_ID_MATCH_DEVICE; baseband_usb_driver_id_table[index][0].idVendor = vid; baseband_usb_driver_id_table[index][0].idProduct = pid;*/ g_usb_interface_index[index] = intf; // g_usb_interface[index] = (struct usb_interface *) 0; /* err = usb_register(&baseband_usb_driver[index]); if (err < 0) { pr_err("cannot open usb driver - err %d\n", err); goto error_exit; }*/ usb->baseband_index = index; usb->usb.driver = &baseband_usb_driver; if (!g_usb_interface[index]) { pr_err("cannot open usb driver - !g_usb_interface[%d]\n", index); goto error_exit; } usb->usb.device = interface_to_usbdev(g_usb_interface[index]); usb->usb.interface = g_usb_interface[index]; find_usb_pipe(usb); usb->usb.rx_urb = (struct urb *) 0; usb->usb.tx_urb = (struct urb *) 0; // g_usb_interface_index[index] = ~0U; // g_usb_interface[index] = (struct usb_interface *) 0; pr_debug("usb->usb.driver->name %s\n", usb->usb.driver->name); pr_debug("usb->usb.device %p\n", usb->usb.device); pr_debug("usb->usb.interface %p\n", usb->usb.interface); pr_debug("usb->usb.pipe.isoch.in %x\n", usb->usb.pipe.isoch.in); pr_debug("usb->usb.pipe.isoch.out %x\n", usb->usb.pipe.isoch.out); pr_debug("usb->usb.pipe.bulk.in %x\n", usb->usb.pipe.bulk.in); pr_debug("usb->usb.pipe.bulk.out %x\n", usb->usb.pipe.bulk.out); pr_debug("usb->usb.pipe.interrupt.in %x\n", usb->usb.pipe.interrupt.in); pr_debug("usb->usb.pipe.interrupt.out %x\n", usb->usb.pipe.interrupt.out); pr_debug("baseband_usb_open }\n"); return usb; error_exit: return (struct baseband_usb *) 0; }
struct baseband_usb *baseband_usb_open(int index, unsigned int intf) { struct baseband_usb *usb; int i; pr_debug("baseband_usb_open {\n"); /* allocate baseband usb structure */ usb = kzalloc(sizeof(struct baseband_usb), GFP_KERNEL); if (!usb) return (struct baseband_usb *) 0; /* create semaphores */ sema_init(&usb->sem, 1); /* open usb interface */ usb->baseband_index = index; usb->usb.driver = &baseband_usb_driver; if (!g_usb_interface[index]) { /* wait for usb probe */ for (i = 0; i < 50; i++) if (!g_usb_interface[index]) msleep(20); if (!g_usb_interface[index]) { pr_err("can't open usb: !g_usb_interface[%d]\n", index); kfree(usb); return NULL; } } usb->usb.device = interface_to_usbdev(g_usb_interface[index]); usb->usb.interface = g_usb_interface[index]; find_usb_pipe(usb); usb->usb.rx_urb = (struct urb *) 0; usb->usb.tx_urb = (struct urb *) 0; g_usb_interface[index] = (struct usb_interface *) 0; pr_debug("usb->usb.driver->name %s\n", usb->usb.driver->name); pr_debug("usb->usb.device %p\n", usb->usb.device); pr_debug("usb->usb.interface %p\n", usb->usb.interface); pr_debug("usb->usb.pipe.isoch.in %x\n", usb->usb.pipe.isoch.in); pr_debug("usb->usb.pipe.isoch.out %x\n", usb->usb.pipe.isoch.out); pr_debug("usb->usb.pipe.bulk.in %x\n", usb->usb.pipe.bulk.in); pr_debug("usb->usb.pipe.bulk.out %x\n", usb->usb.pipe.bulk.out); pr_debug("usb->usb.pipe.interrupt.in %x\n", usb->usb.pipe.interrupt.in); pr_debug("usb->usb.pipe.interrupt.out %x\n", usb->usb.pipe.interrupt.out); pr_debug("baseband_usb_open }\n"); return usb; }
struct baseband_usb *baseband_usb_open(int index, unsigned int vid, unsigned int pid, unsigned int intf) { struct baseband_usb *usb; int err; save_dbg(dbg_flag);/* HTC */ pr_debug("baseband_usb_open {\n"); /* allocate baseband usb structure */ usb = kzalloc(sizeof(struct baseband_usb), GFP_KERNEL); if (!usb) { restore_dbg(dbg_flag);/* HTC */ return (struct baseband_usb *) 0; } /* create semaphores */ sema_init(&usb->sem, 1); /* open usb driver */ sprintf(baseband_usb_driver_name[index], "baseband_usb_%x_%x_%x", vid, pid, intf); baseband_usb_driver_id_table[index][0].match_flags = USB_DEVICE_ID_MATCH_DEVICE; baseband_usb_driver_id_table[index][0].idVendor = vid; baseband_usb_driver_id_table[index][0].idProduct = pid; g_usb_interface_index[index] = intf; g_usb_interface[index] = (struct usb_interface *) 0; err = usb_register(&baseband_usb_driver[index]); if (err < 0) { pr_err("cannot open usb driver - err %d\n", err); kfree(usb); restore_dbg(dbg_flag);/* HTC */ return (struct baseband_usb *) 0; } usb->baseband_index = index; usb->usb.driver = &baseband_usb_driver[index]; if (!g_usb_interface[index]) { pr_err("cannot open usb driver - !g_usb_interface[%d]\n", index); usb_deregister(usb->usb.driver); kfree(usb); restore_dbg(dbg_flag);/* HTC */ return (struct baseband_usb *) 0; } usb->usb.device = interface_to_usbdev(g_usb_interface[index]); usb->usb.interface = g_usb_interface[index]; find_usb_pipe(usb); usb->usb.rx_urb = (struct urb *) 0; usb->usb.tx_urb = (struct urb *) 0; g_usb_interface_index[index] = ~0U; g_usb_interface[index] = (struct usb_interface *) 0; rawlog1("usb->usb.driver->name %s\n", usb->usb.driver->name); rawlog1("usb->usb.device %p\n", usb->usb.device); rawlog1("usb->usb.interface %p\n", usb->usb.interface); rawlog1("usb->usb.pipe.isoch.in %x\n", usb->usb.pipe.isoch.in); rawlog1("usb->usb.pipe.isoch.out %x\n", usb->usb.pipe.isoch.out); rawlog1("usb->usb.pipe.bulk.in %x\n", usb->usb.pipe.bulk.in); rawlog1("usb->usb.pipe.bulk.out %x\n", usb->usb.pipe.bulk.out); rawlog1("usb->usb.pipe.interrupt.in %x\n", usb->usb.pipe.interrupt.in); rawlog1("usb->usb.pipe.interrupt.out %x\n", usb->usb.pipe.interrupt.out); pr_debug("baseband_usb_open }\n"); restore_dbg(dbg_flag);/* HTC */ return usb; }