Skip to contentSkip to conversation

computone: replace cli()/sti() with

PATCH New [email protected] 1 participant 1 message Dec 16, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 computone: replace cli()/sti() with

This is an attempt to make the ip2 driver SMP-correct.

Compile tested.

drivers/char/ip2main.c +8 -6
diff -urN --exclude='*~' linux-2.6.10-rc3-original/drivers/char/ip2main.c linux-2.6.10-rc3/drivers/char/ip2main.c
@@ -221,6 +221,8 @@
 /* Static Data */
 /***************/
 
+static spinlock_t ip2_lock = SPIN_LOCK_UNLOCKED;
+
 static struct tty_driver *ip2_tty_driver;
 
 /* Here, then is a table of board pointers which the interrupt routine should
@@ -2206,9 +2208,9 @@
 	 * for masking). Caller should use TIOCGICOUNT to see which one it was
 	 */
 	case TIOCMIWAIT:
-		save_flags(flags);cli();
+		spin_lock_irqsave(&ip2_lock, flags);
 		cprev = pCh->icount;	 /* note the counters on entry */
-		restore_flags(flags);
+		spin_unlock_irqrestore(&ip2_lock, flags);
 		i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4, 
 						CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP);
 		init_waitqueue_entry(&wait, current);
@@ -2228,9 +2230,9 @@
 				rc = -ERESTARTSYS;
 				break;
 			}
-			save_flags(flags);cli();
+			spin_lock_irqsave(&ip2_lock, flags);
 			cnow = pCh->icount; /* atomic copy */
-			restore_flags(flags);
+			spin_unlock_irqrestore(&ip2_lock, flags);
 			if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
 				cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
 				rc =  -EIO; /* no change => rc */
@@ -2268,9 +2270,9 @@
 	case TIOCGICOUNT:
 		ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
 
-		save_flags(flags);cli();
+		spin_lock_irqsave(&ip2_lock, flags);
 		cnow = pCh->icount;
-		restore_flags(flags);
+		spin_unlock_irqrestore(&ip2_lock, flags);
 		p_cuser = argp;
 		rc = put_user(cnow.cts, &p_cuser->cts);
 		rc = put_user(cnow.dsr, &p_cuser->dsr);
drivers/char/Kconfig +1 -1
diff -urN --exclude='*~' linux-2.6.10-rc3-original/drivers/char/Kconfig linux-2.6.10-rc3/drivers/char/Kconfig
@@ -80,7 +80,7 @@
 
 config COMPUTONE
 	tristate "Computone IntelliPort Plus serial support"
-	depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP
+	depends on SERIAL_NONSTANDARD
 	---help---
 	  This driver supports the entire family of Intelliport II/Plus
 	  controllers with the exception of the MicroChannel controllers and

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors