Lines Matching refs:desc

121 	struct wdm_device *desc;  in wdm_find_device()  local
124 list_for_each_entry(desc, &wdm_device_list, device_list) in wdm_find_device()
125 if (desc->intf == intf) in wdm_find_device()
127 desc = NULL; in wdm_find_device()
131 return desc; in wdm_find_device()
136 struct wdm_device *desc; in wdm_find_device_by_minor() local
139 list_for_each_entry(desc, &wdm_device_list, device_list) in wdm_find_device_by_minor()
140 if (desc->intf->minor == minor) in wdm_find_device_by_minor()
142 desc = NULL; in wdm_find_device_by_minor()
146 return desc; in wdm_find_device_by_minor()
152 struct wdm_device *desc; in wdm_out_callback() local
155 desc = urb->context; in wdm_out_callback()
156 spin_lock_irqsave(&desc->iuspin, flags); in wdm_out_callback()
157 desc->werr = urb->status; in wdm_out_callback()
158 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_out_callback()
159 kfree(desc->outbuf); in wdm_out_callback()
160 desc->outbuf = NULL; in wdm_out_callback()
161 clear_bit(WDM_IN_USE, &desc->flags); in wdm_out_callback()
162 wake_up_all(&desc->wait); in wdm_out_callback()
165 static void wdm_wwan_rx(struct wdm_device *desc, int length);
170 struct wdm_device *desc = urb->context; in wdm_in_callback() local
174 spin_lock_irqsave(&desc->iuspin, flags); in wdm_in_callback()
175 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_in_callback()
180 dev_dbg(&desc->intf->dev, in wdm_in_callback()
184 dev_dbg(&desc->intf->dev, in wdm_in_callback()
188 dev_dbg(&desc->intf->dev, in wdm_in_callback()
192 dev_err(&desc->intf->dev, in wdm_in_callback()
196 dev_err(&desc->intf->dev, in wdm_in_callback()
202 if (test_bit(WDM_WWAN_IN_USE, &desc->flags)) { in wdm_in_callback()
203 wdm_wwan_rx(desc, length); in wdm_in_callback()
213 if (desc->rerr == 0 && status != -EPIPE) in wdm_in_callback()
214 desc->rerr = status; in wdm_in_callback()
217 dev_dbg(&desc->intf->dev, "received ZLP\n"); in wdm_in_callback()
221 if (length + desc->length > desc->wMaxCommand) { in wdm_in_callback()
223 set_bit(WDM_OVERFLOW, &desc->flags); in wdm_in_callback()
226 if (!test_bit(WDM_OVERFLOW, &desc->flags)) { in wdm_in_callback()
227 memmove(desc->ubuf + desc->length, desc->inbuf, length); in wdm_in_callback()
228 desc->length += length; in wdm_in_callback()
233 if (desc->rerr) { in wdm_in_callback()
241 schedule_work(&desc->service_outs_intr); in wdm_in_callback()
243 set_bit(WDM_READ, &desc->flags); in wdm_in_callback()
244 wake_up(&desc->wait); in wdm_in_callback()
247 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_in_callback()
256 struct wdm_device *desc; in wdm_int_callback() local
259 desc = urb->context; in wdm_int_callback()
260 dr = (struct usb_cdc_notification *)desc->sbuf; in wdm_int_callback()
269 set_bit(WDM_INT_STALL, &desc->flags); in wdm_int_callback()
270 dev_err(&desc->intf->dev, "Stall on int endpoint\n"); in wdm_int_callback()
273 dev_err_ratelimited(&desc->intf->dev, in wdm_int_callback()
280 dev_err_ratelimited(&desc->intf->dev, "wdm_int_callback - %d bytes\n", in wdm_int_callback()
287 dev_dbg(&desc->intf->dev, in wdm_int_callback()
294 dev_dbg(&desc->intf->dev, in wdm_int_callback()
299 dev_dbg(&desc->intf->dev, "SPEED_CHANGE received (len %u)\n", in wdm_int_callback()
303 clear_bit(WDM_POLL_RUNNING, &desc->flags); in wdm_int_callback()
304 dev_err(&desc->intf->dev, in wdm_int_callback()
312 spin_lock_irqsave(&desc->iuspin, flags); in wdm_int_callback()
313 responding = test_and_set_bit(WDM_RESPONDING, &desc->flags); in wdm_int_callback()
314 if (!desc->resp_count++ && !responding in wdm_int_callback()
315 && !test_bit(WDM_DISCONNECTING, &desc->flags) in wdm_int_callback()
316 && !test_bit(WDM_SUSPENDING, &desc->flags)) { in wdm_int_callback()
317 rv = usb_submit_urb(desc->response, GFP_ATOMIC); in wdm_int_callback()
318 dev_dbg(&desc->intf->dev, "submit response URB %d\n", rv); in wdm_int_callback()
320 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_int_callback()
322 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_int_callback()
327 rv = schedule_work(&desc->rxwork); in wdm_int_callback()
329 dev_err(&desc->intf->dev, in wdm_int_callback()
336 dev_err(&desc->intf->dev, in wdm_int_callback()
342 static void poison_urbs(struct wdm_device *desc) in poison_urbs() argument
345 usb_poison_urb(desc->command); in poison_urbs()
346 usb_poison_urb(desc->validity); in poison_urbs()
347 usb_poison_urb(desc->response); in poison_urbs()
350 static void unpoison_urbs(struct wdm_device *desc) in unpoison_urbs() argument
356 usb_unpoison_urb(desc->response); in unpoison_urbs()
357 usb_unpoison_urb(desc->validity); in unpoison_urbs()
358 usb_unpoison_urb(desc->command); in unpoison_urbs()
361 static void free_urbs(struct wdm_device *desc) in free_urbs() argument
363 usb_free_urb(desc->validity); in free_urbs()
364 usb_free_urb(desc->response); in free_urbs()
365 usb_free_urb(desc->command); in free_urbs()
368 static void cleanup(struct wdm_device *desc) in cleanup() argument
370 kfree(desc->sbuf); in cleanup()
371 kfree(desc->inbuf); in cleanup()
372 kfree(desc->orq); in cleanup()
373 kfree(desc->irq); in cleanup()
374 kfree(desc->ubuf); in cleanup()
375 free_urbs(desc); in cleanup()
376 kfree(desc); in cleanup()
384 struct wdm_device *desc = file->private_data; in wdm_write() local
387 if (count > desc->wMaxCommand) in wdm_write()
388 count = desc->wMaxCommand; in wdm_write()
390 spin_lock_irq(&desc->iuspin); in wdm_write()
391 we = desc->werr; in wdm_write()
392 desc->werr = 0; in wdm_write()
393 spin_unlock_irq(&desc->iuspin); in wdm_write()
402 r = mutex_lock_interruptible(&desc->wlock); in wdm_write()
407 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_write()
412 r = usb_autopm_get_interface(desc->intf); in wdm_write()
419 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, in wdm_write()
420 &desc->flags)); in wdm_write()
422 if (test_bit(WDM_IN_USE, &desc->flags)) in wdm_write()
425 if (test_bit(WDM_RESETTING, &desc->flags)) in wdm_write()
428 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_write()
436 req = desc->orq; in wdm_write()
438 desc->command, in wdm_write()
439 interface_to_usbdev(desc->intf), in wdm_write()
441 usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0), in wdm_write()
446 desc in wdm_write()
453 req->wIndex = desc->inum; /* already converted */ in wdm_write()
455 set_bit(WDM_IN_USE, &desc->flags); in wdm_write()
456 desc->outbuf = buf; in wdm_write()
458 rv = usb_submit_urb(desc->command, GFP_KERNEL); in wdm_write()
460 desc->outbuf = NULL; in wdm_write()
461 clear_bit(WDM_IN_USE, &desc->flags); in wdm_write()
462 wake_up_all(&desc->wait); /* for wdm_wait_for_response() */ in wdm_write()
463 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); in wdm_write()
467 dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d\n", in wdm_write()
471 usb_autopm_put_interface(desc->intf); in wdm_write()
472 mutex_unlock(&desc->wlock); in wdm_write()
476 usb_autopm_put_interface(desc->intf); in wdm_write()
478 mutex_unlock(&desc->wlock); in wdm_write()
489 static int service_outstanding_interrupt(struct wdm_device *desc) in service_outstanding_interrupt() argument
494 if (!desc->resp_count || !--desc->resp_count) in service_outstanding_interrupt()
497 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in service_outstanding_interrupt()
501 if (test_bit(WDM_RESETTING, &desc->flags)) { in service_outstanding_interrupt()
506 set_bit(WDM_RESPONDING, &desc->flags); in service_outstanding_interrupt()
507 spin_unlock_irq(&desc->iuspin); in service_outstanding_interrupt()
508 rv = usb_submit_urb(desc->response, GFP_KERNEL); in service_outstanding_interrupt()
509 spin_lock_irq(&desc->iuspin); in service_outstanding_interrupt()
511 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) in service_outstanding_interrupt()
512 dev_err(&desc->intf->dev, in service_outstanding_interrupt()
516 clear_bit(WDM_RESPONDING, &desc->flags); in service_outstanding_interrupt()
517 desc->resp_count = 0; in service_outstanding_interrupt()
528 struct wdm_device *desc = file->private_data; in wdm_read() local
531 rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ in wdm_read()
535 cntr = READ_ONCE(desc->length); in wdm_read()
537 desc->read = 0; in wdm_read()
539 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_read()
543 if (test_bit(WDM_OVERFLOW, &desc->flags)) { in wdm_read()
544 clear_bit(WDM_OVERFLOW, &desc->flags); in wdm_read()
550 if (!test_bit(WDM_READ, &desc->flags)) { in wdm_read()
556 rv = wait_event_interruptible(desc->wait, in wdm_read()
557 test_bit(WDM_READ, &desc->flags)); in wdm_read()
561 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_read()
565 if (test_bit(WDM_RESETTING, &desc->flags)) { in wdm_read()
569 usb_mark_last_busy(interface_to_usbdev(desc->intf)); in wdm_read()
575 spin_lock_irq(&desc->iuspin); in wdm_read()
577 if (desc->rerr) { /* read completed, error happened */ in wdm_read()
578 rv = usb_translate_errors(desc->rerr); in wdm_read()
579 desc->rerr = 0; in wdm_read()
580 spin_unlock_irq(&desc->iuspin); in wdm_read()
587 if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */ in wdm_read()
588 spin_unlock_irq(&desc->iuspin); in wdm_read()
592 cntr = desc->length; in wdm_read()
593 spin_unlock_irq(&desc->iuspin); in wdm_read()
598 rv = copy_to_user(buffer, desc->ubuf, cntr); in wdm_read()
604 spin_lock_irq(&desc->iuspin); in wdm_read()
606 for (i = 0; i < desc->length - cntr; i++) in wdm_read()
607 desc->ubuf[i] = desc->ubuf[i + cntr]; in wdm_read()
609 desc->length -= cntr; in wdm_read()
611 if (!desc->length) { in wdm_read()
612 clear_bit(WDM_READ, &desc->flags); in wdm_read()
613 service_outstanding_interrupt(desc); in wdm_read()
615 spin_unlock_irq(&desc->iuspin); in wdm_read()
619 mutex_unlock(&desc->rlock); in wdm_read()
625 struct wdm_device *desc = file->private_data; in wdm_wait_for_response() local
632 rv = wait_event_interruptible_timeout(desc->wait, in wdm_wait_for_response()
633 !test_bit(WDM_IN_USE, &desc->flags) || in wdm_wait_for_response()
634 test_bit(WDM_DISCONNECTING, &desc->flags), in wdm_wait_for_response()
641 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_wait_for_response()
648 spin_lock_irq(&desc->iuspin); in wdm_wait_for_response()
649 rv = desc->werr; in wdm_wait_for_response()
650 desc->werr = 0; in wdm_wait_for_response()
651 spin_unlock_irq(&desc->iuspin); in wdm_wait_for_response()
679 struct wdm_device *desc = file->private_data; in wdm_poll() local
683 spin_lock_irqsave(&desc->iuspin, flags); in wdm_poll()
684 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_poll()
686 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_poll()
689 if (test_bit(WDM_READ, &desc->flags)) in wdm_poll()
691 if (desc->rerr || desc->werr) in wdm_poll()
693 if (!test_bit(WDM_IN_USE, &desc->flags)) in wdm_poll()
695 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_poll()
697 poll_wait(file, &desc->wait, wait); in wdm_poll()
708 struct wdm_device *desc; in wdm_open() local
711 desc = wdm_find_device_by_minor(minor); in wdm_open()
712 if (!desc) in wdm_open()
715 intf = desc->intf; in wdm_open()
716 if (test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_open()
718 file->private_data = desc; in wdm_open()
720 if (test_bit(WDM_WWAN_IN_USE, &desc->flags)) { in wdm_open()
725 rv = usb_autopm_get_interface(desc->intf); in wdm_open()
727 dev_err(&desc->intf->dev, "Error autopm - %d\n", rv); in wdm_open()
732 mutex_lock(&desc->wlock); in wdm_open()
733 if (!desc->count++) { in wdm_open()
734 desc->werr = 0; in wdm_open()
735 desc->rerr = 0; in wdm_open()
736 rv = usb_submit_urb(desc->validity, GFP_KERNEL); in wdm_open()
738 desc->count--; in wdm_open()
739 dev_err(&desc->intf->dev, in wdm_open()
746 mutex_unlock(&desc->wlock); in wdm_open()
747 if (desc->count == 1) in wdm_open()
748 desc->manage_power(intf, 1); in wdm_open()
749 usb_autopm_put_interface(desc->intf); in wdm_open()
757 struct wdm_device *desc = file->private_data; in wdm_release() local
762 mutex_lock(&desc->wlock); in wdm_release()
763 desc->count--; in wdm_release()
764 mutex_unlock(&desc->wlock); in wdm_release()
766 if (!desc->count) { in wdm_release()
767 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_release()
768 dev_dbg(&desc->intf->dev, "wdm_release: cleanup\n"); in wdm_release()
769 poison_urbs(desc); in wdm_release()
770 spin_lock_irq(&desc->iuspin); in wdm_release()
771 desc->resp_count = 0; in wdm_release()
772 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_release()
773 spin_unlock_irq(&desc->iuspin); in wdm_release()
774 desc->manage_power(desc->intf, 0); in wdm_release()
775 unpoison_urbs(desc); in wdm_release()
779 cleanup(desc); in wdm_release()
788 struct wdm_device *desc = file->private_data; in wdm_ioctl() local
793 if (copy_to_user((void __user *)arg, &desc->wMaxCommand, sizeof(desc->wMaxCommand))) in wdm_ioctl()
826 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_start() local
834 if (desc->count) { in wdm_wwan_port_start()
838 set_bit(WDM_WWAN_IN_USE, &desc->flags); in wdm_wwan_port_start()
841 desc->manage_power(desc->intf, 1); in wdm_wwan_port_start()
847 rv = usb_submit_urb(desc->validity, GFP_KERNEL); in wdm_wwan_port_start()
850 desc->manage_power(desc->intf, 0); in wdm_wwan_port_start()
852 clear_bit(WDM_WWAN_IN_USE, &desc->flags); in wdm_wwan_port_start()
860 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_stop() local
863 poison_urbs(desc); in wdm_wwan_port_stop()
864 desc->manage_power(desc->intf, 0); in wdm_wwan_port_stop()
865 clear_bit(WDM_READ, &desc->flags); in wdm_wwan_port_stop()
866 unpoison_urbs(desc); in wdm_wwan_port_stop()
869 clear_bit(WDM_WWAN_IN_USE, &desc->flags); in wdm_wwan_port_stop()
875 struct wdm_device *desc = skb_shinfo(skb)->destructor_arg; in wdm_wwan_port_tx_complete() local
877 usb_autopm_put_interface_async(desc->intf); in wdm_wwan_port_tx_complete()
878 wwan_port_txon(desc->wwanp); in wdm_wwan_port_tx_complete()
884 struct wdm_device *desc = wwan_port_get_drvdata(port); in wdm_wwan_port_tx() local
885 struct usb_interface *intf = desc->intf; in wdm_wwan_port_tx()
886 struct usb_ctrlrequest *req = desc->orq; in wdm_wwan_port_tx()
894 desc->command, in wdm_wwan_port_tx()
907 req->wIndex = desc->inum; /* already converted */ in wdm_wwan_port_tx()
910 skb_shinfo(skb)->destructor_arg = desc; in wdm_wwan_port_tx()
912 rv = usb_submit_urb(desc->command, GFP_KERNEL); in wdm_wwan_port_tx()
927 static void wdm_wwan_init(struct wdm_device *desc) in wdm_wwan_init() argument
929 struct usb_interface *intf = desc->intf; in wdm_wwan_init()
933 if (desc->wwanp_type == WWAN_PORT_UNKNOWN) { in wdm_wwan_init()
938 port = wwan_create_port(&intf->dev, desc->wwanp_type, &wdm_wwan_port_ops, in wdm_wwan_init()
939 NULL, desc); in wdm_wwan_init()
946 desc->wwanp = port; in wdm_wwan_init()
949 static void wdm_wwan_deinit(struct wdm_device *desc) in wdm_wwan_deinit() argument
951 if (!desc->wwanp) in wdm_wwan_deinit()
954 wwan_remove_port(desc->wwanp); in wdm_wwan_deinit()
955 desc->wwanp = NULL; in wdm_wwan_deinit()
958 static void wdm_wwan_rx(struct wdm_device *desc, int length) in wdm_wwan_rx() argument
960 struct wwan_port *port = desc->wwanp; in wdm_wwan_rx()
968 skb_put_data(skb, desc->inbuf, length); in wdm_wwan_rx()
972 schedule_work(&desc->service_outs_intr); in wdm_wwan_rx()
975 static void wdm_wwan_init(struct wdm_device *desc) {} in wdm_wwan_init() argument
976 static void wdm_wwan_deinit(struct wdm_device *desc) {} in wdm_wwan_deinit() argument
977 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} in wdm_wwan_rx() argument
983 struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); in wdm_rxwork() local
988 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
989 if (test_bit(WDM_DISCONNECTING, &desc->flags)) { in wdm_rxwork()
990 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
992 responding = test_and_set_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
993 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
995 rv = usb_submit_urb(desc->response, GFP_KERNEL); in wdm_rxwork()
997 spin_lock_irqsave(&desc->iuspin, flags); in wdm_rxwork()
998 clear_bit(WDM_RESPONDING, &desc->flags); in wdm_rxwork()
999 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) in wdm_rxwork()
1000 schedule_work(&desc->rxwork); in wdm_rxwork()
1001 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_rxwork()
1008 struct wdm_device *desc; in service_interrupt_work() local
1010 desc = container_of(work, struct wdm_device, service_outs_intr); in service_interrupt_work()
1012 spin_lock_irq(&desc->iuspin); in service_interrupt_work()
1013 service_outstanding_interrupt(desc); in service_interrupt_work()
1014 if (!desc->resp_count && (desc->length || desc->rerr)) { in service_interrupt_work()
1015 set_bit(WDM_READ, &desc->flags); in service_interrupt_work()
1016 wake_up(&desc->wait); in service_interrupt_work()
1018 spin_unlock_irq(&desc->iuspin); in service_interrupt_work()
1028 struct wdm_device *desc; in wdm_create() local
1030 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); in wdm_create()
1031 if (!desc) in wdm_create()
1033 INIT_LIST_HEAD(&desc->device_list); in wdm_create()
1034 mutex_init(&desc->rlock); in wdm_create()
1035 mutex_init(&desc->wlock); in wdm_create()
1036 spin_lock_init(&desc->iuspin); in wdm_create()
1037 init_waitqueue_head(&desc->wait); in wdm_create()
1038 desc->wMaxCommand = bufsize; in wdm_create()
1040 desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); in wdm_create()
1041 desc->intf = intf; in wdm_create()
1042 desc->wwanp_type = type; in wdm_create()
1043 INIT_WORK(&desc->rxwork, wdm_rxwork); in wdm_create()
1044 INIT_WORK(&desc->service_outs_intr, service_interrupt_work); in wdm_create()
1051 desc->wMaxPacketSize = usb_endpoint_maxp(ep); in wdm_create()
1053 desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1054 if (!desc->orq) in wdm_create()
1056 desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); in wdm_create()
1057 if (!desc->irq) in wdm_create()
1060 desc->validity = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1061 if (!desc->validity) in wdm_create()
1064 desc->response = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1065 if (!desc->response) in wdm_create()
1068 desc->command = usb_alloc_urb(0, GFP_KERNEL); in wdm_create()
1069 if (!desc->command) in wdm_create()
1072 desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1073 if (!desc->ubuf) in wdm_create()
1076 desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL); in wdm_create()
1077 if (!desc->sbuf) in wdm_create()
1080 desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); in wdm_create()
1081 if (!desc->inbuf) in wdm_create()
1085 desc->validity, in wdm_create()
1088 desc->sbuf, in wdm_create()
1089 desc->wMaxPacketSize, in wdm_create()
1091 desc, in wdm_create()
1095 desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); in wdm_create()
1096 desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; in wdm_create()
1097 desc->irq->wValue = 0; in wdm_create()
1098 desc->irq->wIndex = desc->inum; /* already converted */ in wdm_create()
1099 desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); in wdm_create()
1102 desc->response, in wdm_create()
1105 usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), in wdm_create()
1106 (unsigned char *)desc->irq, in wdm_create()
1107 desc->inbuf, in wdm_create()
1108 desc->wMaxCommand, in wdm_create()
1110 desc in wdm_create()
1113 desc->manage_power = manage_power; in wdm_create()
1116 list_add(&desc->device_list, &wdm_device_list); in wdm_create()
1125 wdm_wwan_init(desc); in wdm_create()
1131 list_del(&desc->device_list); in wdm_create()
1133 cleanup(desc); in wdm_create()
1167 if (iface->desc.bNumEndpoints != 1) in wdm_probe()
1169 ep = &iface->endpoint[0].desc; in wdm_probe()
1217 struct wdm_device *desc; in wdm_disconnect() local
1221 desc = wdm_find_device(intf); in wdm_disconnect()
1224 wdm_wwan_deinit(desc); in wdm_disconnect()
1227 spin_lock_irqsave(&desc->iuspin, flags); in wdm_disconnect()
1228 set_bit(WDM_DISCONNECTING, &desc->flags); in wdm_disconnect()
1229 set_bit(WDM_READ, &desc->flags); in wdm_disconnect()
1230 spin_unlock_irqrestore(&desc->iuspin, flags); in wdm_disconnect()
1231 wake_up_all(&desc->wait); in wdm_disconnect()
1232 mutex_lock(&desc->rlock); in wdm_disconnect()
1233 mutex_lock(&desc->wlock); in wdm_disconnect()
1234 poison_urbs(desc); in wdm_disconnect()
1235 cancel_work_sync(&desc->rxwork); in wdm_disconnect()
1236 cancel_work_sync(&desc->service_outs_intr); in wdm_disconnect()
1237 mutex_unlock(&desc->wlock); in wdm_disconnect()
1238 mutex_unlock(&desc->rlock); in wdm_disconnect()
1242 list_del(&desc->device_list); in wdm_disconnect()
1245 if (!desc->count) in wdm_disconnect()
1246 cleanup(desc); in wdm_disconnect()
1248 dev_dbg(&intf->dev, "%d open files - postponing cleanup\n", desc->count); in wdm_disconnect()
1255 struct wdm_device *desc = wdm_find_device(intf); in wdm_suspend() local
1258 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); in wdm_suspend()
1262 mutex_lock(&desc->rlock); in wdm_suspend()
1263 mutex_lock(&desc->wlock); in wdm_suspend()
1265 spin_lock_irq(&desc->iuspin); in wdm_suspend()
1268 (test_bit(WDM_IN_USE, &desc->flags) in wdm_suspend()
1269 || test_bit(WDM_RESPONDING, &desc->flags))) { in wdm_suspend()
1270 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1274 set_bit(WDM_SUSPENDING, &desc->flags); in wdm_suspend()
1275 spin_unlock_irq(&desc->iuspin); in wdm_suspend()
1277 poison_urbs(desc); in wdm_suspend()
1278 cancel_work_sync(&desc->rxwork); in wdm_suspend()
1279 cancel_work_sync(&desc->service_outs_intr); in wdm_suspend()
1280 unpoison_urbs(desc); in wdm_suspend()
1283 mutex_unlock(&desc->wlock); in wdm_suspend()
1284 mutex_unlock(&desc->rlock); in wdm_suspend()
1291 static int recover_from_urb_loss(struct wdm_device *desc) in recover_from_urb_loss() argument
1295 if (desc->count) { in recover_from_urb_loss()
1296 rv = usb_submit_urb(desc->validity, GFP_NOIO); in recover_from_urb_loss()
1298 dev_err(&desc->intf->dev, in recover_from_urb_loss()
1307 struct wdm_device *desc = wdm_find_device(intf); in wdm_resume() local
1310 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); in wdm_resume()
1312 clear_bit(WDM_SUSPENDING, &desc->flags); in wdm_resume()
1313 rv = recover_from_urb_loss(desc); in wdm_resume()
1321 struct wdm_device *desc = wdm_find_device(intf); in wdm_pre_reset() local
1329 spin_lock_irq(&desc->iuspin); in wdm_pre_reset()
1330 set_bit(WDM_RESETTING, &desc->flags); /* inform read/write */ in wdm_pre_reset()
1331 set_bit(WDM_READ, &desc->flags); /* unblock read */ in wdm_pre_reset()
1332 clear_bit(WDM_IN_USE, &desc->flags); /* unblock write */ in wdm_pre_reset()
1333 desc->rerr = -EINTR; in wdm_pre_reset()
1334 spin_unlock_irq(&desc->iuspin); in wdm_pre_reset()
1335 wake_up_all(&desc->wait); in wdm_pre_reset()
1336 mutex_lock(&desc->rlock); in wdm_pre_reset()
1337 mutex_lock(&desc->wlock); in wdm_pre_reset()
1338 poison_urbs(desc); in wdm_pre_reset()
1339 cancel_work_sync(&desc->rxwork); in wdm_pre_reset()
1340 cancel_work_sync(&desc->service_outs_intr); in wdm_pre_reset()
1346 struct wdm_device *desc = wdm_find_device(intf); in wdm_post_reset() local
1349 unpoison_urbs(desc); in wdm_post_reset()
1350 clear_bit(WDM_OVERFLOW, &desc->flags); in wdm_post_reset()
1351 clear_bit(WDM_RESETTING, &desc->flags); in wdm_post_reset()
1352 rv = recover_from_urb_loss(desc); in wdm_post_reset()
1353 mutex_unlock(&desc->wlock); in wdm_post_reset()
1354 mutex_unlock(&desc->rlock); in wdm_post_reset()