Char: rio, fix sparse warnings
authorJiri Slaby <jirislaby@gmail.com>
Wed, 2 Apr 2008 20:04:48 +0000 (13:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 2 Apr 2008 22:28:19 +0000 (15:28 -0700)
Add some locks and unlocks to some code paths.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/rio/riotable.c
drivers/char/rio/riotty.c

index 991119c9f473ef81a8f8691be7860b52af3bd38d..9b52892a501f67702222eca6eedcf913783e3fc3 100644 (file)
@@ -425,8 +425,10 @@ int RIOApel(struct rio_info *p)
 
                MapP = &p->RIOConnectTable[Next++];
                MapP->HostUniqueNum = HostP->UniqueNum;
-               if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
+               if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
+                       rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
                        continue;
+               }
                MapP->RtaUniqueNum = 0;
                MapP->ID = 0;
                MapP->Flags = SLOT_IN_USE;
index a4f0b1e3e7fabf105892d9c2d442e8cc066d7147..cfa54361473ffe05cb989be41987e0ffbefb04c8 100644 (file)
@@ -319,6 +319,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                        PortP->State |= RIO_WOPEN;
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
+                               rio_spin_lock_irqsave(&PortP->portSem, flags);
                                /*
                                 ** ACTION: verify that this is a good thing
                                 ** to do here. -- ???
@@ -334,6 +335,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                                func_exit();
                                return -EINTR;
                        }
+                       rio_spin_lock_irqsave(&PortP->portSem, flags);
                }
                PortP->State &= ~RIO_WOPEN;
        }
@@ -493,6 +495,7 @@ int riotclose(void *ptr)
 
        if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
                RIOPreemptiveCmd(p, PortP, FCLOSE);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
                goto close_end;
        }
 
@@ -508,6 +511,7 @@ int riotclose(void *ptr)
 
                        if (p->RIOHalted) {
                                RIOClearUp(PortP);
+                               rio_spin_lock_irqsave(&PortP->portSem, flags);
                                goto close_end;
                        }
                        if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {