patch-2.3.99-pre6 linux/drivers/char/ip2/i2lib.c

Next file: linux/drivers/char/ip2/i2lib.h
Previous file: linux/drivers/char/ip2/i2ellis.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/char/ip2/i2lib.c linux/drivers/char/ip2/i2lib.c
@@ -1086,7 +1086,7 @@
 
 			// Move the data
 			if ( user ) {
-				rc=copy_from_user((char*)(DATA_OF(pInsert)), pSource,
+				COPY_FROM_USER(rc, (char*)(DATA_OF(pInsert)), pSource,
 						amountToMove );
 			} else {
 				memcpy( (char*)(DATA_OF(pInsert)), pSource, amountToMove );
@@ -1516,8 +1516,8 @@
 				return;     /* Bail out ASAP */
 			}
 			// Channel is illegally big ?
-			if (channel >= pB->i2eChannelCnt ||
-				(pCh = (((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])) == NULL)
+			if ((channel >= pB->i2eChannelCnt) ||
+				(NULL==(pCh = ((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])))
 			{
 				iiReadBuf(pB, junkBuffer, count);
 				WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
@@ -1541,7 +1541,8 @@
 
 			// Normal data! We crudely assume there is room for the data in our
 			// buffer because the board wouldn't have exceeded his credit limit.
-			WRITE_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,cflags);// We have 2 locks now
+			WRITE_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,cflags);
+													// We have 2 locks now
 			stuffIndex = pCh->Ibuf_stuff;
 			amountToRead = IBUF_SIZE - stuffIndex;
 			if (amountToRead > count)
@@ -1552,6 +1553,7 @@
 			// one.
 
 			iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead);
+			pCh->icount.rx += amountToRead;
 
 			// Update the stuffIndex by the amount of data moved. Note we could
 			// never ask for more data than would just fit. However, we might
@@ -1576,6 +1578,7 @@
 			if (count > amountToRead) {
 				amountToRead = count - amountToRead;
 				iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead);
+				pCh->icount.rx += amountToRead;
 				stuffIndex += amountToRead;
 			}
 
@@ -1632,7 +1635,7 @@
 						if ( !(pCh->dataSetIn & I2_CTS) )
 						{
 							pCh->dataSetIn |= I2_DCTS;
-							++pCh->icount.cts;
+							pCh->icount.cts++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn |= I2_CTS;
@@ -1642,7 +1645,7 @@
 						if ( pCh->dataSetIn & I2_CTS )
 						{
 							pCh->dataSetIn |= I2_DCTS;
-							++pCh->icount.cts;
+							pCh->icount.cts++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn &= ~I2_CTS;
@@ -1658,7 +1661,7 @@
 							ip2trace (CHANN, ITRC_MODEM, 2, 0 );
 #endif
 							pCh->dataSetIn |= I2_DDCD;
-							++pCh->icount.dcd;
+							pCh->icount.dcd++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn |= I2_DCD;
@@ -1677,7 +1680,7 @@
 							ip2trace (channel, ITRC_MODEM, 5, 0 );
 #endif
 							pCh->dataSetIn |= I2_DDCD;
-							++pCh->icount.dcd;
+							pCh->icount.dcd++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn &= ~I2_DCD;
@@ -1690,7 +1693,7 @@
 						if ( !(pCh->dataSetIn & I2_DSR) )
 						{
 							pCh->dataSetIn |= I2_DDSR;
-							++pCh->icount.dsr;
+							pCh->icount.dsr++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn |= I2_DSR;
@@ -1700,7 +1703,7 @@
 						if ( pCh->dataSetIn & I2_DSR )
 						{
 							pCh->dataSetIn |= I2_DDSR;
-							++pCh->icount.dsr;
+							pCh->icount.dsr++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn &= ~I2_DSR;
@@ -1710,23 +1713,26 @@
 						if ( !(pCh->dataSetIn & I2_RI) )
 						{
 							pCh->dataSetIn |= I2_DRI;
-							++pCh->icount.rng;
+							pCh->icount.rng++;
 							dss_change = 1;
 						}
 						pCh->dataSetIn |= I2_RI ;
 						break;
 
 					case STAT_RI_DN:
-						if ( pCh->dataSetIn & I2_RI )
-						{
-							pCh->dataSetIn |= I2_DRI;
-							dss_change = 1;
-						}
+						// to be compat with serial.c
+						//if ( pCh->dataSetIn & I2_RI )
+						//{
+						//	pCh->dataSetIn |= I2_DRI;
+						//	pCh->icount.rng++; 
+						//	dss_change = 1;
+						//}
 						pCh->dataSetIn &= ~I2_RI ;
 						break;
 
 					case STAT_BRK_DET:
 						pCh->dataSetIn |= I2_BRK;
+						pCh->icount.brk++;
 						dss_change = 1;
 						break;
 
@@ -1791,9 +1797,6 @@
 					case STAT_BOXIDS:
 						pB->channelBtypes = *((bidStatPtr)pc);
 						pc += sizeof(bidStat);
-//printk("boxids: %x %x %x %x\n",
-//	pB->channelBtypes.bid_value[0],pB->channelBtypes.bid_value[1],
-//	pB->channelBtypes.bid_value[2],pB->channelBtypes.bid_value[3]);
 						set_baud_params(pB);
 						break;
 
@@ -1810,18 +1813,26 @@
 						switch (uc & STAT_MOD_ERROR)
 						{
 						case STAT_ERROR:
-							if (uc & STAT_E_PARITY) 
+							if (uc & STAT_E_PARITY) {
 								pCh->dataSetIn |= I2_PAR;
-							if (uc & STAT_E_FRAMING) 
+								pCh->icount.parity++;
+							}
+							if (uc & STAT_E_FRAMING){
 								pCh->dataSetIn |= I2_FRA;
-							if (uc & STAT_E_OVERRUN) 
+								pCh->icount.frame++;
+							}
+							if (uc & STAT_E_OVERRUN){
 								pCh->dataSetIn |= I2_OVR;
+								pCh->icount.overrun++;
+							}
 							break;
 
 						case STAT_MODEM:
+							// the answer to DSS_NOW request (not change)
 							pCh->dataSetIn = (pCh->dataSetIn
 								& ~(I2_RI | I2_CTS | I2_DCD | I2_DSR) )
 								| xlatDss[uc & 0xf];
+							wake_up_interruptible ( &pCh->dss_now_wait );
 						default:
 							break;
 						}
@@ -1846,16 +1857,6 @@
 						pc += 4;    /* Skip the data */
 						break;
 
-					case STAT_CTS_UP:
-					case STAT_CTS_DN:
-					case STAT_DCD_UP:
-					case STAT_DCD_DN:
-					case STAT_DSR_UP:
-					case STAT_DSR_DN:
-					case STAT_RI_UP:
-					case STAT_RI_DN:
-					case STAT_BRK_DET:
-					case STAT_BMARK:
 					default:
 						break;
 					}
@@ -2102,6 +2103,7 @@
 #endif /* DEBUG_FIFO */
 			pB->debugInlineCount++;
 
+			pCh->icount.tx += flowsize;
 			// Update current credits
 			pCh->outfl.room -= flowsize;
 			pCh->outfl.asof += flowsize;

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