diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-23 13:10:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-23 13:10:23 -0400 |
commit | a4e0d9af403d099e751797f6cc69e4a8e2d78ef1 (patch) | |
tree | 6f4afdffe5dbaad7529be987b8c3259a07395031 /drivers/usb/serial/option.c | |
parent | c60f2b5c1defb6b1345968e1c65c2008c221d57d (diff) | |
parent | c010b2f76c3032e48097a6eef291d8593d5d79a6 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r-- | drivers/usb/serial/option.c | 168 |
1 files changed, 75 insertions, 93 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index a73420dd052a..e4eca95f2b0f 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -43,29 +43,25 @@ | |||
43 | #include <linux/usb/serial.h> | 43 | #include <linux/usb/serial.h> |
44 | 44 | ||
45 | /* Function prototypes */ | 45 | /* Function prototypes */ |
46 | static int option_open(struct usb_serial_port *port, struct file *filp); | 46 | static int option_open(struct tty_struct *tty, struct usb_serial_port *port, |
47 | static void option_close(struct usb_serial_port *port, struct file *filp); | 47 | struct file *filp); |
48 | static void option_close(struct tty_struct *tty, struct usb_serial_port *port, | ||
49 | struct file *filp); | ||
48 | static int option_startup(struct usb_serial *serial); | 50 | static int option_startup(struct usb_serial *serial); |
49 | static void option_shutdown(struct usb_serial *serial); | 51 | static void option_shutdown(struct usb_serial *serial); |
50 | static void option_rx_throttle(struct usb_serial_port *port); | 52 | static int option_write_room(struct tty_struct *tty); |
51 | static void option_rx_unthrottle(struct usb_serial_port *port); | ||
52 | static int option_write_room(struct usb_serial_port *port); | ||
53 | 53 | ||
54 | static void option_instat_callback(struct urb *urb); | 54 | static void option_instat_callback(struct urb *urb); |
55 | 55 | ||
56 | static int option_write(struct usb_serial_port *port, | 56 | static int option_write(struct tty_struct *tty, struct usb_serial_port *port, |
57 | const unsigned char *buf, int count); | 57 | const unsigned char *buf, int count); |
58 | 58 | static int option_chars_in_buffer(struct tty_struct *tty); | |
59 | static int option_chars_in_buffer(struct usb_serial_port *port); | 59 | static void option_set_termios(struct tty_struct *tty, |
60 | static int option_ioctl(struct usb_serial_port *port, struct file *file, | 60 | struct usb_serial_port *port, struct ktermios *old); |
61 | unsigned int cmd, unsigned long arg); | 61 | static int option_tiocmget(struct tty_struct *tty, struct file *file); |
62 | static void option_set_termios(struct usb_serial_port *port, | 62 | static int option_tiocmset(struct tty_struct *tty, struct file *file, |
63 | struct ktermios *old); | ||
64 | static void option_break_ctl(struct usb_serial_port *port, int break_state); | ||
65 | static int option_tiocmget(struct usb_serial_port *port, struct file *file); | ||
66 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, | ||
67 | unsigned int set, unsigned int clear); | 63 | unsigned int set, unsigned int clear); |
68 | static int option_send_setup(struct usb_serial_port *port); | 64 | static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *port); |
69 | 65 | ||
70 | /* Vendor and product IDs */ | 66 | /* Vendor and product IDs */ |
71 | #define OPTION_VENDOR_ID 0x0AF0 | 67 | #define OPTION_VENDOR_ID 0x0AF0 |
@@ -173,6 +169,7 @@ static int option_send_setup(struct usb_serial_port *port); | |||
173 | #define DELL_VENDOR_ID 0x413C | 169 | #define DELL_VENDOR_ID 0x413C |
174 | 170 | ||
175 | #define KYOCERA_VENDOR_ID 0x0c88 | 171 | #define KYOCERA_VENDOR_ID 0x0c88 |
172 | #define KYOCERA_PRODUCT_KPC650 0x17da | ||
176 | #define KYOCERA_PRODUCT_KPC680 0x180a | 173 | #define KYOCERA_PRODUCT_KPC680 0x180a |
177 | 174 | ||
178 | #define ANYDATA_VENDOR_ID 0x16d5 | 175 | #define ANYDATA_VENDOR_ID 0x16d5 |
@@ -305,6 +302,7 @@ static struct usb_device_id option_ids[] = { | |||
305 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 302 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |
306 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, | 303 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, |
307 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, | 304 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, |
305 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, | ||
308 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 306 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
309 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ | 307 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ |
310 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 308 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
@@ -340,11 +338,7 @@ static struct usb_serial_driver option_1port_device = { | |||
340 | .write = option_write, | 338 | .write = option_write, |
341 | .write_room = option_write_room, | 339 | .write_room = option_write_room, |
342 | .chars_in_buffer = option_chars_in_buffer, | 340 | .chars_in_buffer = option_chars_in_buffer, |
343 | .throttle = option_rx_throttle, | ||
344 | .unthrottle = option_rx_unthrottle, | ||
345 | .ioctl = option_ioctl, | ||
346 | .set_termios = option_set_termios, | 341 | .set_termios = option_set_termios, |
347 | .break_ctl = option_break_ctl, | ||
348 | .tiocmget = option_tiocmget, | 342 | .tiocmget = option_tiocmget, |
349 | .tiocmset = option_tiocmset, | 343 | .tiocmset = option_tiocmset, |
350 | .attach = option_startup, | 344 | .attach = option_startup, |
@@ -401,47 +395,32 @@ static int __init option_init(void) | |||
401 | return 0; | 395 | return 0; |
402 | 396 | ||
403 | failed_driver_register: | 397 | failed_driver_register: |
404 | usb_serial_deregister (&option_1port_device); | 398 | usb_serial_deregister(&option_1port_device); |
405 | failed_1port_device_register: | 399 | failed_1port_device_register: |
406 | return retval; | 400 | return retval; |
407 | } | 401 | } |
408 | 402 | ||
409 | static void __exit option_exit(void) | 403 | static void __exit option_exit(void) |
410 | { | 404 | { |
411 | usb_deregister (&option_driver); | 405 | usb_deregister(&option_driver); |
412 | usb_serial_deregister (&option_1port_device); | 406 | usb_serial_deregister(&option_1port_device); |
413 | } | 407 | } |
414 | 408 | ||
415 | module_init(option_init); | 409 | module_init(option_init); |
416 | module_exit(option_exit); | 410 | module_exit(option_exit); |
417 | 411 | ||
418 | static void option_rx_throttle(struct usb_serial_port *port) | 412 | static void option_set_termios(struct tty_struct *tty, |
419 | { | 413 | struct usb_serial_port *port, struct ktermios *old_termios) |
420 | dbg("%s", __func__); | ||
421 | } | ||
422 | |||
423 | static void option_rx_unthrottle(struct usb_serial_port *port) | ||
424 | { | ||
425 | dbg("%s", __func__); | ||
426 | } | ||
427 | |||
428 | static void option_break_ctl(struct usb_serial_port *port, int break_state) | ||
429 | { | ||
430 | /* Unfortunately, I don't know how to send a break */ | ||
431 | dbg("%s", __func__); | ||
432 | } | ||
433 | |||
434 | static void option_set_termios(struct usb_serial_port *port, | ||
435 | struct ktermios *old_termios) | ||
436 | { | 414 | { |
437 | dbg("%s", __func__); | 415 | dbg("%s", __func__); |
438 | /* Doesn't support option setting */ | 416 | /* Doesn't support option setting */ |
439 | tty_termios_copy_hw(port->tty->termios, old_termios); | 417 | tty_termios_copy_hw(tty->termios, old_termios); |
440 | option_send_setup(port); | 418 | option_send_setup(tty, port); |
441 | } | 419 | } |
442 | 420 | ||
443 | static int option_tiocmget(struct usb_serial_port *port, struct file *file) | 421 | static int option_tiocmget(struct tty_struct *tty, struct file *file) |
444 | { | 422 | { |
423 | struct usb_serial_port *port = tty->driver_data; | ||
445 | unsigned int value; | 424 | unsigned int value; |
446 | struct option_port_private *portdata; | 425 | struct option_port_private *portdata; |
447 | 426 | ||
@@ -457,9 +436,10 @@ static int option_tiocmget(struct usb_serial_port *port, struct file *file) | |||
457 | return value; | 436 | return value; |
458 | } | 437 | } |
459 | 438 | ||
460 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, | 439 | static int option_tiocmset(struct tty_struct *tty, struct file *file, |
461 | unsigned int set, unsigned int clear) | 440 | unsigned int set, unsigned int clear) |
462 | { | 441 | { |
442 | struct usb_serial_port *port = tty->driver_data; | ||
463 | struct option_port_private *portdata; | 443 | struct option_port_private *portdata; |
464 | 444 | ||
465 | portdata = usb_get_serial_port_data(port); | 445 | portdata = usb_get_serial_port_data(port); |
@@ -474,17 +454,11 @@ static int option_tiocmset(struct usb_serial_port *port, struct file *file, | |||
474 | portdata->rts_state = 0; | 454 | portdata->rts_state = 0; |
475 | if (clear & TIOCM_DTR) | 455 | if (clear & TIOCM_DTR) |
476 | portdata->dtr_state = 0; | 456 | portdata->dtr_state = 0; |
477 | return option_send_setup(port); | 457 | return option_send_setup(tty, port); |
478 | } | ||
479 | |||
480 | static int option_ioctl(struct usb_serial_port *port, struct file *file, | ||
481 | unsigned int cmd, unsigned long arg) | ||
482 | { | ||
483 | return -ENOIOCTLCMD; | ||
484 | } | 458 | } |
485 | 459 | ||
486 | /* Write */ | 460 | /* Write */ |
487 | static int option_write(struct usb_serial_port *port, | 461 | static int option_write(struct tty_struct *tty, struct usb_serial_port *port, |
488 | const unsigned char *buf, int count) | 462 | const unsigned char *buf, int count) |
489 | { | 463 | { |
490 | struct option_port_private *portdata; | 464 | struct option_port_private *portdata; |
@@ -499,7 +473,7 @@ static int option_write(struct usb_serial_port *port, | |||
499 | 473 | ||
500 | i = 0; | 474 | i = 0; |
501 | left = count; | 475 | left = count; |
502 | for (i=0; left > 0 && i < N_OUT_URB; i++) { | 476 | for (i = 0; left > 0 && i < N_OUT_URB; i++) { |
503 | todo = left; | 477 | todo = left; |
504 | if (todo > OUT_BUFLEN) | 478 | if (todo > OUT_BUFLEN) |
505 | todo = OUT_BUFLEN; | 479 | todo = OUT_BUFLEN; |
@@ -520,7 +494,7 @@ static int option_write(struct usb_serial_port *port, | |||
520 | usb_pipeendpoint(this_urb->pipe), i); | 494 | usb_pipeendpoint(this_urb->pipe), i); |
521 | 495 | ||
522 | /* send the data */ | 496 | /* send the data */ |
523 | memcpy (this_urb->transfer_buffer, buf, todo); | 497 | memcpy(this_urb->transfer_buffer, buf, todo); |
524 | this_urb->transfer_buffer_length = todo; | 498 | this_urb->transfer_buffer_length = todo; |
525 | 499 | ||
526 | this_urb->dev = port->serial->dev; | 500 | this_urb->dev = port->serial->dev; |
@@ -560,7 +534,7 @@ static void option_indat_callback(struct urb *urb) | |||
560 | dbg("%s: nonzero status: %d on endpoint %02x.", | 534 | dbg("%s: nonzero status: %d on endpoint %02x.", |
561 | __func__, status, endpoint); | 535 | __func__, status, endpoint); |
562 | } else { | 536 | } else { |
563 | tty = port->tty; | 537 | tty = port->port.tty; |
564 | if (urb->actual_length) { | 538 | if (urb->actual_length) { |
565 | tty_buffer_request_room(tty, urb->actual_length); | 539 | tty_buffer_request_room(tty, urb->actual_length); |
566 | tty_insert_flip_string(tty, data, urb->actual_length); | 540 | tty_insert_flip_string(tty, data, urb->actual_length); |
@@ -570,7 +544,7 @@ static void option_indat_callback(struct urb *urb) | |||
570 | } | 544 | } |
571 | 545 | ||
572 | /* Resubmit urb so we continue receiving */ | 546 | /* Resubmit urb so we continue receiving */ |
573 | if (port->open_count && status != -ESHUTDOWN) { | 547 | if (port->port.count && status != -ESHUTDOWN) { |
574 | err = usb_submit_urb(urb, GFP_ATOMIC); | 548 | err = usb_submit_urb(urb, GFP_ATOMIC); |
575 | if (err) | 549 | if (err) |
576 | printk(KERN_ERR "%s: resubmit read urb failed. " | 550 | printk(KERN_ERR "%s: resubmit read urb failed. " |
@@ -611,7 +585,7 @@ static void option_instat_callback(struct urb *urb) | |||
611 | struct usb_serial *serial = port->serial; | 585 | struct usb_serial *serial = port->serial; |
612 | 586 | ||
613 | dbg("%s", __func__); | 587 | dbg("%s", __func__); |
614 | dbg("%s: urb %p port %p has data %p", __func__,urb,port,portdata); | 588 | dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); |
615 | 589 | ||
616 | if (status == 0) { | 590 | if (status == 0) { |
617 | struct usb_ctrlrequest *req_pkt = | 591 | struct usb_ctrlrequest *req_pkt = |
@@ -636,12 +610,12 @@ static void option_instat_callback(struct urb *urb) | |||
636 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); | 610 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); |
637 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); | 611 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); |
638 | 612 | ||
639 | if (port->tty && !C_CLOCAL(port->tty) && | 613 | if (port->port.tty && !C_CLOCAL(port->port.tty) && |
640 | old_dcd_state && !portdata->dcd_state) | 614 | old_dcd_state && !portdata->dcd_state) |
641 | tty_hangup(port->tty); | 615 | tty_hangup(port->port.tty); |
642 | } else { | 616 | } else { |
643 | dbg("%s: type %x req %x", __func__, | 617 | dbg("%s: type %x req %x", __func__, |
644 | req_pkt->bRequestType,req_pkt->bRequest); | 618 | req_pkt->bRequestType, req_pkt->bRequest); |
645 | } | 619 | } |
646 | } else | 620 | } else |
647 | dbg("%s: error %d", __func__, status); | 621 | dbg("%s: error %d", __func__, status); |
@@ -656,8 +630,9 @@ static void option_instat_callback(struct urb *urb) | |||
656 | } | 630 | } |
657 | } | 631 | } |
658 | 632 | ||
659 | static int option_write_room(struct usb_serial_port *port) | 633 | static int option_write_room(struct tty_struct *tty) |
660 | { | 634 | { |
635 | struct usb_serial_port *port = tty->driver_data; | ||
661 | struct option_port_private *portdata; | 636 | struct option_port_private *portdata; |
662 | int i; | 637 | int i; |
663 | int data_len = 0; | 638 | int data_len = 0; |
@@ -666,7 +641,7 @@ static int option_write_room(struct usb_serial_port *port) | |||
666 | portdata = usb_get_serial_port_data(port); | 641 | portdata = usb_get_serial_port_data(port); |
667 | 642 | ||
668 | 643 | ||
669 | for (i=0; i < N_OUT_URB; i++) { | 644 | for (i = 0; i < N_OUT_URB; i++) { |
670 | this_urb = portdata->out_urbs[i]; | 645 | this_urb = portdata->out_urbs[i]; |
671 | if (this_urb && !test_bit(i, &portdata->out_busy)) | 646 | if (this_urb && !test_bit(i, &portdata->out_busy)) |
672 | data_len += OUT_BUFLEN; | 647 | data_len += OUT_BUFLEN; |
@@ -676,8 +651,9 @@ static int option_write_room(struct usb_serial_port *port) | |||
676 | return data_len; | 651 | return data_len; |
677 | } | 652 | } |
678 | 653 | ||
679 | static int option_chars_in_buffer(struct usb_serial_port *port) | 654 | static int option_chars_in_buffer(struct tty_struct *tty) |
680 | { | 655 | { |
656 | struct usb_serial_port *port = tty->driver_data; | ||
681 | struct option_port_private *portdata; | 657 | struct option_port_private *portdata; |
682 | int i; | 658 | int i; |
683 | int data_len = 0; | 659 | int data_len = 0; |
@@ -685,7 +661,7 @@ static int option_chars_in_buffer(struct usb_serial_port *port) | |||
685 | 661 | ||
686 | portdata = usb_get_serial_port_data(port); | 662 | portdata = usb_get_serial_port_data(port); |
687 | 663 | ||
688 | for (i=0; i < N_OUT_URB; i++) { | 664 | for (i = 0; i < N_OUT_URB; i++) { |
689 | this_urb = portdata->out_urbs[i]; | 665 | this_urb = portdata->out_urbs[i]; |
690 | /* FIXME: This locking is insufficient as this_urb may | 666 | /* FIXME: This locking is insufficient as this_urb may |
691 | go unused during the test */ | 667 | go unused during the test */ |
@@ -696,7 +672,8 @@ static int option_chars_in_buffer(struct usb_serial_port *port) | |||
696 | return data_len; | 672 | return data_len; |
697 | } | 673 | } |
698 | 674 | ||
699 | static int option_open(struct usb_serial_port *port, struct file *filp) | 675 | static int option_open(struct tty_struct *tty, |
676 | struct usb_serial_port *port, struct file *filp) | ||
700 | { | 677 | { |
701 | struct option_port_private *portdata; | 678 | struct option_port_private *portdata; |
702 | struct usb_serial *serial = port->serial; | 679 | struct usb_serial *serial = port->serial; |
@@ -714,7 +691,7 @@ static int option_open(struct usb_serial_port *port, struct file *filp) | |||
714 | /* Reset low level data toggle and start reading from endpoints */ | 691 | /* Reset low level data toggle and start reading from endpoints */ |
715 | for (i = 0; i < N_IN_URB; i++) { | 692 | for (i = 0; i < N_IN_URB; i++) { |
716 | urb = portdata->in_urbs[i]; | 693 | urb = portdata->in_urbs[i]; |
717 | if (! urb) | 694 | if (!urb) |
718 | continue; | 695 | continue; |
719 | if (urb->dev != serial->dev) { | 696 | if (urb->dev != serial->dev) { |
720 | dbg("%s: dev %p != %p", __func__, | 697 | dbg("%s: dev %p != %p", __func__, |
@@ -739,21 +716,23 @@ static int option_open(struct usb_serial_port *port, struct file *filp) | |||
739 | /* Reset low level data toggle on out endpoints */ | 716 | /* Reset low level data toggle on out endpoints */ |
740 | for (i = 0; i < N_OUT_URB; i++) { | 717 | for (i = 0; i < N_OUT_URB; i++) { |
741 | urb = portdata->out_urbs[i]; | 718 | urb = portdata->out_urbs[i]; |
742 | if (! urb) | 719 | if (!urb) |
743 | continue; | 720 | continue; |
744 | urb->dev = serial->dev; | 721 | urb->dev = serial->dev; |
745 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), | 722 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), |
746 | usb_pipeout(urb->pipe), 0); */ | 723 | usb_pipeout(urb->pipe), 0); */ |
747 | } | 724 | } |
748 | 725 | ||
749 | port->tty->low_latency = 1; | 726 | if (tty) |
727 | tty->low_latency = 1; | ||
750 | 728 | ||
751 | option_send_setup(port); | 729 | option_send_setup(tty, port); |
752 | 730 | ||
753 | return (0); | 731 | return 0; |
754 | } | 732 | } |
755 | 733 | ||
756 | static void option_close(struct usb_serial_port *port, struct file *filp) | 734 | static void option_close(struct tty_struct *tty, |
735 | struct usb_serial_port *port, struct file *filp) | ||
757 | { | 736 | { |
758 | int i; | 737 | int i; |
759 | struct usb_serial *serial = port->serial; | 738 | struct usb_serial *serial = port->serial; |
@@ -768,7 +747,7 @@ static void option_close(struct usb_serial_port *port, struct file *filp) | |||
768 | if (serial->dev) { | 747 | if (serial->dev) { |
769 | mutex_lock(&serial->disc_mutex); | 748 | mutex_lock(&serial->disc_mutex); |
770 | if (!serial->disconnected) | 749 | if (!serial->disconnected) |
771 | option_send_setup(port); | 750 | option_send_setup(tty, port); |
772 | mutex_unlock(&serial->disc_mutex); | 751 | mutex_unlock(&serial->disc_mutex); |
773 | 752 | ||
774 | /* Stop reading/writing urbs */ | 753 | /* Stop reading/writing urbs */ |
@@ -777,7 +756,7 @@ static void option_close(struct usb_serial_port *port, struct file *filp) | |||
777 | for (i = 0; i < N_OUT_URB; i++) | 756 | for (i = 0; i < N_OUT_URB; i++) |
778 | usb_kill_urb(portdata->out_urbs[i]); | 757 | usb_kill_urb(portdata->out_urbs[i]); |
779 | } | 758 | } |
780 | port->tty = NULL; | 759 | port->port.tty = NULL; /* FIXME */ |
781 | } | 760 | } |
782 | 761 | ||
783 | /* Helper functions used by option_setup_urbs */ | 762 | /* Helper functions used by option_setup_urbs */ |
@@ -807,7 +786,7 @@ static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint, | |||
807 | /* Setup urbs */ | 786 | /* Setup urbs */ |
808 | static void option_setup_urbs(struct usb_serial *serial) | 787 | static void option_setup_urbs(struct usb_serial *serial) |
809 | { | 788 | { |
810 | int i,j; | 789 | int i, j; |
811 | struct usb_serial_port *port; | 790 | struct usb_serial_port *port; |
812 | struct option_port_private *portdata; | 791 | struct option_port_private *portdata; |
813 | 792 | ||
@@ -817,18 +796,22 @@ static void option_setup_urbs(struct usb_serial *serial) | |||
817 | port = serial->port[i]; | 796 | port = serial->port[i]; |
818 | portdata = usb_get_serial_port_data(port); | 797 | portdata = usb_get_serial_port_data(port); |
819 | 798 | ||
820 | /* Do indat endpoints first */ | 799 | /* Do indat endpoints first */ |
821 | for (j = 0; j < N_IN_URB; ++j) { | 800 | for (j = 0; j < N_IN_URB; ++j) { |
822 | portdata->in_urbs[j] = option_setup_urb (serial, | 801 | portdata->in_urbs[j] = option_setup_urb(serial, |
823 | port->bulk_in_endpointAddress, USB_DIR_IN, port, | 802 | port->bulk_in_endpointAddress, |
824 | portdata->in_buffer[j], IN_BUFLEN, option_indat_callback); | 803 | USB_DIR_IN, port, |
804 | portdata->in_buffer[j], | ||
805 | IN_BUFLEN, option_indat_callback); | ||
825 | } | 806 | } |
826 | 807 | ||
827 | /* outdat endpoints */ | 808 | /* outdat endpoints */ |
828 | for (j = 0; j < N_OUT_URB; ++j) { | 809 | for (j = 0; j < N_OUT_URB; ++j) { |
829 | portdata->out_urbs[j] = option_setup_urb (serial, | 810 | portdata->out_urbs[j] = option_setup_urb(serial, |
830 | port->bulk_out_endpointAddress, USB_DIR_OUT, port, | 811 | port->bulk_out_endpointAddress, |
831 | portdata->out_buffer[j], OUT_BUFLEN, option_outdat_callback); | 812 | USB_DIR_OUT, port, |
813 | portdata->out_buffer[j], | ||
814 | OUT_BUFLEN, option_outdat_callback); | ||
832 | } | 815 | } |
833 | } | 816 | } |
834 | } | 817 | } |
@@ -839,7 +822,8 @@ static void option_setup_urbs(struct usb_serial *serial) | |||
839 | * This is exactly the same as SET_CONTROL_LINE_STATE from the PSTN | 822 | * This is exactly the same as SET_CONTROL_LINE_STATE from the PSTN |
840 | * CDC. | 823 | * CDC. |
841 | */ | 824 | */ |
842 | static int option_send_setup(struct usb_serial_port *port) | 825 | static int option_send_setup(struct tty_struct *tty, |
826 | struct usb_serial_port *port) | ||
843 | { | 827 | { |
844 | struct usb_serial *serial = port->serial; | 828 | struct usb_serial *serial = port->serial; |
845 | struct option_port_private *portdata; | 829 | struct option_port_private *portdata; |
@@ -848,7 +832,7 @@ static int option_send_setup(struct usb_serial_port *port) | |||
848 | 832 | ||
849 | portdata = usb_get_serial_port_data(port); | 833 | portdata = usb_get_serial_port_data(port); |
850 | 834 | ||
851 | if (port->tty) { | 835 | if (tty) { |
852 | int val = 0; | 836 | int val = 0; |
853 | if (portdata->dtr_state) | 837 | if (portdata->dtr_state) |
854 | val |= 0x01; | 838 | val |= 0x01; |
@@ -856,10 +840,9 @@ static int option_send_setup(struct usb_serial_port *port) | |||
856 | val |= 0x02; | 840 | val |= 0x02; |
857 | 841 | ||
858 | return usb_control_msg(serial->dev, | 842 | return usb_control_msg(serial->dev, |
859 | usb_rcvctrlpipe(serial->dev, 0), | 843 | usb_rcvctrlpipe(serial->dev, 0), |
860 | 0x22,0x21,val,ifNum,NULL,0,USB_CTRL_SET_TIMEOUT); | 844 | 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT); |
861 | } | 845 | } |
862 | |||
863 | return 0; | 846 | return 0; |
864 | } | 847 | } |
865 | 848 | ||
@@ -879,7 +862,7 @@ static int option_startup(struct usb_serial *serial) | |||
879 | if (!portdata) { | 862 | if (!portdata) { |
880 | dbg("%s: kmalloc for option_port_private (%d) failed!.", | 863 | dbg("%s: kmalloc for option_port_private (%d) failed!.", |
881 | __func__, i); | 864 | __func__, i); |
882 | return (1); | 865 | return 1; |
883 | } | 866 | } |
884 | 867 | ||
885 | for (j = 0; j < N_IN_URB; j++) { | 868 | for (j = 0; j < N_IN_URB; j++) { |
@@ -898,17 +881,15 @@ static int option_startup(struct usb_serial *serial) | |||
898 | 881 | ||
899 | usb_set_serial_port_data(port, portdata); | 882 | usb_set_serial_port_data(port, portdata); |
900 | 883 | ||
901 | if (! port->interrupt_in_urb) | 884 | if (!port->interrupt_in_urb) |
902 | continue; | 885 | continue; |
903 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 886 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
904 | if (err) | 887 | if (err) |
905 | dbg("%s: submit irq_in urb failed %d", | 888 | dbg("%s: submit irq_in urb failed %d", |
906 | __func__, err); | 889 | __func__, err); |
907 | } | 890 | } |
908 | |||
909 | option_setup_urbs(serial); | 891 | option_setup_urbs(serial); |
910 | 892 | return 0; | |
911 | return (0); | ||
912 | 893 | ||
913 | bail_out_error2: | 894 | bail_out_error2: |
914 | for (j = 0; j < N_OUT_URB; j++) | 895 | for (j = 0; j < N_OUT_URB; j++) |
@@ -947,7 +928,8 @@ static void option_shutdown(struct usb_serial *serial) | |||
947 | for (j = 0; j < N_IN_URB; j++) { | 928 | for (j = 0; j < N_IN_URB; j++) { |
948 | if (portdata->in_urbs[j]) { | 929 | if (portdata->in_urbs[j]) { |
949 | usb_free_urb(portdata->in_urbs[j]); | 930 | usb_free_urb(portdata->in_urbs[j]); |
950 | free_page((unsigned long)portdata->in_buffer[j]); | 931 | free_page((unsigned long) |
932 | portdata->in_buffer[j]); | ||
951 | portdata->in_urbs[j] = NULL; | 933 | portdata->in_urbs[j] = NULL; |
952 | } | 934 | } |
953 | } | 935 | } |