Skip to contentSkip to conversation

initio: remove obsolete APIs, cleanup

PATCH New Christoph Hellwig 1 participant 1 message Sep 29, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initio: remove obsolete APIs, cleanup

This patch has the usual cleanups for the initio driver:

- remove scsi.h APIs
- add missing statics
- remove the trivial internal queuing for the srb allocation failure case

but while doing that I noticed that the two source files use completely different headers, and the interface between the two files often casted to generic types just to cast it back to a separate defintion of the same type again. In one case the structures were even mismatching, but because we allocated the bigger defintion and only passed pointers around it actually worked..

Thanks to Rodrigo Severo for testing this patch.

drivers/scsi/i91uscsi.c +14 -16
@@ -1,5 +1,4 @@
 /**************************************************************************
- * Initio 9100 device driver for Linux.
  *
  * Copyright (c) 1994-1998 Initio Corporation
  * Copyright (c) 1998 Bas Vermeulen <[email protected]>
@@ -84,6 +83,8 @@
 #include <linux/blkdev.h>
 #include <asm/io.h>
 
+#include <scsi/scsi.h>
+
 #include "i91uscsi.h"
 
 /*--- external functions --*/
@@ -499,7 +500,7 @@
 		if (i91u_adpt[i].ADPT_BIOS == wBIOS) {
 			if (i91u_adpt[i].ADPT_BASE == wBASE) {
 				if (i91u_adpt[i].ADPT_Bus != 0xFF)
-					return (FAILURE);
+					return 1;
 			} else if (i91u_adpt[i].ADPT_BASE < wBASE)
 					continue;
 		}
@@ -515,9 +516,9 @@
 		i91u_adpt[i].ADPT_BIOS = wBIOS;
 		i91u_adpt[i].ADPT_Bus = bBus;
 		i91u_adpt[i].ADPT_Device = bDevice;
-		return (SUCCESSFUL);
+		return 0;
 	}
-	return (FAILURE);
+	return 1;
 }
 
 void init_i91uAdapter_table(void)
@@ -977,7 +978,7 @@
 }
 
 /***************************************************************************/
-int tul_abort_srb(HCS * pCurHcb, ULONG srbp)
+int tul_abort_srb(HCS * pCurHcb, struct scsi_cmnd *srbp)
 {
 	ULONG flags;
 	SCB *pTmpScb, *pPrevScb;
@@ -1004,7 +1005,7 @@
 	pPrevScb = pTmpScb = pCurHcb->HCS_FirstPend;	/* Check Pend queue */
 	while (pTmpScb != NULL) {
 		/* 07/27/98 */
-		if (pTmpScb->SCB_Srb == (unsigned char *) srbp) {
+		if (pTmpScb->SCB_Srb == srbp) {
 			if (pTmpScb == pCurHcb->HCS_ActScb) {
 				spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
 				return SCSI_ABORT_BUSY;
@@ -1030,7 +1031,7 @@
 	pPrevScb = pTmpScb = pCurHcb->HCS_FirstBusy;	/* Check Busy queue */
 	while (pTmpScb != NULL) {
 
-		if (pTmpScb->SCB_Srb == (unsigned char *) srbp) {
+		if (pTmpScb->SCB_Srb == srbp) {
 
 			if (pTmpScb == pCurHcb->HCS_ActScb) {
 				spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
@@ -1087,7 +1088,8 @@
 }
 
 /************************************************************************/
-int tul_device_reset(HCS * pCurHcb, ULONG pSrb, unsigned int target, unsigned int ResetFlags)
+int tul_device_reset(HCS * pCurHcb, struct scsi_cmnd *pSrb,
+		unsigned int target, unsigned int ResetFlags)
 {
 	ULONG flags;
 	SCB *pScb;
@@ -1114,7 +1116,7 @@
 		}
 		pScb = pCurHcb->HCS_FirstBusy;	/* Check Busy queue */
 		while (pScb != NULL) {
-			if (pScb->SCB_Srb == (unsigned char *) pSrb)
+			if (pScb->SCB_Srb == pSrb)
 				break;
 			pScb = pScb->SCB_NxtScb;
 		}
@@ -1136,7 +1138,7 @@
 
 	pScb->SCB_Srb = 0;
 	if (ResetFlags & SCSI_RESET_SYNCHRONOUS) {
-		pScb->SCB_Srb = (unsigned char *) pSrb;
+		pScb->SCB_Srb = pSrb;
 	}
 	tul_push_pend_scb(pCurHcb, pScb);	/* push this SCB to Pending queue */
 
@@ -1251,7 +1253,7 @@
 		tulip_scsi(pCurHcb);	/* Call tulip_scsi              */
 
 		while ((pCurScb = tul_find_done_scb(pCurHcb)) != NULL) {	/* find done entry */
-			if (pCurScb->SCB_TaStat == QUEUE_FULL) {
+			if (pCurScb->SCB_TaStat == INI_QUEUE_FULL) {
 				pCurHcb->HCS_MaxTags[pCurScb->SCB_Target] =
 				    pCurHcb->HCS_ActTags[pCurScb->SCB_Target] - 1;
 				pCurScb->SCB_TaStat = 0;
@@ -1409,11 +1411,7 @@
 			}
 		}
 	} else if (pCurScb->SCB_Opcode == AbortCmd) {
-		ULONG srbp;
-
-		srbp = (ULONG) pCurScb->SCB_Srb;
-/* 08/03/98 */
-		if (tul_abort_srb(pCurHcb, srbp) != 0) {
+		if (tul_abort_srb(pCurHcb, pCurScb->SCB_Srb) != 0) {
 
 
 			tul_unlink_pend_scb(pCurHcb, pCurScb);

===== drivers/scsi/i91uscsi.h 1.5 vs edited =====

drivers/scsi/i91uscsi.h +23 -127

196 lines not on this page · raw message

drivers/scsi/ini9100u.c +67 -190

390 lines not on this page · raw message

===== drivers/scsi/ini9100u.h 1.12 vs edited =====

drivers/scsi/ini9100u.h +0 -251

251 lines not on this page · raw message