aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-06-14 04:47:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 18:04:17 -0400
commitca094f1186ef50ef8983325072cdc4f051830f13 (patch)
tree1613108cc900cda8d209b48a86d9d1bf66d174ad /drivers
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')
-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 b58f015554b7..e477edd681d3 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -53,8 +53,8 @@
53 53
54/* Defines */ 54/* Defines */
55 55
56#define GS_VERSION_STR "v2.1" 56#define GS_VERSION_STR "v2.2"
57#define GS_VERSION_NUM 0x0201 57#define GS_VERSION_NUM 0x0202
58 58
59#define GS_LONG_NAME "Gadget Serial" 59#define GS_LONG_NAME "Gadget Serial"
60#define GS_SHORT_NAME "g_serial" 60#define GS_SHORT_NAME "g_serial"
@@ -774,18 +774,16 @@ exit_unlock_dev:
774 774
775#define GS_WRITE_FINISHED_EVENT_SAFELY(p) \ 775#define GS_WRITE_FINISHED_EVENT_SAFELY(p) \
776({ \ 776({ \
777 unsigned long flags; \
778 int cond; \ 777 int cond; \
779 \ 778 \
780 spin_lock_irqsave(&(p)->port_lock, flags); \ 779 spin_lock_irq(&(p)->port_lock); \
781 cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \ 780 cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \
782 spin_unlock_irqrestore(&(p)->port_lock, flags); \ 781 spin_unlock_irq(&(p)->port_lock); \
783 cond; \ 782 cond; \
784}) 783})
785 784
786static void gs_close(struct tty_struct *tty, struct file *file) 785static void gs_close(struct tty_struct *tty, struct file *file)
787{ 786{
788 unsigned long flags;
789 struct gs_port *port = tty->driver_data; 787 struct gs_port *port = tty->driver_data;
790 struct semaphore *sem; 788 struct semaphore *sem;
791 789
@@ -799,7 +797,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
799 sem = &gs_open_close_sem[port->port_num]; 797 sem = &gs_open_close_sem[port->port_num];
800 down(sem); 798 down(sem);
801 799
802 spin_lock_irqsave(&port->port_lock, flags); 800 spin_lock_irq(&port->port_lock);
803 801
804 if (port->port_open_count == 0) { 802 if (port->port_open_count == 0) {
805 printk(KERN_ERR 803 printk(KERN_ERR
@@ -827,11 +825,11 @@ static void gs_close(struct tty_struct *tty, struct file *file)
827 /* wait for write buffer to drain, or */ 825 /* wait for write buffer to drain, or */
828 /* at most GS_CLOSE_TIMEOUT seconds */ 826 /* at most GS_CLOSE_TIMEOUT seconds */
829 if (gs_buf_data_avail(port->port_write_buf) > 0) { 827 if (gs_buf_data_avail(port->port_write_buf) > 0) {
830 spin_unlock_irqrestore(&port->port_lock, flags); 828 spin_unlock_irq(&port->port_lock);
831 wait_event_interruptible_timeout(port->port_write_wait, 829 wait_event_interruptible_timeout(port->port_write_wait,
832 GS_WRITE_FINISHED_EVENT_SAFELY(port), 830 GS_WRITE_FINISHED_EVENT_SAFELY(port),
833 GS_CLOSE_TIMEOUT * HZ); 831 GS_CLOSE_TIMEOUT * HZ);
834 spin_lock_irqsave(&port->port_lock, flags); 832 spin_lock_irq(&port->port_lock);
835 } 833 }
836 834
837 /* free disconnected port on final close */ 835 /* free disconnected port on final close */
@@ -851,7 +849,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
851 port->port_num, tty, file); 849 port->port_num, tty, file);
852 850
853exit: 851exit:
854 spin_unlock_irqrestore(&port->port_lock, flags); 852 spin_unlock_irq(&port->port_lock);
855 up(sem); 853 up(sem);
856} 854}
857 855