[PATCH] drivers/isdn/hysdn/hysdn_sched.c: sleep after taking spinlock fix

spin_lock_irq{save,restore} is incorrectly called here (the function can
sleep after acquring the lock).

done the necessary corrections and removed unwanted cli/sti.

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Amol Lad and committed by Linus Torvalds 1f604c4b 43530d2b

+4 -15
+4 -15
drivers/isdn/hysdn/hysdn_sched.c
··· 155 155 if (card->debug_flags & LOG_SCHED_ASYN) 156 156 hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); 157 157 158 - spin_lock_irqsave(&card->hysdn_lock, flags); 159 158 while (card->async_busy) { 160 - sti(); 161 159 162 160 if (card->debug_flags & LOG_SCHED_ASYN) 163 161 hysdn_addlog(card, "async tx-cfg delayed"); 164 162 165 163 msleep_interruptible(20); /* Timeout 20ms */ 166 - if (!--cnt) { 167 - spin_unlock_irqrestore(&card->hysdn_lock, flags); 164 + if (!--cnt) 168 165 return (-ERR_ASYNC_TIME); /* timed out */ 169 - } 170 - cli(); 171 166 } /* wait for buffer to become free */ 172 167 168 + spin_lock_irqsave(&card->hysdn_lock, flags); 173 169 strcpy(card->async_data, line); 174 170 card->async_len = strlen(line) + 1; 175 171 card->async_channel = chan; ··· 173 177 174 178 /* now queue the task */ 175 179 schedule_work(&card->irq_queue); 176 - sti(); 180 + spin_unlock_irqrestore(&card->hysdn_lock, flags); 177 181 178 182 if (card->debug_flags & LOG_SCHED_ASYN) 179 183 hysdn_addlog(card, "async tx-cfg data queued"); 180 184 181 185 cnt++; /* short delay */ 182 - cli(); 183 186 184 187 while (card->async_busy) { 185 - sti(); 186 188 187 189 if (card->debug_flags & LOG_SCHED_ASYN) 188 190 hysdn_addlog(card, "async tx-cfg waiting for tx-ready"); 189 191 190 192 msleep_interruptible(20); /* Timeout 20ms */ 191 - if (!--cnt) { 192 - spin_unlock_irqrestore(&card->hysdn_lock, flags); 193 + if (!--cnt) 193 194 return (-ERR_ASYNC_TIME); /* timed out */ 194 - } 195 - cli(); 196 195 } /* wait for buffer to become free again */ 197 - 198 - spin_unlock_irqrestore(&card->hysdn_lock, flags); 199 196 200 197 if (card->debug_flags & LOG_SCHED_ASYN) 201 198 hysdn_addlog(card, "async tx-cfg data send");