Re: question on aircable drievr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Monday 16 February 2009 15:46:38 schrieb Manuel Naranjo:
> 
> > Hi Manuel,
> >
> > I was loking at the aircable driver and its throtteling. I fail to understand
> > the use of ACTUALLY_THROTTLED. It seems to me it is never set.
> >
> > 	Regards
> > 		Oliver
> >
> >   
> Oliver,
> 
> To be honest I remember I based most of my code in ftdi module, so I 
> guess I got this part from it... I have to admit I can't remember why I 
> did it this way.

OK, as this code is useless, please try this patch.

	Regards
		Oliver




commit c8c0b3b2a3c724fb2c42498922f1cd13441bbbe5
Author: Oliver Neukum <oneukum@xxxxxxx>
Date:   Tue Feb 17 18:39:21 2009 +0100

    remove useless and broken throttling code from the aircable driver

diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 6d106e7..244d454 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -66,9 +66,6 @@ static int debug;
 #define MAX_HCI_FRAMESIZE	60
 #define HCI_COMPLETE_FRAME	64
 
-/* rx_flags */
-#define THROTTLED		0x01
-#define ACTUALLY_THROTTLED	0x02
 
 /*
  * Version Information
@@ -87,10 +84,8 @@ MODULE_DEVICE_TABLE(usb, id_table);
 
 /* Internal Structure */
 struct aircable_private {
-	spinlock_t rx_lock;		/* spinlock for the receive lines */
 	struct circ_buf *tx_buf;	/* write buffer */
 	struct circ_buf *rx_buf;	/* read buffer */
-	int rx_flags;			/* for throttilng */
 	struct work_struct rx_work;	/* work cue for the receiving line */
 	struct usb_serial_port *port;	/* USB port with which associated */
 };
@@ -262,11 +257,6 @@ static void aircable_read(struct work_struct *work)
 	struct tty_struct *tty;
 	unsigned char *data;
 	int count;
-	if (priv->rx_flags & THROTTLED) {
-		if (priv->rx_flags & ACTUALLY_THROTTLED)
-			schedule_work(&priv->rx_work);
-		return;
-	}
 
 	/* By now I will flush data to the tty in packages of no more than
 	 * 64 bytes, to ensure I do not get throttled.
@@ -355,7 +345,6 @@ static int aircable_attach(struct usb_serial *serial)
 		return -ENOMEM;
 	}
 
-	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
 	priv->port = port;
 	INIT_WORK(&priv->rx_work, aircable_read);
 
@@ -550,39 +539,6 @@ static void aircable_read_bulk_callback(struct urb *urb)
 	return;
 }
 
-/* Based on ftdi_sio.c throttle */
-static void aircable_throttle(struct tty_struct *tty)
-{
-	struct usb_serial_port *port = tty->driver_data;
-	struct aircable_private *priv = usb_get_serial_port_data(port);
-	unsigned long flags;
-
-	dbg("%s - port %d", __func__, port->number);
-
-	spin_lock_irqsave(&priv->rx_lock, flags);
-	priv->rx_flags |= THROTTLED;
-	spin_unlock_irqrestore(&priv->rx_lock, flags);
-}
-
-/* Based on ftdi_sio.c unthrottle */
-static void aircable_unthrottle(struct tty_struct *tty)
-{
-	struct usb_serial_port *port = tty->driver_data;
-	struct aircable_private *priv = usb_get_serial_port_data(port);
-	int actually_throttled;
-	unsigned long flags;
-
-	dbg("%s - port %d", __func__, port->number);
-
-	spin_lock_irqsave(&priv->rx_lock, flags);
-	actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED;
-	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
-	spin_unlock_irqrestore(&priv->rx_lock, flags);
-
-	if (actually_throttled)
-		schedule_work(&priv->rx_work);
-}
-
 static struct usb_driver aircable_driver = {
 	.name =		"aircable",
 	.probe =	usb_serial_probe,
@@ -606,8 +562,6 @@ static struct usb_serial_driver aircable_device = {
 	.write_room =		aircable_write_room,
 	.write_bulk_callback =	aircable_write_bulk_callback,
 	.read_bulk_callback =	aircable_read_bulk_callback,
-	.throttle =		aircable_throttle,
-	.unthrottle =		aircable_unthrottle,
 };
 
 static int __init aircable_init(void)

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux