aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/serial.c
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-06-14 10:47:18 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:04:17 -0700
commitca094f1186ef50ef8983325072cdc4f051830f13 (patch)
tree1613108cc900cda8d209b48a86d9d1bf66d174ad /drivers/usb/gadget/serial.c
parent943e1b4d60dc7acfabe2ebad31189bcb3b853688 (diff)
[PATCH] USB: gadget-serial: do not save/restore IRQ flags in gs_close()
As pointed out by David Brownell, we know that IRQs are never blocked when calling gs_close function. So the save/restore IRQ flags are pointless. Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r--drivers/usb/gadget/serial.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index b58f015554b..e477edd681d 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -53,8 +53,8 @@
/* Defines */
-#define GS_VERSION_STR "v2.1"
-#define GS_VERSION_NUM 0x0201
+#define GS_VERSION_STR "v2.2"
+#define GS_VERSION_NUM 0x0202
#define GS_LONG_NAME "Gadget Serial"
#define GS_SHORT_NAME "g_serial"
@@ -774,18 +774,16 @@ exit_unlock_dev:
#define GS_WRITE_FINISHED_EVENT_SAFELY(p) \
({ \
- unsigned long flags; \
int cond; \
\
- spin_lock_irqsave(&(p)->port_lock, flags); \
+ spin_lock_irq(&(p)->port_lock); \
cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \
- spin_unlock_irqrestore(&(p)->port_lock, flags); \
+ spin_unlock_irq(&(p)->port_lock); \
cond; \
})
static void gs_close(struct tty_struct *tty, struct file *file)
{
- unsigned long flags;
struct gs_port *port = tty->driver_data;
struct semaphore *sem;
@@ -799,7 +797,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
sem = &gs_open_close_sem[port->port_num];
down(sem);
- spin_lock_irqsave(&port->port_lock, flags);
+ spin_lock_irq(&port->port_lock);
if (port->port_open_count == 0) {
printk(KERN_ERR
@@ -827,11 +825,11 @@ static void gs_close(struct tty_struct *tty, struct file *file)
/* wait for write buffer to drain, or */
/* at most GS_CLOSE_TIMEOUT seconds */
if (gs_buf_data_avail(port->port_write_buf) > 0) {
- spin_unlock_irqrestore(&port->port_lock, flags);
+ spin_unlock_irq(&port->port_lock);
wait_event_interruptible_timeout(port->port_write_wait,
GS_WRITE_FINISHED_EVENT_SAFELY(port),
GS_CLOSE_TIMEOUT * HZ);
- spin_lock_irqsave(&port->port_lock, flags);
+ spin_lock_irq(&port->port_lock);
}
/* free disconnected port on final close */
@@ -851,7 +849,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
port->port_num, tty, file);
exit:
- spin_unlock_irqrestore(&port->port_lock, flags);
+ spin_unlock_irq(&port->port_lock);
up(sem);
}