diff options
Diffstat (limited to 'drivers/usb/class')
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 38 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-wdm.c | 399 |
2 files changed, 289 insertions, 148 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 9543b19d410c..b32ccb461019 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/serial.h> | 39 | #include <linux/serial.h> |
| 40 | #include <linux/tty_driver.h> | 40 | #include <linux/tty_driver.h> |
| 41 | #include <linux/tty_flip.h> | 41 | #include <linux/tty_flip.h> |
| 42 | #include <linux/serial.h> | ||
| 42 | #include <linux/module.h> | 43 | #include <linux/module.h> |
| 43 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
| 44 | #include <linux/uaccess.h> | 45 | #include <linux/uaccess.h> |
| @@ -508,17 +509,12 @@ static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty) | |||
| 508 | if (!acm) | 509 | if (!acm) |
| 509 | return -ENODEV; | 510 | return -ENODEV; |
| 510 | 511 | ||
| 511 | retval = tty_init_termios(tty); | 512 | retval = tty_standard_install(driver, tty); |
| 512 | if (retval) | 513 | if (retval) |
| 513 | goto error_init_termios; | 514 | goto error_init_termios; |
| 514 | 515 | ||
| 515 | tty->driver_data = acm; | 516 | tty->driver_data = acm; |
| 516 | 517 | ||
| 517 | /* Final install (we use the default method) */ | ||
| 518 | tty_driver_kref_get(driver); | ||
| 519 | tty->count++; | ||
| 520 | driver->ttys[tty->index] = tty; | ||
| 521 | |||
| 522 | return 0; | 518 | return 0; |
| 523 | 519 | ||
| 524 | error_init_termios: | 520 | error_init_termios: |
| @@ -773,10 +769,37 @@ static int acm_tty_tiocmset(struct tty_struct *tty, | |||
| 773 | return acm_set_control(acm, acm->ctrlout = newctrl); | 769 | return acm_set_control(acm, acm->ctrlout = newctrl); |
| 774 | } | 770 | } |
| 775 | 771 | ||
| 772 | static int get_serial_info(struct acm *acm, struct serial_struct __user *info) | ||
| 773 | { | ||
| 774 | struct serial_struct tmp; | ||
| 775 | |||
| 776 | if (!info) | ||
| 777 | return -EINVAL; | ||
| 778 | |||
| 779 | memset(&tmp, 0, sizeof(tmp)); | ||
| 780 | tmp.flags = ASYNC_LOW_LATENCY; | ||
| 781 | tmp.xmit_fifo_size = acm->writesize; | ||
| 782 | tmp.baud_base = le32_to_cpu(acm->line.dwDTERate); | ||
| 783 | |||
| 784 | if (copy_to_user(info, &tmp, sizeof(tmp))) | ||
| 785 | return -EFAULT; | ||
| 786 | else | ||
| 787 | return 0; | ||
| 788 | } | ||
| 789 | |||
| 776 | static int acm_tty_ioctl(struct tty_struct *tty, | 790 | static int acm_tty_ioctl(struct tty_struct *tty, |
| 777 | unsigned int cmd, unsigned long arg) | 791 | unsigned int cmd, unsigned long arg) |
| 778 | { | 792 | { |
| 779 | return -ENOIOCTLCMD; | 793 | struct acm *acm = tty->driver_data; |
| 794 | int rv = -ENOIOCTLCMD; | ||
| 795 | |||
| 796 | switch (cmd) { | ||
| 797 | case TIOCGSERIAL: /* gets serial port data */ | ||
| 798 | rv = get_serial_info(acm, (struct serial_struct __user *) arg); | ||
| 799 | break; | ||
| 800 | } | ||
| 801 | |||
| 802 | return rv; | ||
| 780 | } | 803 | } |
| 781 | 804 | ||
| 782 | static const __u32 acm_tty_speed[] = { | 805 | static const __u32 acm_tty_speed[] = { |
| @@ -1675,7 +1698,6 @@ static int __init acm_init(void) | |||
| 1675 | acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS); | 1698 | acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS); |
| 1676 | if (!acm_tty_driver) | 1699 | if (!acm_tty_driver) |
| 1677 | return -ENOMEM; | 1700 | return -ENOMEM; |
| 1678 | acm_tty_driver->owner = THIS_MODULE, | ||
| 1679 | acm_tty_driver->driver_name = "acm", | 1701 | acm_tty_driver->driver_name = "acm", |
| 1680 | acm_tty_driver->name = "ttyACM", | 1702 | acm_tty_driver->name = "ttyACM", |
| 1681 | acm_tty_driver->major = ACM_TTY_MAJOR, | 1703 | acm_tty_driver->major = ACM_TTY_MAJOR, |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 1c50baff7725..c6f6560d436c 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/usb/cdc.h> | 23 | #include <linux/usb/cdc.h> |
| 24 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
| 25 | #include <asm/unaligned.h> | 25 | #include <asm/unaligned.h> |
| 26 | #include <linux/usb/cdc-wdm.h> | ||
| 26 | 27 | ||
| 27 | /* | 28 | /* |
| 28 | * Version Information | 29 | * Version Information |
| @@ -31,6 +32,8 @@ | |||
| 31 | #define DRIVER_AUTHOR "Oliver Neukum" | 32 | #define DRIVER_AUTHOR "Oliver Neukum" |
| 32 | #define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management" | 33 | #define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management" |
| 33 | 34 | ||
| 35 | #define HUAWEI_VENDOR_ID 0x12D1 | ||
| 36 | |||
| 34 | static const struct usb_device_id wdm_ids[] = { | 37 | static const struct usb_device_id wdm_ids[] = { |
| 35 | { | 38 | { |
| 36 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | | 39 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | |
| @@ -38,6 +41,20 @@ static const struct usb_device_id wdm_ids[] = { | |||
| 38 | .bInterfaceClass = USB_CLASS_COMM, | 41 | .bInterfaceClass = USB_CLASS_COMM, |
| 39 | .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM | 42 | .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM |
| 40 | }, | 43 | }, |
| 44 | { | ||
| 45 | /* | ||
| 46 | * Huawei E392, E398 and possibly other Qualcomm based modems | ||
| 47 | * embed the Qualcomm QMI protocol inside CDC on CDC ECM like | ||
| 48 | * control interfaces. Userspace access to this is required | ||
| 49 | * to configure the accompanying data interface | ||
| 50 | */ | ||
| 51 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | | ||
| 52 | USB_DEVICE_ID_MATCH_INT_INFO, | ||
| 53 | .idVendor = HUAWEI_VENDOR_ID, | ||
| 54 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | ||
| 55 | .bInterfaceSubClass = 1, | ||
| 56 | .bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */ | ||
| 57 | }, | ||
| 41 | { } | 58 | { } |
| 42 | }; | 59 | }; |
| 43 | 60 | ||
| @@ -54,11 +71,16 @@ MODULE_DEVICE_TABLE (usb, wdm_ids); | |||
| 54 | #define WDM_POLL_RUNNING 6 | 71 | #define WDM_POLL_RUNNING 6 |
| 55 | #define WDM_RESPONDING 7 | 72 | #define WDM_RESPONDING 7 |
| 56 | #define WDM_SUSPENDING 8 | 73 | #define WDM_SUSPENDING 8 |
| 74 | #define WDM_RESETTING 9 | ||
| 57 | 75 | ||
| 58 | #define WDM_MAX 16 | 76 | #define WDM_MAX 16 |
| 59 | 77 | ||
| 78 | /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */ | ||
| 79 | #define WDM_DEFAULT_BUFSIZE 256 | ||
| 60 | 80 | ||
| 61 | static DEFINE_MUTEX(wdm_mutex); | 81 | static DEFINE_MUTEX(wdm_mutex); |
| 82 | static DEFINE_SPINLOCK(wdm_device_list_lock); | ||
| 83 | static LIST_HEAD(wdm_device_list); | ||
| 62 | 84 | ||
| 63 | /* --- method tables --- */ | 85 | /* --- method tables --- */ |
| 64 | 86 | ||
| @@ -80,7 +102,6 @@ struct wdm_device { | |||
| 80 | u16 bufsize; | 102 | u16 bufsize; |
| 81 | u16 wMaxCommand; | 103 | u16 wMaxCommand; |
| 82 | u16 wMaxPacketSize; | 104 | u16 wMaxPacketSize; |
| 83 | u16 bMaxPacketSize0; | ||
| 84 | __le16 inum; | 105 | __le16 inum; |
| 85 | int reslength; | 106 | int reslength; |
| 86 | int length; | 107 | int length; |
| @@ -88,15 +109,46 @@ struct wdm_device { | |||
| 88 | int count; | 109 | int count; |
| 89 | dma_addr_t shandle; | 110 | dma_addr_t shandle; |
| 90 | dma_addr_t ihandle; | 111 | dma_addr_t ihandle; |
| 91 | struct mutex lock; | 112 | struct mutex wlock; |
| 113 | struct mutex rlock; | ||
| 92 | wait_queue_head_t wait; | 114 | wait_queue_head_t wait; |
| 93 | struct work_struct rxwork; | 115 | struct work_struct rxwork; |
| 94 | int werr; | 116 | int werr; |
| 95 | int rerr; | 117 | int rerr; |
| 118 | |||
| 119 | struct list_head device_list; | ||
| 120 | int (*manage_power)(struct usb_interface *, int); | ||
| 96 | }; | 121 | }; |
| 97 | 122 | ||
| 98 | static struct usb_driver wdm_driver; | 123 | static struct usb_driver wdm_driver; |
| 99 | 124 | ||
| 125 | /* return intfdata if we own the interface, else look up intf in the list */ | ||
| 126 | static struct wdm_device *wdm_find_device(struct usb_interface *intf) | ||
| 127 | { | ||
| 128 | struct wdm_device *desc = NULL; | ||
| 129 | |||
| 130 | spin_lock(&wdm_device_list_lock); | ||
| 131 | list_for_each_entry(desc, &wdm_device_list, device_list) | ||
| 132 | if (desc->intf == intf) | ||
| 133 | break; | ||
| 134 | spin_unlock(&wdm_device_list_lock); | ||
| 135 | |||
| 136 | return desc; | ||
| 137 | } | ||
| 138 | |||
| 139 | static struct wdm_device *wdm_find_device_by_minor(int minor) | ||
| 140 | { | ||
| 141 | struct wdm_device *desc = NULL; | ||
| 142 | |||
| 143 | spin_lock(&wdm_device_list_lock); | ||
| 144 | list_for_each_entry(desc, &wdm_device_list, device_list) | ||
| 145 | if (desc->intf->minor == minor) | ||
| 146 | break; | ||
| 147 | spin_unlock(&wdm_device_list_lock); | ||
| 148 | |||
| 149 | return desc; | ||
| 150 | } | ||
| 151 | |||
| 100 | /* --- callbacks --- */ | 152 | /* --- callbacks --- */ |
| 101 | static void wdm_out_callback(struct urb *urb) | 153 | static void wdm_out_callback(struct urb *urb) |
| 102 | { | 154 | { |
| @@ -159,11 +211,9 @@ static void wdm_int_callback(struct urb *urb) | |||
| 159 | int rv = 0; | 211 | int rv = 0; |
| 160 | int status = urb->status; | 212 | int status = urb->status; |
| 161 | struct wdm_device *desc; | 213 | struct wdm_device *desc; |
| 162 | struct usb_ctrlrequest *req; | ||
| 163 | struct usb_cdc_notification *dr; | 214 | struct usb_cdc_notification *dr; |
| 164 | 215 | ||
| 165 | desc = urb->context; | 216 | desc = urb->context; |
| 166 | req = desc->irq; | ||
| 167 | dr = (struct usb_cdc_notification *)desc->sbuf; | 217 | dr = (struct usb_cdc_notification *)desc->sbuf; |
| 168 | 218 | ||
| 169 | if (status) { | 219 | if (status) { |
| @@ -210,24 +260,6 @@ static void wdm_int_callback(struct urb *urb) | |||
| 210 | goto exit; | 260 | goto exit; |
| 211 | } | 261 | } |
| 212 | 262 | ||
| 213 | req->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); | ||
| 214 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | ||
| 215 | req->wValue = 0; | ||
| 216 | req->wIndex = desc->inum; | ||
| 217 | req->wLength = cpu_to_le16(desc->wMaxCommand); | ||
| 218 | |||
| 219 | usb_fill_control_urb( | ||
| 220 | desc->response, | ||
| 221 | interface_to_usbdev(desc->intf), | ||
| 222 | /* using common endpoint 0 */ | ||
| 223 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
| 224 | (unsigned char *)req, | ||
| 225 | desc->inbuf, | ||
| 226 | desc->wMaxCommand, | ||
| 227 | wdm_in_callback, | ||
| 228 | desc | ||
| 229 | ); | ||
| 230 | desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
| 231 | spin_lock(&desc->iuspin); | 263 | spin_lock(&desc->iuspin); |
| 232 | clear_bit(WDM_READ, &desc->flags); | 264 | clear_bit(WDM_READ, &desc->flags); |
| 233 | set_bit(WDM_RESPONDING, &desc->flags); | 265 | set_bit(WDM_RESPONDING, &desc->flags); |
| @@ -276,14 +308,11 @@ static void free_urbs(struct wdm_device *desc) | |||
| 276 | 308 | ||
| 277 | static void cleanup(struct wdm_device *desc) | 309 | static void cleanup(struct wdm_device *desc) |
| 278 | { | 310 | { |
| 279 | usb_free_coherent(interface_to_usbdev(desc->intf), | 311 | spin_lock(&wdm_device_list_lock); |
| 280 | desc->wMaxPacketSize, | 312 | list_del(&desc->device_list); |
| 281 | desc->sbuf, | 313 | spin_unlock(&wdm_device_list_lock); |
| 282 | desc->validity->transfer_dma); | 314 | kfree(desc->sbuf); |
| 283 | usb_free_coherent(interface_to_usbdev(desc->intf), | 315 | kfree(desc->inbuf); |
| 284 | desc->bMaxPacketSize0, | ||
| 285 | desc->inbuf, | ||
| 286 | desc->response->transfer_dma); | ||
| 287 | kfree(desc->orq); | 316 | kfree(desc->orq); |
| 288 | kfree(desc->irq); | 317 | kfree(desc->irq); |
| 289 | kfree(desc->ubuf); | 318 | kfree(desc->ubuf); |
| @@ -323,7 +352,7 @@ static ssize_t wdm_write | |||
| 323 | } | 352 | } |
| 324 | 353 | ||
| 325 | /* concurrent writes and disconnect */ | 354 | /* concurrent writes and disconnect */ |
| 326 | r = mutex_lock_interruptible(&desc->lock); | 355 | r = mutex_lock_interruptible(&desc->wlock); |
| 327 | rv = -ERESTARTSYS; | 356 | rv = -ERESTARTSYS; |
| 328 | if (r) { | 357 | if (r) { |
| 329 | kfree(buf); | 358 | kfree(buf); |
| @@ -348,6 +377,10 @@ static ssize_t wdm_write | |||
| 348 | else | 377 | else |
| 349 | if (test_bit(WDM_IN_USE, &desc->flags)) | 378 | if (test_bit(WDM_IN_USE, &desc->flags)) |
| 350 | r = -EAGAIN; | 379 | r = -EAGAIN; |
| 380 | |||
| 381 | if (test_bit(WDM_RESETTING, &desc->flags)) | ||
| 382 | r = -EIO; | ||
| 383 | |||
| 351 | if (r < 0) { | 384 | if (r < 0) { |
| 352 | kfree(buf); | 385 | kfree(buf); |
| 353 | goto out; | 386 | goto out; |
| @@ -386,7 +419,7 @@ static ssize_t wdm_write | |||
| 386 | out: | 419 | out: |
| 387 | usb_autopm_put_interface(desc->intf); | 420 | usb_autopm_put_interface(desc->intf); |
| 388 | outnp: | 421 | outnp: |
| 389 | mutex_unlock(&desc->lock); | 422 | mutex_unlock(&desc->wlock); |
| 390 | outnl: | 423 | outnl: |
| 391 | return rv < 0 ? rv : count; | 424 | return rv < 0 ? rv : count; |
| 392 | } | 425 | } |
| @@ -394,16 +427,17 @@ outnl: | |||
| 394 | static ssize_t wdm_read | 427 | static ssize_t wdm_read |
| 395 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 428 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
| 396 | { | 429 | { |
| 397 | int rv, cntr = 0; | 430 | int rv, cntr; |
| 398 | int i = 0; | 431 | int i = 0; |
| 399 | struct wdm_device *desc = file->private_data; | 432 | struct wdm_device *desc = file->private_data; |
| 400 | 433 | ||
| 401 | 434 | ||
| 402 | rv = mutex_lock_interruptible(&desc->lock); /*concurrent reads */ | 435 | rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ |
| 403 | if (rv < 0) | 436 | if (rv < 0) |
| 404 | return -ERESTARTSYS; | 437 | return -ERESTARTSYS; |
| 405 | 438 | ||
| 406 | if (desc->length == 0) { | 439 | cntr = ACCESS_ONCE(desc->length); |
| 440 | if (cntr == 0) { | ||
| 407 | desc->read = 0; | 441 | desc->read = 0; |
| 408 | retry: | 442 | retry: |
| 409 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | 443 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { |
| @@ -427,6 +461,10 @@ retry: | |||
| 427 | rv = -ENODEV; | 461 | rv = -ENODEV; |
| 428 | goto err; | 462 | goto err; |
| 429 | } | 463 | } |
| 464 | if (test_bit(WDM_RESETTING, &desc->flags)) { | ||
| 465 | rv = -EIO; | ||
| 466 | goto err; | ||
| 467 | } | ||
| 430 | usb_mark_last_busy(interface_to_usbdev(desc->intf)); | 468 | usb_mark_last_busy(interface_to_usbdev(desc->intf)); |
| 431 | if (rv < 0) { | 469 | if (rv < 0) { |
| 432 | rv = -ERESTARTSYS; | 470 | rv = -ERESTARTSYS; |
| @@ -453,17 +491,20 @@ retry: | |||
| 453 | spin_unlock_irq(&desc->iuspin); | 491 | spin_unlock_irq(&desc->iuspin); |
| 454 | goto retry; | 492 | goto retry; |
| 455 | } | 493 | } |
| 456 | clear_bit(WDM_READ, &desc->flags); | 494 | cntr = desc->length; |
| 457 | spin_unlock_irq(&desc->iuspin); | 495 | spin_unlock_irq(&desc->iuspin); |
| 458 | } | 496 | } |
| 459 | 497 | ||
| 460 | cntr = count > desc->length ? desc->length : count; | 498 | if (cntr > count) |
| 499 | cntr = count; | ||
| 461 | rv = copy_to_user(buffer, desc->ubuf, cntr); | 500 | rv = copy_to_user(buffer, desc->ubuf, cntr); |
| 462 | if (rv > 0) { | 501 | if (rv > 0) { |
| 463 | rv = -EFAULT; | 502 | rv = -EFAULT; |
| 464 | goto err; | 503 | goto err; |
| 465 | } | 504 | } |
| 466 | 505 | ||
| 506 | spin_lock_irq(&desc->iuspin); | ||
| 507 | |||
| 467 | for (i = 0; i < desc->length - cntr; i++) | 508 | for (i = 0; i < desc->length - cntr; i++) |
| 468 | desc->ubuf[i] = desc->ubuf[i + cntr]; | 509 | desc->ubuf[i] = desc->ubuf[i + cntr]; |
| 469 | 510 | ||
| @@ -471,10 +512,13 @@ retry: | |||
| 471 | /* in case we had outstanding data */ | 512 | /* in case we had outstanding data */ |
| 472 | if (!desc->length) | 513 | if (!desc->length) |
| 473 | clear_bit(WDM_READ, &desc->flags); | 514 | clear_bit(WDM_READ, &desc->flags); |
| 515 | |||
| 516 | spin_unlock_irq(&desc->iuspin); | ||
| 517 | |||
| 474 | rv = cntr; | 518 | rv = cntr; |
| 475 | 519 | ||
| 476 | err: | 520 | err: |
| 477 | mutex_unlock(&desc->lock); | 521 | mutex_unlock(&desc->rlock); |
| 478 | return rv; | 522 | return rv; |
| 479 | } | 523 | } |
| 480 | 524 | ||
| @@ -524,11 +568,11 @@ static int wdm_open(struct inode *inode, struct file *file) | |||
| 524 | struct wdm_device *desc; | 568 | struct wdm_device *desc; |
| 525 | 569 | ||
| 526 | mutex_lock(&wdm_mutex); | 570 | mutex_lock(&wdm_mutex); |
| 527 | intf = usb_find_interface(&wdm_driver, minor); | 571 | desc = wdm_find_device_by_minor(minor); |
| 528 | if (!intf) | 572 | if (!desc) |
| 529 | goto out; | 573 | goto out; |
| 530 | 574 | ||
| 531 | desc = usb_get_intfdata(intf); | 575 | intf = desc->intf; |
| 532 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) | 576 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) |
| 533 | goto out; | 577 | goto out; |
| 534 | file->private_data = desc; | 578 | file->private_data = desc; |
| @@ -538,9 +582,9 @@ static int wdm_open(struct inode *inode, struct file *file) | |||
| 538 | dev_err(&desc->intf->dev, "Error autopm - %d\n", rv); | 582 | dev_err(&desc->intf->dev, "Error autopm - %d\n", rv); |
| 539 | goto out; | 583 | goto out; |
| 540 | } | 584 | } |
| 541 | intf->needs_remote_wakeup = 1; | ||
| 542 | 585 | ||
| 543 | mutex_lock(&desc->lock); | 586 | /* using write lock to protect desc->count */ |
| 587 | mutex_lock(&desc->wlock); | ||
| 544 | if (!desc->count++) { | 588 | if (!desc->count++) { |
| 545 | desc->werr = 0; | 589 | desc->werr = 0; |
| 546 | desc->rerr = 0; | 590 | desc->rerr = 0; |
| @@ -553,7 +597,9 @@ static int wdm_open(struct inode *inode, struct file *file) | |||
| 553 | } else { | 597 | } else { |
| 554 | rv = 0; | 598 | rv = 0; |
| 555 | } | 599 | } |
| 556 | mutex_unlock(&desc->lock); | 600 | mutex_unlock(&desc->wlock); |
| 601 | if (desc->count == 1) | ||
| 602 | desc->manage_power(intf, 1); | ||
| 557 | usb_autopm_put_interface(desc->intf); | 603 | usb_autopm_put_interface(desc->intf); |
| 558 | out: | 604 | out: |
| 559 | mutex_unlock(&wdm_mutex); | 605 | mutex_unlock(&wdm_mutex); |
| @@ -565,15 +611,17 @@ static int wdm_release(struct inode *inode, struct file *file) | |||
| 565 | struct wdm_device *desc = file->private_data; | 611 | struct wdm_device *desc = file->private_data; |
| 566 | 612 | ||
| 567 | mutex_lock(&wdm_mutex); | 613 | mutex_lock(&wdm_mutex); |
| 568 | mutex_lock(&desc->lock); | 614 | |
| 615 | /* using write lock to protect desc->count */ | ||
| 616 | mutex_lock(&desc->wlock); | ||
| 569 | desc->count--; | 617 | desc->count--; |
| 570 | mutex_unlock(&desc->lock); | 618 | mutex_unlock(&desc->wlock); |
| 571 | 619 | ||
| 572 | if (!desc->count) { | 620 | if (!desc->count) { |
| 573 | dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); | 621 | dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); |
| 574 | kill_urbs(desc); | 622 | kill_urbs(desc); |
| 575 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) | 623 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) |
| 576 | desc->intf->needs_remote_wakeup = 0; | 624 | desc->manage_power(desc->intf, 0); |
| 577 | } | 625 | } |
| 578 | mutex_unlock(&wdm_mutex); | 626 | mutex_unlock(&wdm_mutex); |
| 579 | return 0; | 627 | return 0; |
| @@ -620,70 +668,31 @@ static void wdm_rxwork(struct work_struct *work) | |||
| 620 | 668 | ||
| 621 | /* --- hotplug --- */ | 669 | /* --- hotplug --- */ |
| 622 | 670 | ||
| 623 | static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | 671 | static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor *ep, |
| 672 | u16 bufsize, int (*manage_power)(struct usb_interface *, int)) | ||
| 624 | { | 673 | { |
| 625 | int rv = -EINVAL; | 674 | int rv = -ENOMEM; |
| 626 | struct usb_device *udev = interface_to_usbdev(intf); | ||
| 627 | struct wdm_device *desc; | 675 | struct wdm_device *desc; |
| 628 | struct usb_host_interface *iface; | ||
| 629 | struct usb_endpoint_descriptor *ep; | ||
| 630 | struct usb_cdc_dmm_desc *dmhd; | ||
| 631 | u8 *buffer = intf->altsetting->extra; | ||
| 632 | int buflen = intf->altsetting->extralen; | ||
| 633 | u16 maxcom = 0; | ||
| 634 | |||
| 635 | if (!buffer) | ||
| 636 | goto out; | ||
| 637 | |||
| 638 | while (buflen > 2) { | ||
| 639 | if (buffer [1] != USB_DT_CS_INTERFACE) { | ||
| 640 | dev_err(&intf->dev, "skipping garbage\n"); | ||
| 641 | goto next_desc; | ||
| 642 | } | ||
| 643 | |||
| 644 | switch (buffer [2]) { | ||
| 645 | case USB_CDC_HEADER_TYPE: | ||
| 646 | break; | ||
| 647 | case USB_CDC_DMM_TYPE: | ||
| 648 | dmhd = (struct usb_cdc_dmm_desc *)buffer; | ||
| 649 | maxcom = le16_to_cpu(dmhd->wMaxCommand); | ||
| 650 | dev_dbg(&intf->dev, | ||
| 651 | "Finding maximum buffer length: %d", maxcom); | ||
| 652 | break; | ||
| 653 | default: | ||
| 654 | dev_err(&intf->dev, | ||
| 655 | "Ignoring extra header, type %d, length %d\n", | ||
| 656 | buffer[2], buffer[0]); | ||
| 657 | break; | ||
| 658 | } | ||
| 659 | next_desc: | ||
| 660 | buflen -= buffer[0]; | ||
| 661 | buffer += buffer[0]; | ||
| 662 | } | ||
| 663 | 676 | ||
| 664 | rv = -ENOMEM; | ||
| 665 | desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); | 677 | desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); |
| 666 | if (!desc) | 678 | if (!desc) |
| 667 | goto out; | 679 | goto out; |
| 668 | mutex_init(&desc->lock); | 680 | INIT_LIST_HEAD(&desc->device_list); |
| 681 | mutex_init(&desc->rlock); | ||
| 682 | mutex_init(&desc->wlock); | ||
| 669 | spin_lock_init(&desc->iuspin); | 683 | spin_lock_init(&desc->iuspin); |
| 670 | init_waitqueue_head(&desc->wait); | 684 | init_waitqueue_head(&desc->wait); |
| 671 | desc->wMaxCommand = maxcom; | 685 | desc->wMaxCommand = bufsize; |
| 672 | /* this will be expanded and needed in hardware endianness */ | 686 | /* this will be expanded and needed in hardware endianness */ |
| 673 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); | 687 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); |
| 674 | desc->intf = intf; | 688 | desc->intf = intf; |
| 675 | INIT_WORK(&desc->rxwork, wdm_rxwork); | 689 | INIT_WORK(&desc->rxwork, wdm_rxwork); |
| 676 | 690 | ||
| 677 | rv = -EINVAL; | 691 | rv = -EINVAL; |
| 678 | iface = intf->cur_altsetting; | 692 | if (!usb_endpoint_is_int_in(ep)) |
| 679 | if (iface->desc.bNumEndpoints != 1) | ||
| 680 | goto err; | ||
| 681 | ep = &iface->endpoint[0].desc; | ||
| 682 | if (!ep || !usb_endpoint_is_int_in(ep)) | ||
| 683 | goto err; | 693 | goto err; |
| 684 | 694 | ||
| 685 | desc->wMaxPacketSize = usb_endpoint_maxp(ep); | 695 | desc->wMaxPacketSize = usb_endpoint_maxp(ep); |
| 686 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; | ||
| 687 | 696 | ||
| 688 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 697 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); |
| 689 | if (!desc->orq) | 698 | if (!desc->orq) |
| @@ -708,19 +717,13 @@ next_desc: | |||
| 708 | if (!desc->ubuf) | 717 | if (!desc->ubuf) |
| 709 | goto err; | 718 | goto err; |
| 710 | 719 | ||
| 711 | desc->sbuf = usb_alloc_coherent(interface_to_usbdev(intf), | 720 | desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL); |
| 712 | desc->wMaxPacketSize, | ||
| 713 | GFP_KERNEL, | ||
| 714 | &desc->validity->transfer_dma); | ||
| 715 | if (!desc->sbuf) | 721 | if (!desc->sbuf) |
| 716 | goto err; | 722 | goto err; |
| 717 | 723 | ||
| 718 | desc->inbuf = usb_alloc_coherent(interface_to_usbdev(intf), | 724 | desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); |
| 719 | desc->bMaxPacketSize0, | ||
| 720 | GFP_KERNEL, | ||
| 721 | &desc->response->transfer_dma); | ||
| 722 | if (!desc->inbuf) | 725 | if (!desc->inbuf) |
| 723 | goto err2; | 726 | goto err; |
| 724 | 727 | ||
| 725 | usb_fill_int_urb( | 728 | usb_fill_int_urb( |
| 726 | desc->validity, | 729 | desc->validity, |
| @@ -732,45 +735,149 @@ next_desc: | |||
| 732 | desc, | 735 | desc, |
| 733 | ep->bInterval | 736 | ep->bInterval |
| 734 | ); | 737 | ); |
| 735 | desc->validity->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
| 736 | 738 | ||
| 737 | usb_set_intfdata(intf, desc); | 739 | desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); |
| 740 | desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | ||
| 741 | desc->irq->wValue = 0; | ||
| 742 | desc->irq->wIndex = desc->inum; | ||
| 743 | desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); | ||
| 744 | |||
| 745 | usb_fill_control_urb( | ||
| 746 | desc->response, | ||
| 747 | interface_to_usbdev(intf), | ||
| 748 | /* using common endpoint 0 */ | ||
| 749 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
| 750 | (unsigned char *)desc->irq, | ||
| 751 | desc->inbuf, | ||
| 752 | desc->wMaxCommand, | ||
| 753 | wdm_in_callback, | ||
| 754 | desc | ||
| 755 | ); | ||
| 756 | |||
| 757 | desc->manage_power = manage_power; | ||
| 758 | |||
| 759 | spin_lock(&wdm_device_list_lock); | ||
| 760 | list_add(&desc->device_list, &wdm_device_list); | ||
| 761 | spin_unlock(&wdm_device_list_lock); | ||
| 762 | |||
| 738 | rv = usb_register_dev(intf, &wdm_class); | 763 | rv = usb_register_dev(intf, &wdm_class); |
| 739 | if (rv < 0) | 764 | if (rv < 0) |
| 740 | goto err3; | 765 | goto err; |
| 741 | else | 766 | else |
| 742 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | 767 | dev_info(&intf->dev, "%s: USB WDM device\n", dev_name(intf->usb_dev)); |
| 743 | intf->minor - WDM_MINOR_BASE); | ||
| 744 | out: | 768 | out: |
| 745 | return rv; | 769 | return rv; |
| 746 | err3: | ||
| 747 | usb_set_intfdata(intf, NULL); | ||
| 748 | usb_free_coherent(interface_to_usbdev(desc->intf), | ||
| 749 | desc->bMaxPacketSize0, | ||
| 750 | desc->inbuf, | ||
| 751 | desc->response->transfer_dma); | ||
| 752 | err2: | ||
| 753 | usb_free_coherent(interface_to_usbdev(desc->intf), | ||
| 754 | desc->wMaxPacketSize, | ||
| 755 | desc->sbuf, | ||
| 756 | desc->validity->transfer_dma); | ||
| 757 | err: | 770 | err: |
| 758 | free_urbs(desc); | 771 | cleanup(desc); |
| 759 | kfree(desc->ubuf); | 772 | return rv; |
| 760 | kfree(desc->orq); | 773 | } |
| 761 | kfree(desc->irq); | 774 | |
| 762 | kfree(desc); | 775 | static int wdm_manage_power(struct usb_interface *intf, int on) |
| 776 | { | ||
| 777 | /* need autopm_get/put here to ensure the usbcore sees the new value */ | ||
| 778 | int rv = usb_autopm_get_interface(intf); | ||
| 779 | if (rv < 0) | ||
| 780 | goto err; | ||
| 781 | |||
| 782 | intf->needs_remote_wakeup = on; | ||
| 783 | usb_autopm_put_interface(intf); | ||
| 784 | err: | ||
| 763 | return rv; | 785 | return rv; |
| 764 | } | 786 | } |
| 765 | 787 | ||
| 788 | static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
| 789 | { | ||
| 790 | int rv = -EINVAL; | ||
| 791 | struct usb_host_interface *iface; | ||
| 792 | struct usb_endpoint_descriptor *ep; | ||
| 793 | struct usb_cdc_dmm_desc *dmhd; | ||
| 794 | u8 *buffer = intf->altsetting->extra; | ||
| 795 | int buflen = intf->altsetting->extralen; | ||
| 796 | u16 maxcom = WDM_DEFAULT_BUFSIZE; | ||
| 797 | |||
| 798 | if (!buffer) | ||
| 799 | goto err; | ||
| 800 | while (buflen > 2) { | ||
| 801 | if (buffer[1] != USB_DT_CS_INTERFACE) { | ||
| 802 | dev_err(&intf->dev, "skipping garbage\n"); | ||
| 803 | goto next_desc; | ||
| 804 | } | ||
| 805 | |||
| 806 | switch (buffer[2]) { | ||
| 807 | case USB_CDC_HEADER_TYPE: | ||
| 808 | break; | ||
| 809 | case USB_CDC_DMM_TYPE: | ||
| 810 | dmhd = (struct usb_cdc_dmm_desc *)buffer; | ||
| 811 | maxcom = le16_to_cpu(dmhd->wMaxCommand); | ||
| 812 | dev_dbg(&intf->dev, | ||
| 813 | "Finding maximum buffer length: %d", maxcom); | ||
| 814 | break; | ||
| 815 | default: | ||
| 816 | dev_err(&intf->dev, | ||
| 817 | "Ignoring extra header, type %d, length %d\n", | ||
| 818 | buffer[2], buffer[0]); | ||
| 819 | break; | ||
| 820 | } | ||
| 821 | next_desc: | ||
| 822 | buflen -= buffer[0]; | ||
| 823 | buffer += buffer[0]; | ||
| 824 | } | ||
| 825 | |||
| 826 | iface = intf->cur_altsetting; | ||
| 827 | if (iface->desc.bNumEndpoints != 1) | ||
| 828 | goto err; | ||
| 829 | ep = &iface->endpoint[0].desc; | ||
| 830 | |||
| 831 | rv = wdm_create(intf, ep, maxcom, &wdm_manage_power); | ||
| 832 | |||
| 833 | err: | ||
| 834 | return rv; | ||
| 835 | } | ||
| 836 | |||
| 837 | /** | ||
| 838 | * usb_cdc_wdm_register - register a WDM subdriver | ||
| 839 | * @intf: usb interface the subdriver will associate with | ||
| 840 | * @ep: interrupt endpoint to monitor for notifications | ||
| 841 | * @bufsize: maximum message size to support for read/write | ||
| 842 | * | ||
| 843 | * Create WDM usb class character device and associate it with intf | ||
| 844 | * without binding, allowing another driver to manage the interface. | ||
| 845 | * | ||
| 846 | * The subdriver will manage the given interrupt endpoint exclusively | ||
| 847 | * and will issue control requests referring to the given intf. It | ||
| 848 | * will otherwise avoid interferring, and in particular not do | ||
| 849 | * usb_set_intfdata/usb_get_intfdata on intf. | ||
| 850 | * | ||
| 851 | * The return value is a pointer to the subdriver's struct usb_driver. | ||
| 852 | * The registering driver is responsible for calling this subdriver's | ||
| 853 | * disconnect, suspend, resume, pre_reset and post_reset methods from | ||
| 854 | * its own. | ||
| 855 | */ | ||
| 856 | struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, | ||
| 857 | struct usb_endpoint_descriptor *ep, | ||
| 858 | int bufsize, | ||
| 859 | int (*manage_power)(struct usb_interface *, int)) | ||
| 860 | { | ||
| 861 | int rv = -EINVAL; | ||
| 862 | |||
| 863 | rv = wdm_create(intf, ep, bufsize, manage_power); | ||
| 864 | if (rv < 0) | ||
| 865 | goto err; | ||
| 866 | |||
| 867 | return &wdm_driver; | ||
| 868 | err: | ||
| 869 | return ERR_PTR(rv); | ||
| 870 | } | ||
| 871 | EXPORT_SYMBOL(usb_cdc_wdm_register); | ||
| 872 | |||
| 766 | static void wdm_disconnect(struct usb_interface *intf) | 873 | static void wdm_disconnect(struct usb_interface *intf) |
| 767 | { | 874 | { |
| 768 | struct wdm_device *desc; | 875 | struct wdm_device *desc; |
| 769 | unsigned long flags; | 876 | unsigned long flags; |
| 770 | 877 | ||
| 771 | usb_deregister_dev(intf, &wdm_class); | 878 | usb_deregister_dev(intf, &wdm_class); |
| 879 | desc = wdm_find_device(intf); | ||
| 772 | mutex_lock(&wdm_mutex); | 880 | mutex_lock(&wdm_mutex); |
| 773 | desc = usb_get_intfdata(intf); | ||
| 774 | 881 | ||
| 775 | /* the spinlock makes sure no new urbs are generated in the callbacks */ | 882 | /* the spinlock makes sure no new urbs are generated in the callbacks */ |
| 776 | spin_lock_irqsave(&desc->iuspin, flags); | 883 | spin_lock_irqsave(&desc->iuspin, flags); |
| @@ -779,11 +886,13 @@ static void wdm_disconnect(struct usb_interface *intf) | |||
| 779 | /* to terminate pending flushes */ | 886 | /* to terminate pending flushes */ |
| 780 | clear_bit(WDM_IN_USE, &desc->flags); | 887 | clear_bit(WDM_IN_USE, &desc->flags); |
| 781 | spin_unlock_irqrestore(&desc->iuspin, flags); | 888 | spin_unlock_irqrestore(&desc->iuspin, flags); |
| 782 | mutex_lock(&desc->lock); | 889 | wake_up_all(&desc->wait); |
| 890 | mutex_lock(&desc->rlock); | ||
| 891 | mutex_lock(&desc->wlock); | ||
| 783 | kill_urbs(desc); | 892 | kill_urbs(desc); |
| 784 | cancel_work_sync(&desc->rxwork); | 893 | cancel_work_sync(&desc->rxwork); |
| 785 | mutex_unlock(&desc->lock); | 894 | mutex_unlock(&desc->wlock); |
| 786 | wake_up_all(&desc->wait); | 895 | mutex_unlock(&desc->rlock); |
| 787 | if (!desc->count) | 896 | if (!desc->count) |
| 788 | cleanup(desc); | 897 | cleanup(desc); |
| 789 | mutex_unlock(&wdm_mutex); | 898 | mutex_unlock(&wdm_mutex); |
| @@ -792,14 +901,16 @@ static void wdm_disconnect(struct usb_interface *intf) | |||
| 792 | #ifdef CONFIG_PM | 901 | #ifdef CONFIG_PM |
| 793 | static int wdm_suspend(struct usb_interface *intf, pm_message_t message) | 902 | static int wdm_suspend(struct usb_interface *intf, pm_message_t message) |
| 794 | { | 903 | { |
| 795 | struct wdm_device *desc = usb_get_intfdata(intf); | 904 | struct wdm_device *desc = wdm_find_device(intf); |
| 796 | int rv = 0; | 905 | int rv = 0; |
| 797 | 906 | ||
| 798 | dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); | 907 | dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); |
| 799 | 908 | ||
| 800 | /* if this is an autosuspend the caller does the locking */ | 909 | /* if this is an autosuspend the caller does the locking */ |
| 801 | if (!PMSG_IS_AUTO(message)) | 910 | if (!PMSG_IS_AUTO(message)) { |
| 802 | mutex_lock(&desc->lock); | 911 | mutex_lock(&desc->rlock); |
| 912 | mutex_lock(&desc->wlock); | ||
| 913 | } | ||
| 803 | spin_lock_irq(&desc->iuspin); | 914 | spin_lock_irq(&desc->iuspin); |
| 804 | 915 | ||
| 805 | if (PMSG_IS_AUTO(message) && | 916 | if (PMSG_IS_AUTO(message) && |
| @@ -815,8 +926,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 815 | kill_urbs(desc); | 926 | kill_urbs(desc); |
| 816 | cancel_work_sync(&desc->rxwork); | 927 | cancel_work_sync(&desc->rxwork); |
| 817 | } | 928 | } |
| 818 | if (!PMSG_IS_AUTO(message)) | 929 | if (!PMSG_IS_AUTO(message)) { |
| 819 | mutex_unlock(&desc->lock); | 930 | mutex_unlock(&desc->wlock); |
| 931 | mutex_unlock(&desc->rlock); | ||
| 932 | } | ||
| 820 | 933 | ||
| 821 | return rv; | 934 | return rv; |
| 822 | } | 935 | } |
| @@ -838,7 +951,7 @@ static int recover_from_urb_loss(struct wdm_device *desc) | |||
| 838 | #ifdef CONFIG_PM | 951 | #ifdef CONFIG_PM |
| 839 | static int wdm_resume(struct usb_interface *intf) | 952 | static int wdm_resume(struct usb_interface *intf) |
| 840 | { | 953 | { |
| 841 | struct wdm_device *desc = usb_get_intfdata(intf); | 954 | struct wdm_device *desc = wdm_find_device(intf); |
| 842 | int rv; | 955 | int rv; |
| 843 | 956 | ||
| 844 | dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); | 957 | dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); |
| @@ -852,10 +965,7 @@ static int wdm_resume(struct usb_interface *intf) | |||
| 852 | 965 | ||
| 853 | static int wdm_pre_reset(struct usb_interface *intf) | 966 | static int wdm_pre_reset(struct usb_interface *intf) |
| 854 | { | 967 | { |
| 855 | struct wdm_device *desc = usb_get_intfdata(intf); | 968 | struct wdm_device *desc = wdm_find_device(intf); |
| 856 | |||
| 857 | mutex_lock(&desc->lock); | ||
| 858 | kill_urbs(desc); | ||
| 859 | 969 | ||
| 860 | /* | 970 | /* |
| 861 | * we notify everybody using poll of | 971 | * we notify everybody using poll of |
| @@ -864,19 +974,28 @@ static int wdm_pre_reset(struct usb_interface *intf) | |||
| 864 | * message from the device is lost | 974 | * message from the device is lost |
| 865 | */ | 975 | */ |
| 866 | spin_lock_irq(&desc->iuspin); | 976 | spin_lock_irq(&desc->iuspin); |
| 977 | set_bit(WDM_RESETTING, &desc->flags); /* inform read/write */ | ||
| 978 | set_bit(WDM_READ, &desc->flags); /* unblock read */ | ||
| 979 | clear_bit(WDM_IN_USE, &desc->flags); /* unblock write */ | ||
| 867 | desc->rerr = -EINTR; | 980 | desc->rerr = -EINTR; |
| 868 | spin_unlock_irq(&desc->iuspin); | 981 | spin_unlock_irq(&desc->iuspin); |
| 869 | wake_up_all(&desc->wait); | 982 | wake_up_all(&desc->wait); |
| 983 | mutex_lock(&desc->rlock); | ||
| 984 | mutex_lock(&desc->wlock); | ||
| 985 | kill_urbs(desc); | ||
| 986 | cancel_work_sync(&desc->rxwork); | ||
| 870 | return 0; | 987 | return 0; |
| 871 | } | 988 | } |
| 872 | 989 | ||
| 873 | static int wdm_post_reset(struct usb_interface *intf) | 990 | static int wdm_post_reset(struct usb_interface *intf) |
| 874 | { | 991 | { |
| 875 | struct wdm_device *desc = usb_get_intfdata(intf); | 992 | struct wdm_device *desc = wdm_find_device(intf); |
| 876 | int rv; | 993 | int rv; |
| 877 | 994 | ||
| 995 | clear_bit(WDM_RESETTING, &desc->flags); | ||
| 878 | rv = recover_from_urb_loss(desc); | 996 | rv = recover_from_urb_loss(desc); |
| 879 | mutex_unlock(&desc->lock); | 997 | mutex_unlock(&desc->wlock); |
| 998 | mutex_unlock(&desc->rlock); | ||
| 880 | return 0; | 999 | return 0; |
| 881 | } | 1000 | } |
| 882 | 1001 | ||
