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_ratelimited(&desc->intf->dev, in wdm_int_callback()
276 dev_err_ratelimited(&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, in wdm_wwan_init()
933 NULL, desc); in wdm_wwan_init()
940 desc->wwanp = port; in wdm_wwan_init()
943 static void wdm_wwan_deinit(struct wdm_device *desc) in wdm_wwan_deinit() argument
945 if (!desc->wwanp) in wdm_wwan_deinit()
948 wwan_remove_port(desc->wwanp); in wdm_wwan_deinit()
949 desc->wwanp = NULL; in wdm_wwan_deinit()
952 static void wdm_wwan_rx(struct wdm_device *desc, int length) in wdm_wwan_rx() argument
954 struct wwan_port *port = desc->wwanp; in wdm_wwan_rx()
962 skb_put_data(skb, desc->inbuf, length); in wdm_wwan_rx()
966 schedule_work(&desc->service_outs_intr); in wdm_wwan_rx()
969 static void wdm_wwan_init(struct wdm_device *desc) {} in wdm_wwan_init() argument
970 static void wdm_wwan_deinit(struct wdm_device *desc) {} in wdm_wwan_deinit() argument
971 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} in wdm_wwan_rx() argument
977 struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); in wdm_rxwork() local
982 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
983 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_rxwork()
984 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
986 responding = test_and_set_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
987 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
989 rv = usb_submit_urb(desc->response, GFP_KERNEL); in wdm_rxwork()
991 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
992 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
993 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_rxwork()
994 schedule_work(&desc->rxwork); in wdm_rxwork()
995 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
1002 struct wdm_device *desc; in service_interrupt_work() local
1004 desc = container_of(work, struct wdm_device, service_outs_intr); in service_interrupt_work()
1006 spin_lock_irq(&desc->iuspin); in service_interrupt_work()
1007 service_outstanding_interrupt(desc); in service_interrupt_work()
1008 if (!desc->resp_count) { in service_interrupt_work()
1009 set_bit(WDM_READ, &desc->flags); in service_interrupt_work()
1010 wake_up(&desc->wait); in service_interrupt_work()
1012 spin_unlock_irq(&desc->iuspin); in service_interrupt_work()
1022 struct wdm_device *desc; in wdm_create() local
1024 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); in wdm_create()
1025 if (!desc) in wdm_create()
1027 INIT_LIST_HEAD(&desc->device_list); in wdm_create()
1028 mutex_init(&desc->rlock); in wdm_create()
1029 mutex_init(&desc->wlock); in wdm_create()
1030 spin_lock_init(&desc->iuspin); in wdm_create()
1031 init_waitqueue_head(&desc->wait); in wdm_create()
1032 desc->wMaxCommand = bufsize; in wdm_create()
1034 desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); in wdm_create()
1035 desc->intf = intf; in wdm_create()
1036 desc->wwanp_type = type; in wdm_create()
1037 INIT_WORK(&desc->rxwork, wdm_rxwork); in wdm_create()
1038 INIT_WORK(&desc->service_outs_intr, service_interrupt_work); in wdm_create()
1045 desc->wMaxPacketSize = usb_endpoint_maxp(ep); in wdm_create()
1047 desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1048 if (!desc->orq) in wdm_create()
1050 desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1051 if (!desc->irq) in wdm_create()
1054 desc->validity = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1055 if (!desc->validity) in wdm_create()
1058 desc->response = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1059 if (!desc->response) in wdm_create()
1062 desc->command = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1063 if (!desc->command) in wdm_create()
1066 desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1067 if (!desc->ubuf) in wdm_create()
1070 desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL); in wdm_create()
1071 if (!desc->sbuf) in wdm_create()
1074 desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1075 if (!desc->inbuf) in wdm_create()
1079 desc->validity, in wdm_create()
1082 desc->sbuf, in wdm_create()
1083 desc->wMaxPacketSize, in wdm_create()
1085 desc, in wdm_create()
1089 desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); in wdm_create()
1090 desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; in wdm_create()
1091 desc->irq->wValue = 0; in wdm_create()
1092 desc->irq->wIndex = desc->inum; /* already converted */ in wdm_create()
1093 desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); in wdm_create()
1096 desc->response, in wdm_create()
1099 usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), in wdm_create()
1100 (unsigned char *)desc->irq, in wdm_create()
1101 desc->inbuf, in wdm_create()
1102 desc->wMaxCommand, in wdm_create()
1104 desc in wdm_create()
1107 desc->manage_power = manage_power; in wdm_create()
1110 list_add(&desc->device_list, &wdm_device_list); in wdm_create()
1119 wdm_wwan_init(desc); in wdm_create()
1125 list_del(&desc->device_list); in wdm_create()
1127 cleanup(desc); in wdm_create()
1161 if (iface->desc.bNumEndpoints != 1) in wdm_probe()
1163 ep = &iface->endpoint[0].desc; in wdm_probe()
1211 struct wdm_device *desc; in wdm_disconnect() local
1215 desc = wdm_find_device(intf); in wdm_disconnect()
1218 wdm_wwan_deinit(desc); in wdm_disconnect()
1221 spin_lock_irqsave(&desc->iuspin, flags); in wdm_disconnect()
1222 set_bit(WDM_DISCONNECTING, &desc->flags); in wdm_disconnect()
1223 set_bit(WDM_READ, &desc->flags); in wdm_disconnect()
1224 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_disconnect()
1225 wake_up_all(&desc->wait); in wdm_disconnect()
1226 mutex_lock(&desc->rlock); in wdm_disconnect()
1227 mutex_lock(&desc->wlock); in wdm_disconnect()
1228 poison_urbs(desc); in wdm_disconnect()
1229 cancel_work_sync(&desc->rxwork); in wdm_disconnect()
1230 cancel_work_sync(&desc->service_outs_intr); in wdm_disconnect()
1231 mutex_unlock(&desc->wlock); in wdm_disconnect()
1232 mutex_unlock(&desc->rlock); in wdm_disconnect()
1236 list_del(&desc->device_list); in wdm_disconnect()
1239 if (!desc->count) in wdm_disconnect()
1240 cleanup(desc); in wdm_disconnect()
1242 dev_dbg(&intf->dev, "%d open files - postponing cleanup\n", desc->count); in wdm_disconnect()
1249 struct wdm_device *desc = wdm_find_device(intf); in wdm_suspend() local
1252 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); in wdm_suspend()
1256 mutex_lock(&desc->rlock); in wdm_suspend()
1257 mutex_lock(&desc->wlock); in wdm_suspend()
1259 spin_lock_irq(&desc->iuspin); in wdm_suspend()
1262 (test_bit(WDM_IN_USE, &desc->flags) in wdm_suspend()
1263 || test_bit(WDM_RESPONDING, &desc->flags))) { in wdm_suspend()
1264 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1268 set_bit(WDM_SUSPENDING, &desc->flags); in wdm_suspend()
1269 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1271 poison_urbs(desc); in wdm_suspend()
1272 cancel_work_sync(&desc->rxwork); in wdm_suspend()
1273 cancel_work_sync(&desc->service_outs_intr); in wdm_suspend()
1274 unpoison_urbs(desc); in wdm_suspend()
1277 mutex_unlock(&desc->wlock); in wdm_suspend()
1278 mutex_unlock(&desc->rlock); in wdm_suspend()
1285 static int recover_from_urb_loss(struct wdm_device *desc) in recover_from_urb_loss() argument
1289 if (desc->count) { in recover_from_urb_loss()
1290 rv = usb_submit_urb(desc->validity, GFP_NOIO); in recover_from_urb_loss()
1292 dev_err(&desc->intf->dev, in recover_from_urb_loss()
1301 struct wdm_device *desc = wdm_find_device(intf); in wdm_resume() local
1304 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); in wdm_resume()
1306 clear_bit(WDM_SUSPENDING, &desc->flags); in wdm_resume()
1307 rv = recover_from_urb_loss(desc); in wdm_resume()
1315 struct wdm_device *desc = wdm_find_device(intf); in wdm_pre_reset() local
1323 spin_lock_irq(&desc->iuspin); in wdm_pre_reset()
1324 set_bit(WDM_RESETTING, &desc->flags); /* inform read/write */ in wdm_pre_reset()
1325 set_bit(WDM_READ, &desc->flags); /* unblock read */ in wdm_pre_reset()
1326 clear_bit(WDM_IN_USE, &desc->flags); /* unblock write */ in wdm_pre_reset()
1327 desc->rerr = -EINTR; in wdm_pre_reset()
1328 spin_unlock_irq(&desc->iuspin); in wdm_pre_reset()
1329 wake_up_all(&desc->wait); in wdm_pre_reset()
1330 mutex_lock(&desc->rlock); in wdm_pre_reset()
1331 mutex_lock(&desc->wlock); in wdm_pre_reset()
1332 poison_urbs(desc); in wdm_pre_reset()
1333 cancel_work_sync(&desc->rxwork); in wdm_pre_reset()
1334 cancel_work_sync(&desc->service_outs_intr); in wdm_pre_reset()
1340 struct wdm_device *desc = wdm_find_device(intf); in wdm_post_reset() local
1343 unpoison_urbs(desc); in wdm_post_reset()
1344 clear_bit(WDM_OVERFLOW, &desc->flags); in wdm_post_reset()
1345 clear_bit(WDM_RESETTING, &desc->flags); in wdm_post_reset()
1346 rv = recover_from_urb_loss(desc); in wdm_post_reset()
1347 mutex_unlock(&desc->wlock); in wdm_post_reset()
1348 mutex_unlock(&desc->rlock); in wdm_post_reset()