[PATCH 08/10] usb-serial: safe_serial driver port.

From: Luiz Fernando Capitulino
Date: Tue Dec 06 2005 - 07:15:34 EST



Ports the safe_serial driver from write_urb_busy spin_lock to
usb_serial_write_urb_lock() functions.

Signed-off-by: Luiz Capitulino <lcapitulino@xxxxxxxxxxxxxxx>

drivers/usb/serial/safe_serial.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff -Nparu -X /home/lcapitulino/kernels/dontdiff a/drivers/usb/serial/safe_serial.c a~/drivers/usb/serial/safe_serial.c
--- a/drivers/usb/serial/safe_serial.c 2005-12-04 01:44:19.000000000 -0200
+++ a~/drivers/usb/serial/safe_serial.c 2005-12-04 15:14:04.000000000 -0200
@@ -69,7 +69,6 @@
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
-#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include "usb-serial.h"
@@ -299,14 +298,10 @@ static int safe_write (struct usb_serial
dbg ("%s - write request of 0 bytes", __FUNCTION__);
return (0);
}
- spin_lock(&port->lock);
- if (port->write_urb_busy) {
- spin_unlock(&port->lock);
+ if (usb_serial_write_urb_lock(port)) {
dbg("%s - already writing", __FUNCTION__);
return 0;
}
- port->write_urb_busy = 1;
- spin_unlock(&port->lock);

packet_length = port->bulk_out_size; // get max packetsize

@@ -358,7 +353,7 @@ static int safe_write (struct usb_serial
#endif
port->write_urb->dev = port->serial->dev;
if ((result = usb_submit_urb (port->write_urb, GFP_KERNEL))) {
- port->write_urb_busy = 0;
+ usb_serial_write_urb_unlock(port);
err ("%s - failed submitting write urb, error %d", __FUNCTION__, result);
return 0;
}
@@ -373,7 +368,7 @@ static int safe_write_room (struct usb_s

dbg ("%s", __FUNCTION__);

- if (port->write_urb_busy)
+ if (usb_serial_write_urb_locked(port))
room = port->bulk_out_size - (safe ? 2 : 0);

if (room) {


--
Luiz Fernando N. Capitulino
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/