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