MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_driver keyspan_pda_driver = {
- .owner = THIS_MODULE,
.name = "keyspan_pda",
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
+ .no_dynamic_id = 1,
};
static struct usb_device_id id_table_std [] = {
wake_up_interruptible( &port->write_wait );
/* wake up line discipline */
- if( (tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
- && tty->ldisc.write_wakeup )
- (tty->ldisc.write_wakeup)(tty);
-
- /* wake up other tty processes */
- wake_up_interruptible( &tty->write_wait );
- /* For 2.2.16 backport -- wake_up_interruptible( &tty->poll_wait ); */
+ tty_wakeup(tty);
}
static void keyspan_pda_request_unthrottle( struct usb_serial *serial )
0, /* index */
NULL,
0,
- 2*HZ);
+ 2000);
if (result < 0)
dbg("%s - error %d from usb_control_msg",
__FUNCTION__, result);
upon the device too. */
dbg("keyspan_pda_rx_throttle port %d", port->number);
- usb_unlink_urb(port->interrupt_in_urb);
+ usb_kill_urb(port->interrupt_in_urb);
}
0, /* index */
NULL, /* &data */
0, /* size */
- 2*HZ); /* timeout */
+ 2000); /* timeout */
return(rc);
}
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
4, /* set break */
USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT,
- value, 0, NULL, 0, 2*HZ);
+ value, 0, NULL, 0, 2000);
if (result < 0)
dbg("%s - error %d from usb_control_msg",
__FUNCTION__, result);
rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
3, /* get pins */
USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
- 0, 0, &data, 1, 2*HZ);
+ 0, 0, &data, 1, 2000);
if (rc > 0)
*value = data;
return rc;
rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
3, /* set pins */
USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_OUT,
- value, 0, NULL, 0, 2*HZ);
+ value, 0, NULL, 0, 2000);
return rc;
}
return -ENOIOCTLCMD;
}
-static int keyspan_pda_write(struct usb_serial_port *port, int from_user,
+static int keyspan_pda_write(struct usb_serial_port *port,
const unsigned char *buf, int count)
{
struct usb_serial *serial = port->serial;
the TX urb is in-flight (wait until it completes)
the device is full (wait until it says there is room)
*/
- if (port->write_urb->status == -EINPROGRESS || priv->tx_throttled ) {
- return( 0 );
+ spin_lock(&port->lock);
+ if (port->write_urb_busy || priv->tx_throttled) {
+ spin_unlock(&port->lock);
+ return 0;
}
+ port->write_urb_busy = 1;
+ spin_unlock(&port->lock);
/* At this point the URB is in our control, nobody else can submit it
again (the only sudden transition was the one from EINPROGRESS to
0, /* index */
&room,
1,
- 2*HZ);
+ 2000);
if (rc < 0) {
dbg(" roomquery failed");
goto exit;
if (count) {
/* now transfer data */
- if (from_user) {
- if( copy_from_user(port->write_urb->transfer_buffer,
- buf, count) ) {
- rc = -EFAULT;
- goto exit;
- }
- }
- else {
- memcpy (port->write_urb->transfer_buffer, buf, count);
- }
+ memcpy (port->write_urb->transfer_buffer, buf, count);
/* send the data out the bulk port */
port->write_urb->transfer_buffer_length = count;
-
+
priv->tx_room -= count;
port->write_urb->dev = port->serial->dev;
rc = count;
exit:
+ if (rc < 0)
+ port->write_urb_busy = 0;
return rc;
}
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct keyspan_pda_private *priv;
+ port->write_urb_busy = 0;
priv = usb_get_serial_port_data(port);
/* queue up a wakeup at scheduler time */
static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port)
{
struct keyspan_pda_private *priv;
-
+
priv = usb_get_serial_port_data(port);
-
+
/* when throttled, return at least WAKEUP_CHARS to tell select() (via
n_tty.c:normal_poll() ) that we're not writeable. */
- if( port->write_urb->status == -EINPROGRESS || priv->tx_throttled )
+ if (port->write_urb_busy || priv->tx_throttled)
return 256;
return 0;
}
0, /* index */
&room,
1,
- 2*HZ);
+ 2000);
if (rc < 0) {
dbg("%s - roomquery failed", __FUNCTION__);
goto error;
keyspan_pda_set_modem_info(serial, 0);
/* shutdown our bulk reads and writes */
- usb_unlink_urb (port->write_urb);
- usb_unlink_urb (port->interrupt_in_urb);
+ usb_kill_urb(port->write_urb);
+ usb_kill_urb(port->interrupt_in_urb);
}
}
response = ezusb_set_reset(serial, 1);
#ifdef KEYSPAN
- if (serial->dev->descriptor.idVendor == KEYSPAN_VENDOR_ID)
+ if (le16_to_cpu(serial->dev->descriptor.idVendor) == KEYSPAN_VENDOR_ID)
record = &keyspan_pda_firmware[0];
#endif
#ifdef XIRCOM
- if ((serial->dev->descriptor.idVendor == XIRCOM_VENDOR_ID) ||
- (serial->dev->descriptor.idVendor == ENTREGRA_VENDOR_ID))
+ if ((le16_to_cpu(serial->dev->descriptor.idVendor) == XIRCOM_VENDOR_ID) ||
+ (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGRA_VENDOR_ID))
record = &xircom_pgs_firmware[0];
#endif
if (record == NULL) {
}
#ifdef KEYSPAN
-static struct usb_serial_device_type keyspan_pda_fake_device = {
- .owner = THIS_MODULE,
- .name = "Keyspan PDA - (prerenumeration)",
- .short_name = "keyspan_pda_pre",
+static struct usb_serial_driver keyspan_pda_fake_device = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "keyspan_pda_pre",
+ },
+ .description = "Keyspan PDA - (prerenumeration)",
.id_table = id_table_fake,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
#endif
#ifdef XIRCOM
-static struct usb_serial_device_type xircom_pgs_fake_device = {
- .owner = THIS_MODULE,
- .name = "Xircom / Entregra PGS - (prerenumeration)",
- .short_name = "xircom_no_firm",
+static struct usb_serial_driver xircom_pgs_fake_device = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "xircom_no_firm",
+ },
+ .description = "Xircom / Entregra PGS - (prerenumeration)",
.id_table = id_table_fake_xircom,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
};
#endif
-static struct usb_serial_device_type keyspan_pda_device = {
- .owner = THIS_MODULE,
- .name = "Keyspan PDA",
- .short_name = "keyspan_pda",
+static struct usb_serial_driver keyspan_pda_device = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "keyspan_pda",
+ },
+ .description = "Keyspan PDA",
.id_table = id_table_std,
.num_interrupt_in = 1,
.num_bulk_in = 0,