patch-2.4.15 linux/drivers/scsi/i60uscsi.c

Next file: linux/drivers/scsi/i60uscsi.h
Previous file: linux/drivers/scsi/gdth.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/drivers/scsi/i60uscsi.c linux/drivers/scsi/i60uscsi.c
@@ -68,10 +68,6 @@
  * 08/08/99 bv - v1.02c Use waitForPause again.
  **************************************************************************/
 
-#ifndef CVT_LINUX_VERSION
-#define CVT_LINUX_VERSION(V,P,S)        (V * 65536 + P * 256 + S)
-#endif
-
 #include <linux/version.h>
 #include <linux/sched.h>
 #include <asm/io.h>
@@ -161,12 +157,8 @@
 static void waitForPause(unsigned amount)
 {
 	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
-
-#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
-	while (time_before_eq(jiffies, the_time));
-#else
-	while (jiffies < the_time);
-#endif
+	while (time_before_eq(jiffies, the_time))
+		cpu_relax();
 }
 
 /***************************************************************************/
@@ -564,33 +556,16 @@
 {				/* I need Host Control Block Information */
 	ULONG flags;
 
-#if 0
-	printk("inia100: enter inia100_reset\n");
-#endif
-
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	save_flags(flags);
-	cli();
-#else
 	spin_lock_irqsave(&(pHCB->BitAllocFlagLock), flags);
-#endif
 
 	initAFlag(pHCB);
 	/* reset scsi bus */
 	ORC_WR(pHCB->HCS_Base + ORC_HCTRL, SCSIRST);
 	if (waitSCSIRSTdone(pHCB) == FALSE) {
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-		restore_flags(flags);
-#else
 		spin_unlock_irqrestore(&(pHCB->BitAllocFlagLock), flags);
-#endif
 		return (SCSI_RESET_ERROR);
 	} else {
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-		restore_flags(flags);
-#else
 		spin_unlock_irqrestore(&(pHCB->BitAllocFlagLock), flags);
-#endif
 		return (SCSI_RESET_SUCCESS);
 	}
 }
@@ -611,16 +586,7 @@
 	UCHAR i;
 	ULONG flags;
 
-#if 0
-	printk("inia100: enter inia100_reset\n");
-#endif
-
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	save_flags(flags);
-	cli();
-#else
 	spin_lock_irqsave(&(pHCB->BitAllocFlagLock), flags);
-#endif
 	pScb = (ORC_SCB *) NULL;
 	pVirEscb = (ESCB *) NULL;
 
@@ -638,19 +604,11 @@
 
 	if (i == orc_num_scb) {
 		printk("Unable to Reset - No SCB Found\n");
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-		restore_flags(flags);
-#else
 		spin_unlock_irqrestore(&(pHCB->BitAllocFlagLock), flags);
-#endif
 		return (SCSI_RESET_NOT_RUNNING);
 	}
 	if ((pScb = orc_alloc_scb(pHCB)) == NULL) {
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-		restore_flags(flags);
-#else
 		spin_unlock_irqrestore(&(pHCB->BitAllocFlagLock), flags);
-#endif
 		return (SCSI_RESET_NOT_RUNNING);
 	}
 	pScb->SCB_Opcode = ORC_BUSDEVRST;
@@ -669,17 +627,13 @@
 		pVirEscb->SCB_Srb = (unsigned char *) SCpnt;
 	}
 	orc_exec_scb(pHCB, pScb);	/* Start execute SCB            */
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	restore_flags(flags);
-#else
 	spin_unlock_irqrestore(&(pHCB->BitAllocFlagLock), flags);
-#endif
 	return SCSI_RESET_PENDING;
 }
 
 
 /***************************************************************************/
-ORC_SCB *orc_alloc_scb(ORC_HCS * hcsp)
+ORC_SCB *__orc_alloc_scb(ORC_HCS * hcsp)
 {
 	ORC_SCB *pTmpScb;
 	UCHAR Ch;
@@ -688,12 +642,6 @@
 	UCHAR i;
 	ULONG flags;
 
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	save_flags(flags);
-	cli();
-#else
-	spin_lock_irqsave(&(hcsp->BitAllocFlagLock), flags);
-#endif
 	Ch = hcsp->HCS_Index;
 	for (i = 0; i < 8; i++) {
 		for (index = 0; index < 32; index++) {
@@ -704,21 +652,22 @@
 		}
 		idx = index + 32 * i;
 		pTmpScb = (PVOID) ((ULONG) hcsp->HCS_virScbArray + (idx * sizeof(ORC_SCB)));
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-		restore_flags(flags);
-#else
-		spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 		return (pTmpScb);
 	}
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	restore_flags(flags);
-#else
-	spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 	return (NULL);
 }
 
+ORC_SCB *orc_alloc_scb(ORC_HCS * hcsp)
+{
+	ORC_SCB *pTmpScb;
+	ULONG flags;
+
+	spin_lock_irqsave(&(hcsp->BitAllocFlagLock), flags);
+	pTmpScb = __orc_alloc_scb(hcsp);
+	spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
+	return (pTmpScb);
+}
+
 
 /***************************************************************************/
 void orc_release_scb(ORC_HCS * hcsp, ORC_SCB * scbp)
@@ -728,22 +677,13 @@
 	UCHAR i;
 	UCHAR Ch;
 
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	save_flags(flags);
-	cli();
-#else
 	spin_lock_irqsave(&(hcsp->BitAllocFlagLock), flags);
-#endif
 	Ch = hcsp->HCS_Index;
 	Index = scbp->SCB_ScbIdx;
 	i = Index / 32;
 	Index %= 32;
 	hcsp->BitAllocFlag[Ch][i] |= (1 << Index);
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	restore_flags(flags);
-#else
 	spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 }
 
 
@@ -872,15 +812,7 @@
 	UCHAR i;
 	ULONG flags;
 
-#if 0
-	printk("inia100: abort SRB \n");
-#endif
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	save_flags(flags);
-	cli();
-#else
 	spin_lock_irqsave(&(hcsp->BitAllocFlagLock), flags);
-#endif
 
 	pVirScb = (ORC_SCB *) hcsp->HCS_virScbArray;
 
@@ -888,37 +820,21 @@
 		pVirEscb = pVirScb->SCB_EScb;
 		if ((pVirScb->SCB_Status) && (pVirEscb->SCB_Srb == (unsigned char *) SCpnt)) {
 			if (pVirScb->SCB_TagMsg == 0) {
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-				restore_flags(flags);
-#else
 				spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 				return (SCSI_ABORT_BUSY);
 			} else {
 				if (abort_SCB(hcsp, pVirScb)) {
 					pVirEscb->SCB_Srb = NULL;
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-					restore_flags(flags);
-#else
 					spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 					return (SCSI_ABORT_SUCCESS);
 				} else {
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-					restore_flags(flags);
-#else
 					spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 					return (SCSI_ABORT_NOT_RUNNING);
 				}
 			}
 		}
 	}
-#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,1,95)
-	restore_flags(flags);
-#else
 	spin_unlock_irqrestore(&(hcsp->BitAllocFlagLock), flags);
-#endif
 	return (SCSI_ABORT_NOT_RUNNING);
 }
 

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