diff options
author | Richard Knutsson <ricknu-0@student.ltu.se> | 2007-03-16 20:35:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 16:28:36 -0400 |
commit | cb8eaa8b2b913387a9a1d3d8fe48edfc1595ba3e (patch) | |
tree | baa6602bf49ca74fd8fde18343e0607cfc7c12c7 | |
parent | 0de9a7024e7ae62512d080c7e2beb59d82958cd5 (diff) |
USB: io_edgeport: Convert to generic boolean
Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 126 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.h | 6 |
2 files changed, 63 insertions, 69 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 187fd4280c88..18f74ac76565 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -111,7 +111,7 @@ struct edgeport_port { | |||
111 | 111 | ||
112 | struct TxFifo txfifo; /* transmit fifo -- size will be maxTxCredits */ | 112 | struct TxFifo txfifo; /* transmit fifo -- size will be maxTxCredits */ |
113 | struct urb *write_urb; /* write URB for this port */ | 113 | struct urb *write_urb; /* write URB for this port */ |
114 | char write_in_progress; /* TRUE while a write URB is outstanding */ | 114 | bool write_in_progress; /* 'true' while a write URB is outstanding */ |
115 | spinlock_t ep_lock; | 115 | spinlock_t ep_lock; |
116 | 116 | ||
117 | __u8 shadowLCR; /* last LCR value received */ | 117 | __u8 shadowLCR; /* last LCR value received */ |
@@ -123,11 +123,11 @@ struct edgeport_port { | |||
123 | __u8 validDataMask; | 123 | __u8 validDataMask; |
124 | __u32 baudRate; | 124 | __u32 baudRate; |
125 | 125 | ||
126 | char open; | 126 | bool open; |
127 | char openPending; | 127 | bool openPending; |
128 | char commandPending; | 128 | bool commandPending; |
129 | char closePending; | 129 | bool closePending; |
130 | char chaseResponsePending; | 130 | bool chaseResponsePending; |
131 | 131 | ||
132 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 132 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
133 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ | 133 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ |
@@ -156,7 +156,7 @@ struct edgeport_serial { | |||
156 | __u8 bulk_in_endpoint; /* the bulk in endpoint handle */ | 156 | __u8 bulk_in_endpoint; /* the bulk in endpoint handle */ |
157 | unsigned char * bulk_in_buffer; /* the buffer we use for the bulk in endpoint */ | 157 | unsigned char * bulk_in_buffer; /* the buffer we use for the bulk in endpoint */ |
158 | struct urb * read_urb; /* our bulk read urb */ | 158 | struct urb * read_urb; /* our bulk read urb */ |
159 | int read_in_progress; | 159 | bool read_in_progress; |
160 | spinlock_t es_lock; | 160 | spinlock_t es_lock; |
161 | 161 | ||
162 | __u8 bulk_out_endpoint; /* the bulk out endpoint handle */ | 162 | __u8 bulk_out_endpoint; /* the bulk out endpoint handle */ |
@@ -631,14 +631,14 @@ static void edge_interrupt_callback (struct urb *urb) | |||
631 | if (edge_serial->rxBytesAvail > 0 && | 631 | if (edge_serial->rxBytesAvail > 0 && |
632 | !edge_serial->read_in_progress) { | 632 | !edge_serial->read_in_progress) { |
633 | dbg("%s - posting a read", __FUNCTION__); | 633 | dbg("%s - posting a read", __FUNCTION__); |
634 | edge_serial->read_in_progress = TRUE; | 634 | edge_serial->read_in_progress = true; |
635 | 635 | ||
636 | /* we have pending bytes on the bulk in pipe, send a request */ | 636 | /* we have pending bytes on the bulk in pipe, send a request */ |
637 | edge_serial->read_urb->dev = edge_serial->serial->dev; | 637 | edge_serial->read_urb->dev = edge_serial->serial->dev; |
638 | result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); | 638 | result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); |
639 | if (result) { | 639 | if (result) { |
640 | dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __FUNCTION__, result); | 640 | dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __FUNCTION__, result); |
641 | edge_serial->read_in_progress = FALSE; | 641 | edge_serial->read_in_progress = false; |
642 | } | 642 | } |
643 | } | 643 | } |
644 | spin_unlock(&edge_serial->es_lock); | 644 | spin_unlock(&edge_serial->es_lock); |
@@ -695,13 +695,13 @@ static void edge_bulk_in_callback (struct urb *urb) | |||
695 | 695 | ||
696 | if (urb->status) { | 696 | if (urb->status) { |
697 | dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status); | 697 | dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status); |
698 | edge_serial->read_in_progress = FALSE; | 698 | edge_serial->read_in_progress = false; |
699 | return; | 699 | return; |
700 | } | 700 | } |
701 | 701 | ||
702 | if (urb->actual_length == 0) { | 702 | if (urb->actual_length == 0) { |
703 | dbg("%s - read bulk callback with no data", __FUNCTION__); | 703 | dbg("%s - read bulk callback with no data", __FUNCTION__); |
704 | edge_serial->read_in_progress = FALSE; | 704 | edge_serial->read_in_progress = false; |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | 707 | ||
@@ -725,10 +725,10 @@ static void edge_bulk_in_callback (struct urb *urb) | |||
725 | status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); | 725 | status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); |
726 | if (status) { | 726 | if (status) { |
727 | dev_err(&urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, status = %d\n", __FUNCTION__, status); | 727 | dev_err(&urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, status = %d\n", __FUNCTION__, status); |
728 | edge_serial->read_in_progress = FALSE; | 728 | edge_serial->read_in_progress = false; |
729 | } | 729 | } |
730 | } else { | 730 | } else { |
731 | edge_serial->read_in_progress = FALSE; | 731 | edge_serial->read_in_progress = false; |
732 | } | 732 | } |
733 | 733 | ||
734 | spin_unlock(&edge_serial->es_lock); | 734 | spin_unlock(&edge_serial->es_lock); |
@@ -759,7 +759,7 @@ static void edge_bulk_out_data_callback (struct urb *urb) | |||
759 | } | 759 | } |
760 | 760 | ||
761 | // Release the Write URB | 761 | // Release the Write URB |
762 | edge_port->write_in_progress = FALSE; | 762 | edge_port->write_in_progress = false; |
763 | 763 | ||
764 | // Check if more data needs to be sent | 764 | // Check if more data needs to be sent |
765 | send_more_port_data((struct edgeport_serial *)(usb_get_serial_data(edge_port->port->serial)), edge_port); | 765 | send_more_port_data((struct edgeport_serial *)(usb_get_serial_data(edge_port->port->serial)), edge_port); |
@@ -802,7 +802,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb) | |||
802 | tty_wakeup(tty); | 802 | tty_wakeup(tty); |
803 | 803 | ||
804 | /* we have completed the command */ | 804 | /* we have completed the command */ |
805 | edge_port->commandPending = FALSE; | 805 | edge_port->commandPending = false; |
806 | wake_up(&edge_port->wait_command); | 806 | wake_up(&edge_port->wait_command); |
807 | } | 807 | } |
808 | 808 | ||
@@ -868,7 +868,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) | |||
868 | port0->bulk_in_buffer, | 868 | port0->bulk_in_buffer, |
869 | edge_serial->read_urb->transfer_buffer_length, | 869 | edge_serial->read_urb->transfer_buffer_length, |
870 | edge_bulk_in_callback, edge_serial); | 870 | edge_bulk_in_callback, edge_serial); |
871 | edge_serial->read_in_progress = FALSE; | 871 | edge_serial->read_in_progress = false; |
872 | 872 | ||
873 | /* start interrupt read for this edgeport | 873 | /* start interrupt read for this edgeport |
874 | * this interrupt will continue as long as the edgeport is connected */ | 874 | * this interrupt will continue as long as the edgeport is connected */ |
@@ -890,26 +890,26 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) | |||
890 | /* initialize our port settings */ | 890 | /* initialize our port settings */ |
891 | edge_port->txCredits = 0; /* Can't send any data yet */ | 891 | edge_port->txCredits = 0; /* Can't send any data yet */ |
892 | edge_port->shadowMCR = MCR_MASTER_IE; /* Must always set this bit to enable ints! */ | 892 | edge_port->shadowMCR = MCR_MASTER_IE; /* Must always set this bit to enable ints! */ |
893 | edge_port->chaseResponsePending = FALSE; | 893 | edge_port->chaseResponsePending = false; |
894 | 894 | ||
895 | /* send a open port command */ | 895 | /* send a open port command */ |
896 | edge_port->openPending = TRUE; | 896 | edge_port->openPending = true; |
897 | edge_port->open = FALSE; | 897 | edge_port->open = false; |
898 | response = send_iosp_ext_cmd (edge_port, IOSP_CMD_OPEN_PORT, 0); | 898 | response = send_iosp_ext_cmd (edge_port, IOSP_CMD_OPEN_PORT, 0); |
899 | 899 | ||
900 | if (response < 0) { | 900 | if (response < 0) { |
901 | dev_err(&port->dev, "%s - error sending open port command\n", __FUNCTION__); | 901 | dev_err(&port->dev, "%s - error sending open port command\n", __FUNCTION__); |
902 | edge_port->openPending = FALSE; | 902 | edge_port->openPending = false; |
903 | return -ENODEV; | 903 | return -ENODEV; |
904 | } | 904 | } |
905 | 905 | ||
906 | /* now wait for the port to be completely opened */ | 906 | /* now wait for the port to be completely opened */ |
907 | wait_event_timeout(edge_port->wait_open, (edge_port->openPending != TRUE), OPEN_TIMEOUT); | 907 | wait_event_timeout(edge_port->wait_open, !edge_port->openPending, OPEN_TIMEOUT); |
908 | 908 | ||
909 | if (edge_port->open == FALSE) { | 909 | if (!edge_port->open) { |
910 | /* open timed out */ | 910 | /* open timed out */ |
911 | dbg("%s - open timedout", __FUNCTION__); | 911 | dbg("%s - open timedout", __FUNCTION__); |
912 | edge_port->openPending = FALSE; | 912 | edge_port->openPending = false; |
913 | return -ENODEV; | 913 | return -ENODEV; |
914 | } | 914 | } |
915 | 915 | ||
@@ -928,7 +928,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) | |||
928 | 928 | ||
929 | /* Allocate a URB for the write */ | 929 | /* Allocate a URB for the write */ |
930 | edge_port->write_urb = usb_alloc_urb (0, GFP_KERNEL); | 930 | edge_port->write_urb = usb_alloc_urb (0, GFP_KERNEL); |
931 | edge_port->write_in_progress = FALSE; | 931 | edge_port->write_in_progress = false; |
932 | 932 | ||
933 | if (!edge_port->write_urb) { | 933 | if (!edge_port->write_urb) { |
934 | dbg("%s - no memory", __FUNCTION__); | 934 | dbg("%s - no memory", __FUNCTION__); |
@@ -966,7 +966,7 @@ static void block_until_chase_response(struct edgeport_port *edge_port) | |||
966 | lastCredits = edge_port->txCredits; | 966 | lastCredits = edge_port->txCredits; |
967 | 967 | ||
968 | // Did we get our Chase response | 968 | // Did we get our Chase response |
969 | if (edge_port->chaseResponsePending == FALSE) { | 969 | if (!edge_port->chaseResponsePending) { |
970 | dbg("%s - Got Chase Response", __FUNCTION__); | 970 | dbg("%s - Got Chase Response", __FUNCTION__); |
971 | 971 | ||
972 | // did we get all of our credit back? | 972 | // did we get all of our credit back? |
@@ -985,7 +985,7 @@ static void block_until_chase_response(struct edgeport_port *edge_port) | |||
985 | // No activity.. count down. | 985 | // No activity.. count down. |
986 | loop--; | 986 | loop--; |
987 | if (loop == 0) { | 987 | if (loop == 0) { |
988 | edge_port->chaseResponsePending = FALSE; | 988 | edge_port->chaseResponsePending = false; |
989 | dbg("%s - Chase TIMEOUT", __FUNCTION__); | 989 | dbg("%s - Chase TIMEOUT", __FUNCTION__); |
990 | return; | 990 | return; |
991 | } | 991 | } |
@@ -1068,13 +1068,13 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) | |||
1068 | // block until tx is empty | 1068 | // block until tx is empty |
1069 | block_until_tx_empty(edge_port); | 1069 | block_until_tx_empty(edge_port); |
1070 | 1070 | ||
1071 | edge_port->closePending = TRUE; | 1071 | edge_port->closePending = true; |
1072 | 1072 | ||
1073 | if ((!edge_serial->is_epic) || | 1073 | if ((!edge_serial->is_epic) || |
1074 | ((edge_serial->is_epic) && | 1074 | ((edge_serial->is_epic) && |
1075 | (edge_serial->epic_descriptor.Supports.IOSPChase))) { | 1075 | (edge_serial->epic_descriptor.Supports.IOSPChase))) { |
1076 | /* flush and chase */ | 1076 | /* flush and chase */ |
1077 | edge_port->chaseResponsePending = TRUE; | 1077 | edge_port->chaseResponsePending = true; |
1078 | 1078 | ||
1079 | dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); | 1079 | dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); |
1080 | status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); | 1080 | status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); |
@@ -1082,7 +1082,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) | |||
1082 | // block until chase finished | 1082 | // block until chase finished |
1083 | block_until_chase_response(edge_port); | 1083 | block_until_chase_response(edge_port); |
1084 | } else { | 1084 | } else { |
1085 | edge_port->chaseResponsePending = FALSE; | 1085 | edge_port->chaseResponsePending = false; |
1086 | } | 1086 | } |
1087 | } | 1087 | } |
1088 | 1088 | ||
@@ -1094,10 +1094,10 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) | |||
1094 | send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0); | 1094 | send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0); |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | //port->close = TRUE; | 1097 | //port->close = true; |
1098 | edge_port->closePending = FALSE; | 1098 | edge_port->closePending = false; |
1099 | edge_port->open = FALSE; | 1099 | edge_port->open = false; |
1100 | edge_port->openPending = FALSE; | 1100 | edge_port->openPending = false; |
1101 | 1101 | ||
1102 | usb_kill_urb(edge_port->write_urb); | 1102 | usb_kill_urb(edge_port->write_urb); |
1103 | 1103 | ||
@@ -1247,7 +1247,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge | |||
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | // lock this write | 1249 | // lock this write |
1250 | edge_port->write_in_progress = TRUE; | 1250 | edge_port->write_in_progress = true; |
1251 | 1251 | ||
1252 | // get a pointer to the write_urb | 1252 | // get a pointer to the write_urb |
1253 | urb = edge_port->write_urb; | 1253 | urb = edge_port->write_urb; |
@@ -1261,7 +1261,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge | |||
1261 | buffer = kmalloc (count+2, GFP_ATOMIC); | 1261 | buffer = kmalloc (count+2, GFP_ATOMIC); |
1262 | if (buffer == NULL) { | 1262 | if (buffer == NULL) { |
1263 | dev_err(&edge_port->port->dev, "%s - no more kernel memory...\n", __FUNCTION__); | 1263 | dev_err(&edge_port->port->dev, "%s - no more kernel memory...\n", __FUNCTION__); |
1264 | edge_port->write_in_progress = FALSE; | 1264 | edge_port->write_in_progress = false; |
1265 | goto exit_send; | 1265 | goto exit_send; |
1266 | } | 1266 | } |
1267 | buffer[0] = IOSP_BUILD_DATA_HDR1 (edge_port->port->number - edge_port->port->serial->minor, count); | 1267 | buffer[0] = IOSP_BUILD_DATA_HDR1 (edge_port->port->number - edge_port->port->serial->minor, count); |
@@ -1301,7 +1301,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge | |||
1301 | if (status) { | 1301 | if (status) { |
1302 | /* something went wrong */ | 1302 | /* something went wrong */ |
1303 | dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", __FUNCTION__, status); | 1303 | dev_err(&edge_port->port->dev, "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", __FUNCTION__, status); |
1304 | edge_port->write_in_progress = FALSE; | 1304 | edge_port->write_in_progress = false; |
1305 | 1305 | ||
1306 | /* revert the credits as something bad happened. */ | 1306 | /* revert the credits as something bad happened. */ |
1307 | edge_port->txCredits += count; | 1307 | edge_port->txCredits += count; |
@@ -1332,7 +1332,7 @@ static int edge_write_room (struct usb_serial_port *port) | |||
1332 | 1332 | ||
1333 | if (edge_port == NULL) | 1333 | if (edge_port == NULL) |
1334 | return -ENODEV; | 1334 | return -ENODEV; |
1335 | if (edge_port->closePending == TRUE) | 1335 | if (edge_port->closePending) |
1336 | return -ENODEV; | 1336 | return -ENODEV; |
1337 | 1337 | ||
1338 | dbg("%s - port %d", __FUNCTION__, port->number); | 1338 | dbg("%s - port %d", __FUNCTION__, port->number); |
@@ -1371,7 +1371,7 @@ static int edge_chars_in_buffer (struct usb_serial_port *port) | |||
1371 | 1371 | ||
1372 | if (edge_port == NULL) | 1372 | if (edge_port == NULL) |
1373 | return -ENODEV; | 1373 | return -ENODEV; |
1374 | if (edge_port->closePending == TRUE) | 1374 | if (edge_port->closePending) |
1375 | return -ENODEV; | 1375 | return -ENODEV; |
1376 | 1376 | ||
1377 | if (!edge_port->open) { | 1377 | if (!edge_port->open) { |
@@ -1762,7 +1762,7 @@ static void edge_break (struct usb_serial_port *port, int break_state) | |||
1762 | ((edge_serial->is_epic) && | 1762 | ((edge_serial->is_epic) && |
1763 | (edge_serial->epic_descriptor.Supports.IOSPChase))) { | 1763 | (edge_serial->epic_descriptor.Supports.IOSPChase))) { |
1764 | /* flush and chase */ | 1764 | /* flush and chase */ |
1765 | edge_port->chaseResponsePending = TRUE; | 1765 | edge_port->chaseResponsePending = true; |
1766 | 1766 | ||
1767 | dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); | 1767 | dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); |
1768 | status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); | 1768 | status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); |
@@ -1770,7 +1770,7 @@ static void edge_break (struct usb_serial_port *port, int break_state) | |||
1770 | // block until chase finished | 1770 | // block until chase finished |
1771 | block_until_chase_response(edge_port); | 1771 | block_until_chase_response(edge_port); |
1772 | } else { | 1772 | } else { |
1773 | edge_port->chaseResponsePending = FALSE; | 1773 | edge_port->chaseResponsePending = false; |
1774 | } | 1774 | } |
1775 | } | 1775 | } |
1776 | 1776 | ||
@@ -1952,13 +1952,13 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 | |||
1952 | // Also, we currently clear flag and close the port regardless of content of above's Byte3. | 1952 | // Also, we currently clear flag and close the port regardless of content of above's Byte3. |
1953 | // We could choose to do something else when Byte3 says Timeout on Chase from Edgeport, | 1953 | // We could choose to do something else when Byte3 says Timeout on Chase from Edgeport, |
1954 | // like wait longer in block_until_chase_response, but for now we don't. | 1954 | // like wait longer in block_until_chase_response, but for now we don't. |
1955 | edge_port->chaseResponsePending = FALSE; | 1955 | edge_port->chaseResponsePending = false; |
1956 | wake_up (&edge_port->wait_chase); | 1956 | wake_up (&edge_port->wait_chase); |
1957 | return; | 1957 | return; |
1958 | 1958 | ||
1959 | case IOSP_EXT_STATUS_RX_CHECK_RSP: | 1959 | case IOSP_EXT_STATUS_RX_CHECK_RSP: |
1960 | dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============\n", __FUNCTION__, edge_serial->rxPort, byte3 ); | 1960 | dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============\n", __FUNCTION__, edge_serial->rxPort, byte3 ); |
1961 | //Port->RxCheckRsp = TRUE; | 1961 | //Port->RxCheckRsp = true; |
1962 | return; | 1962 | return; |
1963 | } | 1963 | } |
1964 | } | 1964 | } |
@@ -1974,8 +1974,8 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 | |||
1974 | change_port_settings (edge_port, edge_port->port->tty->termios); | 1974 | change_port_settings (edge_port, edge_port->port->tty->termios); |
1975 | 1975 | ||
1976 | /* we have completed the open */ | 1976 | /* we have completed the open */ |
1977 | edge_port->openPending = FALSE; | 1977 | edge_port->openPending = false; |
1978 | edge_port->open = TRUE; | 1978 | edge_port->open = true; |
1979 | wake_up(&edge_port->wait_open); | 1979 | wake_up(&edge_port->wait_open); |
1980 | return; | 1980 | return; |
1981 | } | 1981 | } |
@@ -1983,7 +1983,7 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 | |||
1983 | // If port is closed, silently discard all rcvd status. We can | 1983 | // If port is closed, silently discard all rcvd status. We can |
1984 | // have cases where buffered status is received AFTER the close | 1984 | // have cases where buffered status is received AFTER the close |
1985 | // port command is sent to the Edgeport. | 1985 | // port command is sent to the Edgeport. |
1986 | if ((!edge_port->open ) || (edge_port->closePending)) { | 1986 | if (!edge_port->open || edge_port->closePending) { |
1987 | return; | 1987 | return; |
1988 | } | 1988 | } |
1989 | 1989 | ||
@@ -1991,14 +1991,14 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2 | |||
1991 | // Not currently sent by Edgeport | 1991 | // Not currently sent by Edgeport |
1992 | case IOSP_STATUS_LSR: | 1992 | case IOSP_STATUS_LSR: |
1993 | dbg("%s - Port %u LSR Status = %02x", __FUNCTION__, edge_serial->rxPort, byte2); | 1993 | dbg("%s - Port %u LSR Status = %02x", __FUNCTION__, edge_serial->rxPort, byte2); |
1994 | handle_new_lsr (edge_port, FALSE, byte2, 0); | 1994 | handle_new_lsr(edge_port, false, byte2, 0); |
1995 | break; | 1995 | break; |
1996 | 1996 | ||
1997 | case IOSP_STATUS_LSR_DATA: | 1997 | case IOSP_STATUS_LSR_DATA: |
1998 | dbg("%s - Port %u LSR Status = %02x, Data = %02x", __FUNCTION__, edge_serial->rxPort, byte2, byte3); | 1998 | dbg("%s - Port %u LSR Status = %02x, Data = %02x", __FUNCTION__, edge_serial->rxPort, byte2, byte3); |
1999 | // byte2 is LSR Register | 1999 | // byte2 is LSR Register |
2000 | // byte3 is broken data byte | 2000 | // byte3 is broken data byte |
2001 | handle_new_lsr (edge_port, TRUE, byte2, byte3); | 2001 | handle_new_lsr(edge_port, true, byte2, byte3); |
2002 | break; | 2002 | break; |
2003 | // | 2003 | // |
2004 | // case IOSP_EXT_4_STATUS: | 2004 | // case IOSP_EXT_4_STATUS: |
@@ -2324,7 +2324,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer | |||
2324 | usb_sndbulkpipe(edge_serial->serial->dev, edge_serial->bulk_out_endpoint), | 2324 | usb_sndbulkpipe(edge_serial->serial->dev, edge_serial->bulk_out_endpoint), |
2325 | buffer, length, edge_bulk_out_cmd_callback, edge_port); | 2325 | buffer, length, edge_bulk_out_cmd_callback, edge_port); |
2326 | 2326 | ||
2327 | edge_port->commandPending = TRUE; | 2327 | edge_port->commandPending = true; |
2328 | status = usb_submit_urb(urb, GFP_ATOMIC); | 2328 | status = usb_submit_urb(urb, GFP_ATOMIC); |
2329 | 2329 | ||
2330 | if (status) { | 2330 | if (status) { |
@@ -2339,9 +2339,9 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer | |||
2339 | // wait for command to finish | 2339 | // wait for command to finish |
2340 | timeout = COMMAND_TIMEOUT; | 2340 | timeout = COMMAND_TIMEOUT; |
2341 | #if 0 | 2341 | #if 0 |
2342 | wait_event (&edge_port->wait_command, (edge_port->commandPending == FALSE)); | 2342 | wait_event (&edge_port->wait_command, !edge_port->commandPending); |
2343 | 2343 | ||
2344 | if (edge_port->commandPending == TRUE) { | 2344 | if (edge_port->commandPending) { |
2345 | /* command timed out */ | 2345 | /* command timed out */ |
2346 | dbg("%s - command timed out", __FUNCTION__); | 2346 | dbg("%s - command timed out", __FUNCTION__); |
2347 | status = -EINVAL; | 2347 | status = -EINVAL; |
@@ -2524,8 +2524,8 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi | |||
2524 | 2524 | ||
2525 | dbg("%s - port %d", __FUNCTION__, edge_port->port->number); | 2525 | dbg("%s - port %d", __FUNCTION__, edge_port->port->number); |
2526 | 2526 | ||
2527 | if ((!edge_port->open) && | 2527 | if (!edge_port->open && |
2528 | (!edge_port->openPending)) { | 2528 | !edge_port->openPending) { |
2529 | dbg("%s - port not opened", __FUNCTION__); | 2529 | dbg("%s - port not opened", __FUNCTION__); |
2530 | return; | 2530 | return; |
2531 | } | 2531 | } |
@@ -2836,9 +2836,9 @@ static int edge_startup (struct usb_serial *serial) | |||
2836 | struct usb_device *dev; | 2836 | struct usb_device *dev; |
2837 | int i, j; | 2837 | int i, j; |
2838 | int response; | 2838 | int response; |
2839 | int interrupt_in_found; | 2839 | bool interrupt_in_found; |
2840 | int bulk_in_found; | 2840 | bool bulk_in_found; |
2841 | int bulk_out_found; | 2841 | bool bulk_out_found; |
2842 | static __u32 descriptor[3] = { EDGE_COMPATIBILITY_MASK0, | 2842 | static __u32 descriptor[3] = { EDGE_COMPATIBILITY_MASK0, |
2843 | EDGE_COMPATIBILITY_MASK1, | 2843 | EDGE_COMPATIBILITY_MASK1, |
2844 | EDGE_COMPATIBILITY_MASK2 }; | 2844 | EDGE_COMPATIBILITY_MASK2 }; |
@@ -2936,14 +2936,14 @@ static int edge_startup (struct usb_serial *serial) | |||
2936 | if (edge_serial->is_epic) { | 2936 | if (edge_serial->is_epic) { |
2937 | /* EPIC thing, set up our interrupt polling now and our read urb, so | 2937 | /* EPIC thing, set up our interrupt polling now and our read urb, so |
2938 | * that the device knows it really is connected. */ | 2938 | * that the device knows it really is connected. */ |
2939 | interrupt_in_found = bulk_in_found = bulk_out_found = FALSE; | 2939 | interrupt_in_found = bulk_in_found = bulk_out_found = false; |
2940 | for (i = 0; i < serial->interface->altsetting[0].desc.bNumEndpoints; ++i) { | 2940 | for (i = 0; i < serial->interface->altsetting[0].desc.bNumEndpoints; ++i) { |
2941 | struct usb_endpoint_descriptor *endpoint; | 2941 | struct usb_endpoint_descriptor *endpoint; |
2942 | int buffer_size; | 2942 | int buffer_size; |
2943 | 2943 | ||
2944 | endpoint = &serial->interface->altsetting[0].endpoint[i].desc; | 2944 | endpoint = &serial->interface->altsetting[0].endpoint[i].desc; |
2945 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); | 2945 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); |
2946 | if ((!interrupt_in_found) && | 2946 | if (!interrupt_in_found && |
2947 | (usb_endpoint_is_int_in(endpoint))) { | 2947 | (usb_endpoint_is_int_in(endpoint))) { |
2948 | /* we found a interrupt in endpoint */ | 2948 | /* we found a interrupt in endpoint */ |
2949 | dbg("found interrupt in"); | 2949 | dbg("found interrupt in"); |
@@ -2972,10 +2972,10 @@ static int edge_startup (struct usb_serial *serial) | |||
2972 | edge_serial, | 2972 | edge_serial, |
2973 | endpoint->bInterval); | 2973 | endpoint->bInterval); |
2974 | 2974 | ||
2975 | interrupt_in_found = TRUE; | 2975 | interrupt_in_found = true; |
2976 | } | 2976 | } |
2977 | 2977 | ||
2978 | if ((!bulk_in_found) && | 2978 | if (!bulk_in_found && |
2979 | (usb_endpoint_is_bulk_in(endpoint))) { | 2979 | (usb_endpoint_is_bulk_in(endpoint))) { |
2980 | /* we found a bulk in endpoint */ | 2980 | /* we found a bulk in endpoint */ |
2981 | dbg("found bulk in"); | 2981 | dbg("found bulk in"); |
@@ -3001,19 +3001,19 @@ static int edge_startup (struct usb_serial *serial) | |||
3001 | endpoint->wMaxPacketSize, | 3001 | endpoint->wMaxPacketSize, |
3002 | edge_bulk_in_callback, | 3002 | edge_bulk_in_callback, |
3003 | edge_serial); | 3003 | edge_serial); |
3004 | bulk_in_found = TRUE; | 3004 | bulk_in_found = true; |
3005 | } | 3005 | } |
3006 | 3006 | ||
3007 | if ((!bulk_out_found) && | 3007 | if (!bulk_out_found && |
3008 | (usb_endpoint_is_bulk_out(endpoint))) { | 3008 | (usb_endpoint_is_bulk_out(endpoint))) { |
3009 | /* we found a bulk out endpoint */ | 3009 | /* we found a bulk out endpoint */ |
3010 | dbg("found bulk out"); | 3010 | dbg("found bulk out"); |
3011 | edge_serial->bulk_out_endpoint = endpoint->bEndpointAddress; | 3011 | edge_serial->bulk_out_endpoint = endpoint->bEndpointAddress; |
3012 | bulk_out_found = TRUE; | 3012 | bulk_out_found = true; |
3013 | } | 3013 | } |
3014 | } | 3014 | } |
3015 | 3015 | ||
3016 | if ((!interrupt_in_found) || (!bulk_in_found) || (!bulk_out_found)) { | 3016 | if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) { |
3017 | err ("Error - the proper endpoints were not found!"); | 3017 | err ("Error - the proper endpoints were not found!"); |
3018 | return -ENODEV; | 3018 | return -ENODEV; |
3019 | } | 3019 | } |
diff --git a/drivers/usb/serial/io_edgeport.h b/drivers/usb/serial/io_edgeport.h index 29a913a6daca..cb201c1f67f9 100644 --- a/drivers/usb/serial/io_edgeport.h +++ b/drivers/usb/serial/io_edgeport.h | |||
@@ -19,12 +19,6 @@ | |||
19 | #define MAX_RS232_PORTS 8 /* Max # of RS-232 ports per device */ | 19 | #define MAX_RS232_PORTS 8 /* Max # of RS-232 ports per device */ |
20 | 20 | ||
21 | /* typedefs that the insideout headers need */ | 21 | /* typedefs that the insideout headers need */ |
22 | #ifndef TRUE | ||
23 | #define TRUE (1) | ||
24 | #endif | ||
25 | #ifndef FALSE | ||
26 | #define FALSE (0) | ||
27 | #endif | ||
28 | #ifndef LOW8 | 22 | #ifndef LOW8 |
29 | #define LOW8(a) ((unsigned char)(a & 0xff)) | 23 | #define LOW8(a) ((unsigned char)(a & 0xff)) |
30 | #endif | 24 | #endif |