Lines Matching refs:desc
122 struct wdm_device *desc; in wdm_find_device() local
125 list_for_each_entry(desc, &wdm_device_list, device_list) in wdm_find_device()
126 if (desc->intf == intf) in wdm_find_device()
128 desc = NULL; in wdm_find_device()
132 return desc; in wdm_find_device()
137 struct wdm_device *desc; in wdm_find_device_by_minor() local
140 list_for_each_entry(desc, &wdm_device_list, device_list) in wdm_find_device_by_minor()
141 if (desc->intf->minor == minor) in wdm_find_device_by_minor()
143 desc = NULL; in wdm_find_device_by_minor()
147 return desc; in wdm_find_device_by_minor()
153 struct wdm_device *desc; in wdm_out_callback() local
156 desc = urb->context; in wdm_out_callback()
157 spin_lock_irqsave(&desc->iuspin, flags); in wdm_out_callback()
158 desc->werr = urb->status; in wdm_out_callback()
159 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_out_callback()
160 kfree(desc->outbuf); in wdm_out_callback()
161 desc->outbuf = NULL; in wdm_out_callback()
162 clear_bit(WDM_IN_USE, &desc->flags); in wdm_out_callback()
163 wake_up_all(&desc->wait); in wdm_out_callback()
166 static void wdm_wwan_rx(struct wdm_device *desc, int length);
171 struct wdm_device *desc = urb->context; in wdm_in_callback() local
175 spin_lock_irqsave(&desc->iuspin, flags); in wdm_in_callback()
176 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_in_callback()
181 dev_dbg(&desc->intf->dev, in wdm_in_callback()
185 dev_dbg(&desc->intf->dev, in wdm_in_callback()
189 dev_dbg(&desc->intf->dev, in wdm_in_callback()
193 dev_err(&desc->intf->dev, in wdm_in_callback()
197 dev_err(&desc->intf->dev, in wdm_in_callback()
203 if (test_bit(WDM_WWAN_IN_USE, &desc->flags)) { in wdm_in_callback()
204 wdm_wwan_rx(desc, length); in wdm_in_callback()
214 if (desc->rerr == 0 && status != -EPIPE) in wdm_in_callback()
215 desc->rerr = status; in wdm_in_callback()
217 if (length + desc->length > desc->wMaxCommand) { in wdm_in_callback()
219 set_bit(WDM_OVERFLOW, &desc->flags); in wdm_in_callback()
222 if (!test_bit(WDM_OVERFLOW, &desc->flags)) { in wdm_in_callback()
223 memmove(desc->ubuf + desc->length, desc->inbuf, length); in wdm_in_callback()
224 desc->length += length; in wdm_in_callback()
225 desc->reslength = length; in wdm_in_callback()
230 if (desc->rerr) { in wdm_in_callback()
237 schedule_work(&desc->service_outs_intr); in wdm_in_callback()
239 set_bit(WDM_READ, &desc->flags); in wdm_in_callback()
240 wake_up(&desc->wait); in wdm_in_callback()
243 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_in_callback()
252 struct wdm_device *desc; in wdm_int_callback() local
255 desc = urb->context; in wdm_int_callback()
256 dr = (struct usb_cdc_notification *)desc->sbuf; in wdm_int_callback()
265 set_bit(WDM_INT_STALL, &desc->flags); in wdm_int_callback()
266 dev_err(&desc->intf->dev, "Stall on int endpoint\n"); in wdm_int_callback()
269 dev_err(&desc->intf->dev, in wdm_int_callback()
276 dev_err(&desc->intf->dev, "wdm_int_callback - %d bytes\n", in wdm_int_callback()
283 dev_dbg(&desc->intf->dev, in wdm_int_callback()
290 dev_dbg(&desc->intf->dev, in wdm_int_callback()
295 dev_dbg(&desc->intf->dev, "SPEED_CHANGE received (len %u)\n", in wdm_int_callback()
299 clear_bit(WDM_POLL_RUNNING, &desc->flags); in wdm_int_callback()
300 dev_err(&desc->intf->dev, in wdm_int_callback()
308 spin_lock_irqsave(&desc->iuspin, flags); in wdm_int_callback()
309 responding = test_and_set_bit(WDM_RESPONDING, &desc->flags); in wdm_int_callback()
310 if (!desc->resp_count++ && !responding in wdm_int_callback()
311 && !test_bit(WDM_DISCONNECTING, &desc->flags) in wdm_int_callback()
312 && !test_bit(WDM_SUSPENDING, &desc->flags)) { in wdm_int_callback()
313 rv = usb_submit_urb(desc->response, GFP_ATOMIC); in wdm_int_callback()
314 dev_dbg(&desc->intf->dev, "submit response URB %d\n", rv); in wdm_int_callback()
316 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_int_callback()
318 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_int_callback()
323 rv = schedule_work(&desc->rxwork); in wdm_int_callback()
325 dev_err(&desc->intf->dev, in wdm_int_callback()
332 dev_err(&desc->intf->dev, in wdm_int_callback()
338 static void poison_urbs(struct wdm_device *desc) in poison_urbs() argument
341 usb_poison_urb(desc->command); in poison_urbs()
342 usb_poison_urb(desc->validity); in poison_urbs()
343 usb_poison_urb(desc->response); in poison_urbs()
346 static void unpoison_urbs(struct wdm_device *desc) in unpoison_urbs() argument
352 usb_unpoison_urb(desc->response); in unpoison_urbs()
353 usb_unpoison_urb(desc->validity); in unpoison_urbs()
354 usb_unpoison_urb(desc->command); in unpoison_urbs()
357 static void free_urbs(struct wdm_device *desc) in free_urbs() argument
359 usb_free_urb(desc->validity); in free_urbs()
360 usb_free_urb(desc->response); in free_urbs()
361 usb_free_urb(desc->command); in free_urbs()
364 static void cleanup(struct wdm_device *desc) in cleanup() argument
366 kfree(desc->sbuf); in cleanup()
367 kfree(desc->inbuf); in cleanup()
368 kfree(desc->orq); in cleanup()
369 kfree(desc->irq); in cleanup()
370 kfree(desc->ubuf); in cleanup()
371 free_urbs(desc); in cleanup()
372 kfree(desc); in cleanup()
380 struct wdm_device *desc = file->private_data; in wdm_write() local
383 if (count > desc->wMaxCommand) in wdm_write()
384 count = desc->wMaxCommand; in wdm_write()
386 spin_lock_irq(&desc->iuspin); in wdm_write()
387 we = desc->werr; in wdm_write()
388 desc->werr = 0; in wdm_write()
389 spin_unlock_irq(&desc->iuspin); in wdm_write()
398 r = mutex_lock_interruptible(&desc->wlock); in wdm_write()
403 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_write()
408 r = usb_autopm_get_interface(desc->intf); in wdm_write()
415 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, in wdm_write()
416 &desc->flags)); in wdm_write()
418 if (test_bit(WDM_IN_USE, &desc->flags)) in wdm_write()
421 if (test_bit(WDM_RESETTING, &desc->flags)) in wdm_write()
424 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_write()
432 req = desc->orq; in wdm_write()
434 desc->command, in wdm_write()
435 interface_to_usbdev(desc->intf), in wdm_write()
437 usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0), in wdm_write()
442 desc in wdm_write()
449 req->wIndex = desc->inum; /* already converted */ in wdm_write()
451 set_bit(WDM_IN_USE, &desc->flags); in wdm_write()
452 desc->outbuf = buf; in wdm_write()
454 rv = usb_submit_urb(desc->command, GFP_KERNEL); in wdm_write()
456 desc->outbuf = NULL; in wdm_write()
457 clear_bit(WDM_IN_USE, &desc->flags); in wdm_write()
458 wake_up_all(&desc->wait); /* for wdm_wait_for_response() */ in wdm_write()
459 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); in wdm_write()
463 dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d\n", in wdm_write()
467 usb_autopm_put_interface(desc->intf); in wdm_write()
468 mutex_unlock(&desc->wlock); in wdm_write()
472 usb_autopm_put_interface(desc->intf); in wdm_write()
474 mutex_unlock(&desc->wlock); in wdm_write()
485 static int service_outstanding_interrupt(struct wdm_device *desc) in service_outstanding_interrupt() argument
490 if (!desc->resp_count || !--desc->resp_count) in service_outstanding_interrupt()
493 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in service_outstanding_interrupt()
497 if (test_bit(WDM_RESETTING, &desc->flags)) { in service_outstanding_interrupt()
502 set_bit(WDM_RESPONDING, &desc->flags); in service_outstanding_interrupt()
503 spin_unlock_irq(&desc->iuspin); in service_outstanding_interrupt()
504 rv = usb_submit_urb(desc->response, GFP_KERNEL); in service_outstanding_interrupt()
505 spin_lock_irq(&desc->iuspin); in service_outstanding_interrupt()
507 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) in service_outstanding_interrupt()
508 dev_err(&desc->intf->dev, in service_outstanding_interrupt()
512 clear_bit(WDM_RESPONDING, &desc->flags); in service_outstanding_interrupt()
513 desc->resp_count = 0; in service_outstanding_interrupt()
524 struct wdm_device *desc = file->private_data; in wdm_read() local
527 rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ in wdm_read()
531 cntr = READ_ONCE(desc->length); in wdm_read()
533 desc->read = 0; in wdm_read()
535 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_read()
539 if (test_bit(WDM_OVERFLOW, &desc->flags)) { in wdm_read()
540 clear_bit(WDM_OVERFLOW, &desc->flags); in wdm_read()
546 if (!test_bit(WDM_READ, &desc->flags)) { in wdm_read()
552 rv = wait_event_interruptible(desc->wait, in wdm_read()
553 test_bit(WDM_READ, &desc->flags)); in wdm_read()
557 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_read()
561 if (test_bit(WDM_RESETTING, &desc->flags)) { in wdm_read()
565 usb_mark_last_busy(interface_to_usbdev(desc->intf)); in wdm_read()
571 spin_lock_irq(&desc->iuspin); in wdm_read()
573 if (desc->rerr) { /* read completed, error happened */ in wdm_read()
574 rv = usb_translate_errors(desc->rerr); in wdm_read()
575 desc->rerr = 0; in wdm_read()
576 spin_unlock_irq(&desc->iuspin); in wdm_read()
583 if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */ in wdm_read()
584 spin_unlock_irq(&desc->iuspin); in wdm_read()
588 if (!desc->reslength) { /* zero length read */ in wdm_read()
589 dev_dbg(&desc->intf->dev, "zero length - clearing WDM_READ\n"); in wdm_read()
590 clear_bit(WDM_READ, &desc->flags); in wdm_read()
591 rv = service_outstanding_interrupt(desc); in wdm_read()
592 spin_unlock_irq(&desc->iuspin); in wdm_read()
597 cntr = desc->length; in wdm_read()
598 spin_unlock_irq(&desc->iuspin); in wdm_read()
603 rv = copy_to_user(buffer, desc->ubuf, cntr); in wdm_read()
609 spin_lock_irq(&desc->iuspin); in wdm_read()
611 for (i = 0; i < desc->length - cntr; i++) in wdm_read()
612 desc->ubuf[i] = desc->ubuf[i + cntr]; in wdm_read()
614 desc->length -= cntr; in wdm_read()
616 if (!desc->length) { in wdm_read()
617 clear_bit(WDM_READ, &desc->flags); in wdm_read()
618 service_outstanding_interrupt(desc); in wdm_read()
620 spin_unlock_irq(&desc->iuspin); in wdm_read()
624 mutex_unlock(&desc->rlock); in wdm_read()
630 struct wdm_device *desc = file->private_data; in wdm_wait_for_response() local
637 rv = wait_event_interruptible_timeout(desc->wait, in wdm_wait_for_response()
638 !test_bit(WDM_IN_USE, &desc->flags) || in wdm_wait_for_response()
639 test_bit(WDM_DISCONNECTING, &desc->flags), in wdm_wait_for_response()
646 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_wait_for_response()
653 spin_lock_irq(&desc->iuspin); in wdm_wait_for_response()
654 rv = desc->werr; in wdm_wait_for_response()
655 desc->werr = 0; in wdm_wait_for_response()
656 spin_unlock_irq(&desc->iuspin); in wdm_wait_for_response()
684 struct wdm_device *desc = file->private_data; in wdm_poll() local
688 spin_lock_irqsave(&desc->iuspin, flags); in wdm_poll()
689 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_poll()
691 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_poll()
694 if (test_bit(WDM_READ, &desc->flags)) in wdm_poll()
696 if (desc->rerr || desc->werr) in wdm_poll()
698 if (!test_bit(WDM_IN_USE, &desc->flags)) in wdm_poll()
700 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_poll()
702 poll_wait(file, &desc->wait, wait); in wdm_poll()
713 struct wdm_device *desc; in wdm_open() local
716 desc = wdm_find_device_by_minor(minor); in wdm_open()
717 if (!desc) in wdm_open()
720 intf = desc->intf; in wdm_open()
721 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_open()
723 file->private_data = desc; in wdm_open()
725 if (test_bit(WDM_WWAN_IN_USE, &desc->flags)) { in wdm_open()
730 rv = usb_autopm_get_interface(desc->intf); in wdm_open()
732 dev_err(&desc->intf->dev, "Error autopm - %d\n", rv); in wdm_open()
737 mutex_lock(&desc->wlock); in wdm_open()
738 if (!desc->count++) { in wdm_open()
739 desc->werr = 0; in wdm_open()
740 desc->rerr = 0; in wdm_open()
741 rv = usb_submit_urb(desc->validity, GFP_KERNEL); in wdm_open()
743 desc->count--; in wdm_open()
744 dev_err(&desc->intf->dev, in wdm_open()
751 mutex_unlock(&desc->wlock); in wdm_open()
752 if (desc->count == 1) in wdm_open()
753 desc->manage_power(intf, 1); in wdm_open()
754 usb_autopm_put_interface(desc->intf); in wdm_open()
762 struct wdm_device *desc = file->private_data; in wdm_release() local
767 mutex_lock(&desc->wlock); in wdm_release()
768 desc->count--; in wdm_release()
769 mutex_unlock(&desc->wlock); in wdm_release()
771 if (!desc->count) { in wdm_release()
772 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_release()
773 dev_dbg(&desc->intf->dev, "wdm_release: cleanup\n"); in wdm_release()
774 poison_urbs(desc); in wdm_release()
775 spin_lock_irq(&desc->iuspin); in wdm_release()
776 desc->resp_count = 0; in wdm_release()
777 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_release()
778 spin_unlock_irq(&desc->iuspin); in wdm_release()
779 desc->manage_power(desc->intf, 0); in wdm_release()
780 unpoison_urbs(desc); in wdm_release()
784 cleanup(desc); in wdm_release()
793 struct wdm_device *desc = file->private_data; in wdm_ioctl() local
798 if (copy_to_user((void __user *)arg, &desc->wMaxCommand, sizeof(desc->wMaxCommand))) in wdm_ioctl()
831 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_start() local
838 if (desc->count) { in wdm_wwan_port_start()
842 set_bit(WDM_WWAN_IN_USE, &desc->flags); in wdm_wwan_port_start()
845 desc->manage_power(desc->intf, 1); in wdm_wwan_port_start()
851 return usb_submit_urb(desc->validity, GFP_KERNEL); in wdm_wwan_port_start()
856 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_stop() local
859 poison_urbs(desc); in wdm_wwan_port_stop()
860 desc->manage_power(desc->intf, 0); in wdm_wwan_port_stop()
861 clear_bit(WDM_READ, &desc->flags); in wdm_wwan_port_stop()
862 clear_bit(WDM_WWAN_IN_USE, &desc->flags); in wdm_wwan_port_stop()
863 unpoison_urbs(desc); in wdm_wwan_port_stop()
869 struct wdm_device *desc = skb_shinfo(skb)->destructor_arg; in wdm_wwan_port_tx_complete() local
871 usb_autopm_put_interface(desc->intf); in wdm_wwan_port_tx_complete()
872 wwan_port_txon(desc->wwanp); in wdm_wwan_port_tx_complete()
878 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_tx() local
879 struct usb_interface *intf = desc->intf; in wdm_wwan_port_tx()
880 struct usb_ctrlrequest *req = desc->orq; in wdm_wwan_port_tx()
888 desc->command, in wdm_wwan_port_tx()
901 req->wIndex = desc->inum; in wdm_wwan_port_tx()
904 skb_shinfo(skb)->destructor_arg = desc; in wdm_wwan_port_tx()
906 rv = usb_submit_urb(desc->command, GFP_KERNEL); in wdm_wwan_port_tx()
921 static void wdm_wwan_init(struct wdm_device *desc) in wdm_wwan_init() argument
923 struct usb_interface *intf = desc->intf; in wdm_wwan_init()
927 if (desc->wwanp_type == WWAN_PORT_UNKNOWN) { in wdm_wwan_init()
932 port = wwan_create_port(&intf->dev, desc->wwanp_type, &wdm_wwan_port_ops, desc); in wdm_wwan_init()
939 desc->wwanp = port; in wdm_wwan_init()
942 static void wdm_wwan_deinit(struct wdm_device *desc) in wdm_wwan_deinit() argument
944 if (!desc->wwanp) in wdm_wwan_deinit()
947 wwan_remove_port(desc->wwanp); in wdm_wwan_deinit()
948 desc->wwanp = NULL; in wdm_wwan_deinit()
951 static void wdm_wwan_rx(struct wdm_device *desc, int length) in wdm_wwan_rx() argument
953 struct wwan_port *port = desc->wwanp; in wdm_wwan_rx()
961 memcpy(skb_put(skb, length), desc->inbuf, length); in wdm_wwan_rx()
965 schedule_work(&desc->service_outs_intr); in wdm_wwan_rx()
968 static void wdm_wwan_init(struct wdm_device *desc) {} in wdm_wwan_init() argument
969 static void wdm_wwan_deinit(struct wdm_device *desc) {} in wdm_wwan_deinit() argument
970 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} in wdm_wwan_rx() argument
976 struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); in wdm_rxwork() local
981 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
982 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_rxwork()
983 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
985 responding = test_and_set_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
986 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
988 rv = usb_submit_urb(desc->response, GFP_KERNEL); in wdm_rxwork()
990 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
991 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
992 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_rxwork()
993 schedule_work(&desc->rxwork); in wdm_rxwork()
994 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
1001 struct wdm_device *desc; in service_interrupt_work() local
1003 desc = container_of(work, struct wdm_device, service_outs_intr); in service_interrupt_work()
1005 spin_lock_irq(&desc->iuspin); in service_interrupt_work()
1006 service_outstanding_interrupt(desc); in service_interrupt_work()
1007 if (!desc->resp_count) { in service_interrupt_work()
1008 set_bit(WDM_READ, &desc->flags); in service_interrupt_work()
1009 wake_up(&desc->wait); in service_interrupt_work()
1011 spin_unlock_irq(&desc->iuspin); in service_interrupt_work()
1021 struct wdm_device *desc; in wdm_create() local
1023 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); in wdm_create()
1024 if (!desc) in wdm_create()
1026 INIT_LIST_HEAD(&desc->device_list); in wdm_create()
1027 mutex_init(&desc->rlock); in wdm_create()
1028 mutex_init(&desc->wlock); in wdm_create()
1029 spin_lock_init(&desc->iuspin); in wdm_create()
1030 init_waitqueue_head(&desc->wait); in wdm_create()
1031 desc->wMaxCommand = bufsize; in wdm_create()
1033 desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); in wdm_create()
1034 desc->intf = intf; in wdm_create()
1035 desc->wwanp_type = type; in wdm_create()
1036 INIT_WORK(&desc->rxwork, wdm_rxwork); in wdm_create()
1037 INIT_WORK(&desc->service_outs_intr, service_interrupt_work); in wdm_create()
1044 desc->wMaxPacketSize = usb_endpoint_maxp(ep); in wdm_create()
1046 desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1047 if (!desc->orq) in wdm_create()
1049 desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1050 if (!desc->irq) in wdm_create()
1053 desc->validity = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1054 if (!desc->validity) in wdm_create()
1057 desc->response = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1058 if (!desc->response) in wdm_create()
1061 desc->command = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1062 if (!desc->command) in wdm_create()
1065 desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1066 if (!desc->ubuf) in wdm_create()
1069 desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL); in wdm_create()
1070 if (!desc->sbuf) in wdm_create()
1073 desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1074 if (!desc->inbuf) in wdm_create()
1078 desc->validity, in wdm_create()
1081 desc->sbuf, in wdm_create()
1082 desc->wMaxPacketSize, in wdm_create()
1084 desc, in wdm_create()
1088 desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); in wdm_create()
1089 desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; in wdm_create()
1090 desc->irq->wValue = 0; in wdm_create()
1091 desc->irq->wIndex = desc->inum; /* already converted */ in wdm_create()
1092 desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); in wdm_create()
1095 desc->response, in wdm_create()
1098 usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), in wdm_create()
1099 (unsigned char *)desc->irq, in wdm_create()
1100 desc->inbuf, in wdm_create()
1101 desc->wMaxCommand, in wdm_create()
1103 desc in wdm_create()
1106 desc->manage_power = manage_power; in wdm_create()
1109 list_add(&desc->device_list, &wdm_device_list); in wdm_create()
1118 wdm_wwan_init(desc); in wdm_create()
1124 list_del(&desc->device_list); in wdm_create()
1126 cleanup(desc); in wdm_create()
1160 if (iface->desc.bNumEndpoints != 1) in wdm_probe()
1162 ep = &iface->endpoint[0].desc; in wdm_probe()
1210 struct wdm_device *desc; in wdm_disconnect() local
1214 desc = wdm_find_device(intf); in wdm_disconnect()
1217 wdm_wwan_deinit(desc); in wdm_disconnect()
1220 spin_lock_irqsave(&desc->iuspin, flags); in wdm_disconnect()
1221 set_bit(WDM_DISCONNECTING, &desc->flags); in wdm_disconnect()
1222 set_bit(WDM_READ, &desc->flags); in wdm_disconnect()
1223 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_disconnect()
1224 wake_up_all(&desc->wait); in wdm_disconnect()
1225 mutex_lock(&desc->rlock); in wdm_disconnect()
1226 mutex_lock(&desc->wlock); in wdm_disconnect()
1227 poison_urbs(desc); in wdm_disconnect()
1228 cancel_work_sync(&desc->rxwork); in wdm_disconnect()
1229 cancel_work_sync(&desc->service_outs_intr); in wdm_disconnect()
1230 mutex_unlock(&desc->wlock); in wdm_disconnect()
1231 mutex_unlock(&desc->rlock); in wdm_disconnect()
1235 list_del(&desc->device_list); in wdm_disconnect()
1238 if (!desc->count) in wdm_disconnect()
1239 cleanup(desc); in wdm_disconnect()
1241 dev_dbg(&intf->dev, "%d open files - postponing cleanup\n", desc->count); in wdm_disconnect()
1248 struct wdm_device *desc = wdm_find_device(intf); in wdm_suspend() local
1251 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); in wdm_suspend()
1255 mutex_lock(&desc->rlock); in wdm_suspend()
1256 mutex_lock(&desc->wlock); in wdm_suspend()
1258 spin_lock_irq(&desc->iuspin); in wdm_suspend()
1261 (test_bit(WDM_IN_USE, &desc->flags) in wdm_suspend()
1262 || test_bit(WDM_RESPONDING, &desc->flags))) { in wdm_suspend()
1263 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1267 set_bit(WDM_SUSPENDING, &desc->flags); in wdm_suspend()
1268 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1270 poison_urbs(desc); in wdm_suspend()
1271 cancel_work_sync(&desc->rxwork); in wdm_suspend()
1272 cancel_work_sync(&desc->service_outs_intr); in wdm_suspend()
1273 unpoison_urbs(desc); in wdm_suspend()
1276 mutex_unlock(&desc->wlock); in wdm_suspend()
1277 mutex_unlock(&desc->rlock); in wdm_suspend()
1284 static int recover_from_urb_loss(struct wdm_device *desc) in recover_from_urb_loss() argument
1288 if (desc->count) { in recover_from_urb_loss()
1289 rv = usb_submit_urb(desc->validity, GFP_NOIO); in recover_from_urb_loss()
1291 dev_err(&desc->intf->dev, in recover_from_urb_loss()
1300 struct wdm_device *desc = wdm_find_device(intf); in wdm_resume() local
1303 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); in wdm_resume()
1305 clear_bit(WDM_SUSPENDING, &desc->flags); in wdm_resume()
1306 rv = recover_from_urb_loss(desc); in wdm_resume()
1314 struct wdm_device *desc = wdm_find_device(intf); in wdm_pre_reset() local
1322 spin_lock_irq(&desc->iuspin); in wdm_pre_reset()
1323 set_bit(WDM_RESETTING, &desc->flags); /* inform read/write */ in wdm_pre_reset()
1324 set_bit(WDM_READ, &desc->flags); /* unblock read */ in wdm_pre_reset()
1325 clear_bit(WDM_IN_USE, &desc->flags); /* unblock write */ in wdm_pre_reset()
1326 desc->rerr = -EINTR; in wdm_pre_reset()
1327 spin_unlock_irq(&desc->iuspin); in wdm_pre_reset()
1328 wake_up_all(&desc->wait); in wdm_pre_reset()
1329 mutex_lock(&desc->rlock); in wdm_pre_reset()
1330 mutex_lock(&desc->wlock); in wdm_pre_reset()
1331 poison_urbs(desc); in wdm_pre_reset()
1332 cancel_work_sync(&desc->rxwork); in wdm_pre_reset()
1333 cancel_work_sync(&desc->service_outs_intr); in wdm_pre_reset()
1339 struct wdm_device *desc = wdm_find_device(intf); in wdm_post_reset() local
1342 unpoison_urbs(desc); in wdm_post_reset()
1343 clear_bit(WDM_OVERFLOW, &desc->flags); in wdm_post_reset()
1344 clear_bit(WDM_RESETTING, &desc->flags); in wdm_post_reset()
1345 rv = recover_from_urb_loss(desc); in wdm_post_reset()
1346 mutex_unlock(&desc->wlock); in wdm_post_reset()
1347 mutex_unlock(&desc->rlock); in wdm_post_reset()