diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-01 16:53:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:44 -0400 |
commit | e142a31da34b42458e10026b554e66127739cf23 (patch) | |
tree | 1f65a42cd559116223e1fa1db7631cd449c73968 /drivers | |
parent | b07471fa51358ce64cc25e1501544502362e4404 (diff) |
tty: release BTM while sleeping in block_til_ready
Most tty drivers may block while opening a device.
Since this possibly depends on another thread
closing it first and both threads may need the BTM,
we need to release it here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/amiserial.c | 2 | ||||
-rw-r--r-- | drivers/char/ip2/ip2main.c | 4 | ||||
-rw-r--r-- | drivers/char/serial167.c | 4 | ||||
-rw-r--r-- | drivers/char/specialix.c | 2 | ||||
-rw-r--r-- | drivers/char/synclink.c | 2 | ||||
-rw-r--r-- | drivers/char/synclink_gt.c | 2 | ||||
-rw-r--r-- | drivers/char/synclinkmp.c | 2 | ||||
-rw-r--r-- | drivers/char/tty_port.c | 2 | ||||
-rw-r--r-- | drivers/serial/68328serial.c | 2 | ||||
-rw-r--r-- | drivers/serial/68360serial.c | 2 | ||||
-rw-r--r-- | drivers/serial/crisv10.c | 2 |
11 files changed, 25 insertions, 1 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 8228e61bb54d..a11c8c9ca3d4 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -1710,7 +1710,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1710 | printk("block_til_ready blocking: ttys%d, count = %d\n", | 1710 | printk("block_til_ready blocking: ttys%d, count = %d\n", |
1711 | info->line, state->count); | 1711 | info->line, state->count); |
1712 | #endif | 1712 | #endif |
1713 | tty_unlock(); | ||
1713 | schedule(); | 1714 | schedule(); |
1715 | tty_lock(); | ||
1714 | } | 1716 | } |
1715 | __set_current_state(TASK_RUNNING); | 1717 | __set_current_state(TASK_RUNNING); |
1716 | remove_wait_queue(&info->open_wait, &wait); | 1718 | remove_wait_queue(&info->open_wait, &wait); |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 911e1da6def2..07f3ea38b582 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -1486,7 +1486,9 @@ ip2_open( PTTY tty, struct file *pFile ) | |||
1486 | 1486 | ||
1487 | if ( tty_hung_up_p(pFile) || ( pCh->flags & ASYNC_CLOSING )) { | 1487 | if ( tty_hung_up_p(pFile) || ( pCh->flags & ASYNC_CLOSING )) { |
1488 | if ( pCh->flags & ASYNC_CLOSING ) { | 1488 | if ( pCh->flags & ASYNC_CLOSING ) { |
1489 | tty_unlock(); | ||
1489 | schedule(); | 1490 | schedule(); |
1491 | tty_lock(); | ||
1490 | } | 1492 | } |
1491 | if ( tty_hung_up_p(pFile) ) { | 1493 | if ( tty_hung_up_p(pFile) ) { |
1492 | set_current_state( TASK_RUNNING ); | 1494 | set_current_state( TASK_RUNNING ); |
@@ -1548,7 +1550,9 @@ ip2_open( PTTY tty, struct file *pFile ) | |||
1548 | rc = (( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS); | 1550 | rc = (( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS); |
1549 | break; | 1551 | break; |
1550 | } | 1552 | } |
1553 | tty_unlock(); | ||
1551 | schedule(); | 1554 | schedule(); |
1555 | tty_lock(); | ||
1552 | } | 1556 | } |
1553 | set_current_state( TASK_RUNNING ); | 1557 | set_current_state( TASK_RUNNING ); |
1554 | remove_wait_queue(&pCh->open_wait, &wait); | 1558 | remove_wait_queue(&pCh->open_wait, &wait); |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 90b3ec0aabdd..f646725bd567 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -1786,7 +1786,9 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
1786 | tty->name, info->count); | 1786 | tty->name, info->count); |
1787 | /**/ | 1787 | /**/ |
1788 | #endif | 1788 | #endif |
1789 | schedule(); | 1789 | tty_unlock(); |
1790 | schedule(); | ||
1791 | tty_lock(); | ||
1790 | } | 1792 | } |
1791 | __set_current_state(TASK_RUNNING); | 1793 | __set_current_state(TASK_RUNNING); |
1792 | remove_wait_queue(&info->open_wait, &wait); | 1794 | remove_wait_queue(&info->open_wait, &wait); |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 7be456f760c9..9f8495b4fc8f 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -1365,7 +1365,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
1365 | retval = -ERESTARTSYS; | 1365 | retval = -ERESTARTSYS; |
1366 | break; | 1366 | break; |
1367 | } | 1367 | } |
1368 | tty_unlock(); | ||
1368 | schedule(); | 1369 | schedule(); |
1370 | tty_lock(); | ||
1369 | } | 1371 | } |
1370 | 1372 | ||
1371 | set_current_state(TASK_RUNNING); | 1373 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 2b03d4d47350..a2a58004e188 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -3349,7 +3349,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3349 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", | 3349 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", |
3350 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3350 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3351 | 3351 | ||
3352 | tty_unlock(); | ||
3352 | schedule(); | 3353 | schedule(); |
3354 | tty_lock(); | ||
3353 | } | 3355 | } |
3354 | 3356 | ||
3355 | set_current_state(TASK_RUNNING); | 3357 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 5a602eb7cd2d..fef80cfcab5c 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -3244,7 +3244,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3244 | } | 3244 | } |
3245 | 3245 | ||
3246 | DBGINFO(("%s block_til_ready wait\n", tty->driver->name)); | 3246 | DBGINFO(("%s block_til_ready wait\n", tty->driver->name)); |
3247 | tty_unlock(); | ||
3247 | schedule(); | 3248 | schedule(); |
3249 | tty_lock(); | ||
3248 | } | 3250 | } |
3249 | 3251 | ||
3250 | set_current_state(TASK_RUNNING); | 3252 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index ac447c7eb572..e56caf7d82aa 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -3365,7 +3365,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3365 | printk("%s(%d):%s block_til_ready() count=%d\n", | 3365 | printk("%s(%d):%s block_til_ready() count=%d\n", |
3366 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3366 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3367 | 3367 | ||
3368 | tty_unlock(); | ||
3368 | schedule(); | 3369 | schedule(); |
3370 | tty_lock(); | ||
3369 | } | 3371 | } |
3370 | 3372 | ||
3371 | set_current_state(TASK_RUNNING); | 3373 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 35eb30402f18..33d37d230f8f 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -294,7 +294,9 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
294 | retval = -ERESTARTSYS; | 294 | retval = -ERESTARTSYS; |
295 | break; | 295 | break; |
296 | } | 296 | } |
297 | tty_unlock(); | ||
297 | schedule(); | 298 | schedule(); |
299 | tty_lock(); | ||
298 | } | 300 | } |
299 | finish_wait(&port->open_wait, &wait); | 301 | finish_wait(&port->open_wait, &wait); |
300 | 302 | ||
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index 9330edb323e2..d8204f4ebbb4 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c | |||
@@ -1235,7 +1235,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1235 | retval = -ERESTARTSYS; | 1235 | retval = -ERESTARTSYS; |
1236 | break; | 1236 | break; |
1237 | } | 1237 | } |
1238 | tty_unlock(); | ||
1238 | schedule(); | 1239 | schedule(); |
1240 | tty_lock(); | ||
1239 | } | 1241 | } |
1240 | current->state = TASK_RUNNING; | 1242 | current->state = TASK_RUNNING; |
1241 | remove_wait_queue(&info->open_wait, &wait); | 1243 | remove_wait_queue(&info->open_wait, &wait); |
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index edcf1cc089d1..0dff3bbddc8b 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
@@ -1860,7 +1860,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1860 | printk("block_til_ready blocking: ttys%d, count = %d\n", | 1860 | printk("block_til_ready blocking: ttys%d, count = %d\n", |
1861 | info->line, state->count); | 1861 | info->line, state->count); |
1862 | #endif | 1862 | #endif |
1863 | tty_unlock(); | ||
1863 | schedule(); | 1864 | schedule(); |
1865 | tty_lock(); | ||
1864 | } | 1866 | } |
1865 | current->state = TASK_RUNNING; | 1867 | current->state = TASK_RUNNING; |
1866 | remove_wait_queue(&info->open_wait, &wait); | 1868 | remove_wait_queue(&info->open_wait, &wait); |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 8e356c5eeae0..5696710b6f2d 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -4066,7 +4066,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4066 | printk("block_til_ready blocking: ttyS%d, count = %d\n", | 4066 | printk("block_til_ready blocking: ttyS%d, count = %d\n", |
4067 | info->line, info->count); | 4067 | info->line, info->count); |
4068 | #endif | 4068 | #endif |
4069 | tty_unlock(); | ||
4069 | schedule(); | 4070 | schedule(); |
4071 | tty_lock(); | ||
4070 | } | 4072 | } |
4071 | set_current_state(TASK_RUNNING); | 4073 | set_current_state(TASK_RUNNING); |
4072 | remove_wait_queue(&info->open_wait, &wait); | 4074 | remove_wait_queue(&info->open_wait, &wait); |