patch-2.4.0-test12 linux/drivers/char/stallion.c

Next file: linux/drivers/char/sx.h
Previous file: linux/drivers/char/specialix.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test11/linux/drivers/char/stallion.c linux/drivers/char/stallion.c
@@ -2231,11 +2231,11 @@
 #endif
 
 	if (portp == (stlport_t *) NULL)
-		return;
+		goto out;
 
 	tty = portp->tty;
 	if (tty == (struct tty_struct *) NULL)
-		return;
+		goto out;
 
 	lock_kernel();
 	if (test_bit(ASYI_TXLOW, &portp->istate)) {
@@ -2254,12 +2254,14 @@
 			if (portp->flags & ASYNC_CHECK_CD) {
 				if (! ((portp->flags & ASYNC_CALLOUT_ACTIVE) &&
 				    (portp->flags & ASYNC_CALLOUT_NOHUP))) {
-					tty_hangup(tty);
+					tty_hangup(tty);	/* FIXME: module removal race here - AKPM */
 				}
 			}
 		}
 	}
 	unlock_kernel();
+out:
+	MOD_DEC_USE_COUNT;
 }
 
 /*****************************************************************************/
@@ -4108,7 +4110,9 @@
 	if ((len == 0) || ((len < STL_TXBUFLOW) &&
 	    (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
 		set_bit(ASYI_TXLOW, &portp->istate);
-		queue_task(&portp->tqueue, &tq_scheduler);
+		MOD_INC_USE_COUNT;
+		if (schedule_task(&portp->tqueue) == 0)
+			MOD_DEC_USE_COUNT;
 	}
 
 	if (len == 0) {
@@ -4288,7 +4292,9 @@
 	misr = inb(ioaddr + EREG_DATA);
 	if (misr & MISR_DCD) {
 		set_bit(ASYI_DCDCHANGE, &portp->istate);
-		queue_task(&portp->tqueue, &tq_scheduler);
+		MOD_INC_USE_COUNT;
+		if (schedule_task(&portp->tqueue) == 0)
+			MOD_DEC_USE_COUNT;
 		portp->stats.modem++;
 	}
 
@@ -5085,7 +5091,9 @@
 	if ((len == 0) || ((len < STL_TXBUFLOW) &&
 	    (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
 		set_bit(ASYI_TXLOW, &portp->istate);
-		queue_task(&portp->tqueue, &tq_scheduler);
+		MOD_INC_USE_COUNT;
+		if (schedule_task(&portp->tqueue) == 0)
+			MOD_DEC_USE_COUNT;
 	}
 
 	if (len == 0) {
@@ -5302,7 +5310,9 @@
 		ipr = stl_sc26198getreg(portp, IPR);
 		if (ipr & IPR_DCDCHANGE) {
 			set_bit(ASYI_DCDCHANGE, &portp->istate);
-			queue_task(&portp->tqueue, &tq_scheduler);
+			MOD_INC_USE_COUNT;
+			if (schedule_task(&portp->tqueue) == 0)
+				MOD_DEC_USE_COUNT;
 			portp->stats.modem++;
 		}
 		break;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)