diff options
Diffstat (limited to 'drivers/usb/serial/garmin_gps.c')
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 8ce5a56a48e3..06cfa43c6f02 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -275,7 +275,7 @@ static inline int isAbortTrfCmnd(const unsigned char *buf) | |||
275 | static void send_to_tty(struct usb_serial_port *port, | 275 | static void send_to_tty(struct usb_serial_port *port, |
276 | char *data, unsigned int actual_length) | 276 | char *data, unsigned int actual_length) |
277 | { | 277 | { |
278 | struct tty_struct *tty = port->tty; | 278 | struct tty_struct *tty = port->port.tty; |
279 | 279 | ||
280 | if (tty && actual_length) { | 280 | if (tty && actual_length) { |
281 | 281 | ||
@@ -970,7 +970,8 @@ static int garmin_init_session(struct usb_serial_port *port) | |||
970 | 970 | ||
971 | 971 | ||
972 | 972 | ||
973 | static int garmin_open (struct usb_serial_port *port, struct file *filp) | 973 | static int garmin_open (struct tty_struct *tty, |
974 | struct usb_serial_port *port, struct file *filp) | ||
974 | { | 975 | { |
975 | unsigned long flags; | 976 | unsigned long flags; |
976 | int status = 0; | 977 | int status = 0; |
@@ -983,8 +984,8 @@ static int garmin_open (struct usb_serial_port *port, struct file *filp) | |||
983 | * through, otherwise it is scheduled, and with high data rates (like | 984 | * through, otherwise it is scheduled, and with high data rates (like |
984 | * with OHCI) data can get lost. | 985 | * with OHCI) data can get lost. |
985 | */ | 986 | */ |
986 | if (port->tty) | 987 | if (tty) |
987 | port->tty->low_latency = 1; | 988 | tty->low_latency = 1; |
988 | 989 | ||
989 | spin_lock_irqsave(&garmin_data_p->lock, flags); | 990 | spin_lock_irqsave(&garmin_data_p->lock, flags); |
990 | garmin_data_p->mode = initial_mode; | 991 | garmin_data_p->mode = initial_mode; |
@@ -998,17 +999,16 @@ static int garmin_open (struct usb_serial_port *port, struct file *filp) | |||
998 | usb_kill_urb (port->write_urb); | 999 | usb_kill_urb (port->write_urb); |
999 | usb_kill_urb (port->read_urb); | 1000 | usb_kill_urb (port->read_urb); |
1000 | 1001 | ||
1001 | if (garmin_data_p->state == STATE_RESET) { | 1002 | if (garmin_data_p->state == STATE_RESET) |
1002 | status = garmin_init_session(port); | 1003 | status = garmin_init_session(port); |
1003 | } | ||
1004 | 1004 | ||
1005 | garmin_data_p->state = STATE_ACTIVE; | 1005 | garmin_data_p->state = STATE_ACTIVE; |
1006 | |||
1007 | return status; | 1006 | return status; |
1008 | } | 1007 | } |
1009 | 1008 | ||
1010 | 1009 | ||
1011 | static void garmin_close (struct usb_serial_port *port, struct file * filp) | 1010 | static void garmin_close(struct tty_struct *tty, |
1011 | struct usb_serial_port *port, struct file * filp) | ||
1012 | { | 1012 | { |
1013 | struct usb_serial *serial = port->serial; | 1013 | struct usb_serial *serial = port->serial; |
1014 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | 1014 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); |
@@ -1042,7 +1042,6 @@ static void garmin_close (struct usb_serial_port *port, struct file * filp) | |||
1042 | mutex_unlock(&port->serial->disc_mutex); | 1042 | mutex_unlock(&port->serial->disc_mutex); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | |||
1046 | static void garmin_write_bulk_callback (struct urb *urb) | 1045 | static void garmin_write_bulk_callback (struct urb *urb) |
1047 | { | 1046 | { |
1048 | unsigned long flags; | 1047 | unsigned long flags; |
@@ -1145,10 +1144,8 @@ static int garmin_write_bulk (struct usb_serial_port *port, | |||
1145 | return count; | 1144 | return count; |
1146 | } | 1145 | } |
1147 | 1146 | ||
1148 | 1147 | static int garmin_write (struct tty_struct *tty, struct usb_serial_port *port, | |
1149 | 1148 | const unsigned char *buf, int count) | |
1150 | static int garmin_write (struct usb_serial_port *port, | ||
1151 | const unsigned char *buf, int count) | ||
1152 | { | 1149 | { |
1153 | int pktid, pktsiz, len; | 1150 | int pktid, pktsiz, len; |
1154 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | 1151 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); |
@@ -1158,7 +1155,6 @@ static int garmin_write (struct usb_serial_port *port, | |||
1158 | 1155 | ||
1159 | /* check for our private packets */ | 1156 | /* check for our private packets */ |
1160 | if (count >= GARMIN_PKTHDR_LENGTH) { | 1157 | if (count >= GARMIN_PKTHDR_LENGTH) { |
1161 | |||
1162 | len = PRIVPKTSIZ; | 1158 | len = PRIVPKTSIZ; |
1163 | if (count < len) | 1159 | if (count < len) |
1164 | len = count; | 1160 | len = count; |
@@ -1226,8 +1222,9 @@ static int garmin_write (struct usb_serial_port *port, | |||
1226 | } | 1222 | } |
1227 | 1223 | ||
1228 | 1224 | ||
1229 | static int garmin_write_room (struct usb_serial_port *port) | 1225 | static int garmin_write_room(struct tty_struct *tty) |
1230 | { | 1226 | { |
1227 | struct usb_serial_port *port = tty->driver_data; | ||
1231 | /* | 1228 | /* |
1232 | * Report back the bytes currently available in the output buffer. | 1229 | * Report back the bytes currently available in the output buffer. |
1233 | */ | 1230 | */ |
@@ -1236,20 +1233,6 @@ static int garmin_write_room (struct usb_serial_port *port) | |||
1236 | } | 1233 | } |
1237 | 1234 | ||
1238 | 1235 | ||
1239 | static int garmin_chars_in_buffer (struct usb_serial_port *port) | ||
1240 | { | ||
1241 | /* | ||
1242 | * Report back the number of bytes currently in our input buffer. | ||
1243 | * Will this lock up the driver - the buffer contains an incomplete | ||
1244 | * package which will not be written to the device until it | ||
1245 | * has been completed ? | ||
1246 | */ | ||
1247 | //struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | ||
1248 | //return garmin_data_p->insize; | ||
1249 | return 0; | ||
1250 | } | ||
1251 | |||
1252 | |||
1253 | static void garmin_read_process(struct garmin_data * garmin_data_p, | 1236 | static void garmin_read_process(struct garmin_data * garmin_data_p, |
1254 | unsigned char *data, unsigned data_length) | 1237 | unsigned char *data, unsigned data_length) |
1255 | { | 1238 | { |
@@ -1468,10 +1451,11 @@ static int garmin_flush_queue(struct garmin_data * garmin_data_p) | |||
1468 | } | 1451 | } |
1469 | 1452 | ||
1470 | 1453 | ||
1471 | static void garmin_throttle (struct usb_serial_port *port) | 1454 | static void garmin_throttle(struct tty_struct *tty) |
1472 | { | 1455 | { |
1473 | unsigned long flags; | 1456 | struct usb_serial_port *port = tty->driver_data; |
1474 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | 1457 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); |
1458 | unsigned long flags; | ||
1475 | 1459 | ||
1476 | dbg("%s - port %d", __func__, port->number); | 1460 | dbg("%s - port %d", __func__, port->number); |
1477 | /* set flag, data received will be put into a queue | 1461 | /* set flag, data received will be put into a queue |
@@ -1482,10 +1466,11 @@ static void garmin_throttle (struct usb_serial_port *port) | |||
1482 | } | 1466 | } |
1483 | 1467 | ||
1484 | 1468 | ||
1485 | static void garmin_unthrottle (struct usb_serial_port *port) | 1469 | static void garmin_unthrottle (struct tty_struct *tty) |
1486 | { | 1470 | { |
1487 | unsigned long flags; | 1471 | struct usb_serial_port *port = tty->driver_data; |
1488 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | 1472 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); |
1473 | unsigned long flags; | ||
1489 | int status; | 1474 | int status; |
1490 | 1475 | ||
1491 | dbg("%s - port %d", __func__, port->number); | 1476 | dbg("%s - port %d", __func__, port->number); |
@@ -1507,8 +1492,6 @@ static void garmin_unthrottle (struct usb_serial_port *port) | |||
1507 | } | 1492 | } |
1508 | } | 1493 | } |
1509 | 1494 | ||
1510 | |||
1511 | |||
1512 | /* | 1495 | /* |
1513 | * The timer is currently only used to send queued packets to | 1496 | * The timer is currently only used to send queued packets to |
1514 | * the tty in cases where the protocol provides no own handshaking | 1497 | * the tty in cases where the protocol provides no own handshaking |
@@ -1526,7 +1509,7 @@ static void timeout_handler(unsigned long data) | |||
1526 | 1509 | ||
1527 | 1510 | ||
1528 | 1511 | ||
1529 | static int garmin_attach (struct usb_serial *serial) | 1512 | static int garmin_attach(struct usb_serial *serial) |
1530 | { | 1513 | { |
1531 | int status = 0; | 1514 | int status = 0; |
1532 | struct usb_serial_port *port = serial->port[0]; | 1515 | struct usb_serial_port *port = serial->port[0]; |
@@ -1556,7 +1539,7 @@ static int garmin_attach (struct usb_serial *serial) | |||
1556 | } | 1539 | } |
1557 | 1540 | ||
1558 | 1541 | ||
1559 | static void garmin_shutdown (struct usb_serial *serial) | 1542 | static void garmin_shutdown(struct usb_serial *serial) |
1560 | { | 1543 | { |
1561 | struct usb_serial_port *port = serial->port[0]; | 1544 | struct usb_serial_port *port = serial->port[0]; |
1562 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); | 1545 | struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); |
@@ -1588,7 +1571,6 @@ static struct usb_serial_driver garmin_device = { | |||
1588 | .shutdown = garmin_shutdown, | 1571 | .shutdown = garmin_shutdown, |
1589 | .write = garmin_write, | 1572 | .write = garmin_write, |
1590 | .write_room = garmin_write_room, | 1573 | .write_room = garmin_write_room, |
1591 | .chars_in_buffer = garmin_chars_in_buffer, | ||
1592 | .write_bulk_callback = garmin_write_bulk_callback, | 1574 | .write_bulk_callback = garmin_write_bulk_callback, |
1593 | .read_bulk_callback = garmin_read_bulk_callback, | 1575 | .read_bulk_callback = garmin_read_bulk_callback, |
1594 | .read_int_callback = garmin_read_int_callback, | 1576 | .read_int_callback = garmin_read_int_callback, |