tty: replace mutex_lock() with tty_write_lock()
Subsystems (2)
PATCH 1/1 tty: replace mutex_lock() with tty_write_lock()
Use tty_write_lock()/tty_write_unlock() consistently.
This takes care of the following sparse warning:drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlock
--- drivers/tty/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_io.c +1 -1
@@ -1165,7 +1165,7 @@ out:void tty_write_message (struct tty_struct *tty,char *msg) {if (tty) { -mutex_lock (&tty->atomic_write_lock); +tty_write_lock (tty,0 );tty_lock (tty);if (tty->ops->write && !test_bit (TTY_CLOSING , &tty->flags)) {tty_unlock (tty);
Signature · 1 line
1.7.10.4
Am 21.11.2013 20:12, schrieb Andreas Platschek:
Quoted 15 lines
Use tty_write_lock()/tty_write_unlock() consistently.
This takes care of the following sparse warning:
drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlockSigned-off-by Andreas Platschek <[email protected]>--- drivers/tty/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/tty_io.c +0
-0
drivers/tty/tty_io.c out: · line 1171
Quoted 8 lines
drivers/tty/tty_io.c +1
-1@@ -1165,7 +1165,7 @@ out:void tty_write_message (struct tty_struct *tty,char *msg) {if (tty) { -mutex_lock (&tty->atomic_write_lock); +tty_write_lock (tty,0 );tty_lock (tty);if (tty->ops->write && !test_bit (TTY_CLOSING , &tty->flags)) {tty_unlock (tty);
i am not an expert on this but you may need to replace that tty_unlock() with tty_write_unlock().
re,
wh
Hi,
Quoted 12 lines · walter harms
Am 21.11.2013 20:12, schrieb Andreas Platschek:
Quoted 10 lines
Use tty_write_lock()/tty_write_unlock() consistently.
This takes care of the following sparse warning:
drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlockSigned-off-by Andreas Platschek <[email protected]>--- drivers/tty/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/tty/tty_io.c out: · line 1171
Quoted 13 lines
drivers/tty/tty_io.c +1
-1@@ -1165,7 +1165,7 @@ out:void tty_write_message (struct tty_struct *tty,char *msg) {if (tty) { -mutex_lock (&tty->atomic_write_lock); +tty_write_lock (tty,0 );tty_lock (tty);if (tty->ops->write && !test_bit (TTY_CLOSING , &tty->flags)) {tty_unlock (tty);i am not an expert on this but you may need to replace that
tty_unlock()withtty_write_unlock()
The tty_unlock() you see in the patch belongs to the tty_lock() right after the tty_write_lock(), the tty_write_unlock() is already in place without my patch.
tty_lock()/tty_unlock() and tty_write_lock()/tty_write_unlock() are operating on different mutexes, both are needed here.
thx!
Andi
Quoted 3 lines
re,
wh
Quoted 13 lines · walter harms
Am 21.11.2013 20:12, schrieb Andreas Platschek:
Quoted 10 lines
Use tty_write_lock()/tty_write_unlock() consistently.
This takes care of the following sparse warning:
drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlockSigned-off-by Andreas Platschek <[email protected]>--- drivers/tty/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
drivers/tty/tty_io.c out: · line 1171
Quoted 13 lines
drivers/tty/tty_io.c +1
-1@@ -1165,7 +1165,7 @@ out:void tty_write_message (struct tty_struct *tty,char *msg) {if (tty) { -mutex_lock (&tty->atomic_write_lock); +tty_write_lock (tty,0 );tty_lock (tty);if (tty->ops->write && !test_bit (TTY_CLOSING , &tty->flags)) {tty_unlock (tty);i am not an expert on this but you may need to replace that
tty_unlock()withtty_write_unlock().
No. The original code is correct.
regards,
dan carpenter
Quoted 5 lines · Andreas Platschek
Use tty_write_lock()/tty_write_unlock() consistently.
This takes care of the following sparse warning:
drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlock
I don't think we can do this. mutex_lock() always succeeds and tty_write_lock() can fail.
I think we just have to live with the error message.
regards,
dan carpenter