Skip to contentSkip to conversation

aacraid updates for new proing APIs

PATCH In review Christoph Hellwig 2 participants 5 messages Nov 18, 2003 – Nov 21, 2003

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

PATCH 1/1 aacraid updates for new proing APIs

Anyone interested in reviewing and testing this?

drivers/scsi/aacraid/aacraid.h +1 -5
@@ -520,10 +520,6 @@
 
 struct aac_driver_ident
 {
-	u16	vendor;
-	u16	device;
-	u16	subsystem_vendor;
-	u16	subsystem_device;
 	int 	(*init)(struct aac_dev *dev, unsigned long num);
 	char *	name;
 	char *	vname;
@@ -1483,7 +1479,7 @@
 int aac_detach(struct aac_dev *dev);
 struct aac_dev *aac_init_adapter(struct aac_dev *dev);
 int aac_get_containers(struct aac_dev *dev);
-int aac_scsi_cmd(Scsi_Cmnd *scsi_cmnd_ptr);
+int aac_scsi_cmd(struct scsi_cmnd *cmd);
 int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg);
 int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg);
 int aac_rx_init(struct aac_dev *dev, unsigned long devNumber);
drivers/scsi/aacraid/linit.c +290 -428

891 lines not on this page · raw message

===== include/linux/libata.h 1.3 vs edited =====

include/linux/libata.h +8 -7
@@ -28,6 +28,9 @@
 #include <asm/io.h>
 #include <linux/ata.h>
 
+struct scsi_device;
+
+
 /*
  * compile-time options
  */
@@ -197,7 +200,7 @@
 	struct list_head	node;
 	struct pci_dev		*pdev;
 	struct ata_port_operations	*port_ops;
-	Scsi_Host_Template	*sht;
+	struct scsi_host_template	*sht;
 	struct ata_ioports	port[ATA_MAX_PORTS];
 	unsigned int		n_ports;
 	unsigned int		pio_mask;
@@ -247,8 +250,8 @@
 	struct ata_port		*ap;
 	struct ata_device	*dev;
 
-	Scsi_Cmnd		*scsicmd;
-	void			(*scsidone)(Scsi_Cmnd *);
+	struct scsi_cmnd		*scsicmd;
+	void			(*scsidone)(struct scsi_cmnd *);
 
 	struct list_head	node;
 	unsigned long		flags;		/* ATA_QCFLAG_xxx */
@@ -377,7 +380,7 @@
 };
 
 struct ata_port_info {
-	Scsi_Host_Template	*sht;
+	struct scsi_host_template	*sht;
 	unsigned long		host_flags;
 	unsigned long		pio_mask;
 	unsigned long		udma_mask;
@@ -401,10 +404,8 @@
 			     unsigned int n_ports);
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern int ata_device_add(struct ata_probe_ent *ent);
-extern int ata_scsi_detect(Scsi_Host_Template *sht);
-extern int ata_scsi_queuecmd(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
+extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
 extern int ata_scsi_error(struct Scsi_Host *host);
-extern int ata_scsi_release(struct Scsi_Host *host);
 extern int ata_scsi_slave_config(struct scsi_device *sdev);
 /*
  * Default driver ops implementations
#1 lore raw
Quoted 1 line · Christoph Hellwig

Anyone interested in reviewing and testing this?

I tried it out on my system and it seems to be working OK. It found my controller and configured the disks. I can create a filesystem and copy files back and forth. I'll keep testing for a while and let you know if I find something.

Quoted 7 lines
drivers/scsi/aacraid/linit.c +4 -2
+static int __devinit aac_probe_one(struct pci_dev *pdev,
+		const struct pci_device_id *id)
 {
-	printk("aacraid: abort failed\n");
-	return FAILED;
+	unsigned index = id->driver_data;
+	struct Scsi_Host *shost;

drivers/scsi/aacraid/linit.c line 411

Quoted 10 lines
drivers/scsi/aacraid/linit.c +10 -0
+	struct fsa_scsi_hba *fsa_dev_ptr;
+	struct aac_dev *aac;
+	int container;
+	int error = -ENODEV;
+
+	if (pci_enable_device(pdev))
+		goto out;
+
+	pci_set_master(pdev);
+	pci_set_dma_mask(pdev, 0xFFFFFFFFULL);

I've been told that the return value of this should be checked as it is possible for it to fail.

Mark.

Signature · 1 line
Mark Haverkamp <[email protected]>
#2 lore raw
Quoted 5 lines · Mark Haverkamp

drivers/scsi/aacraid/linit.c line 411

Quoted 2 lines
drivers/scsi/aacraid/linit.c +2 -0
+	pci_set_master(pdev);
+	pci_set_dma_mask(pdev, 0xFFFFFFFFULL);

I've been told that the return value of this should be checked as it is possible for it to fail.

Indeed. This patches objective was to convert aacraid to the new-style probing, not to fix bugs, but I'll add the fix to the next revision of the patch anyway.

#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Mark Haverkamp

Review

Quoted 2 lines
(quoted diff) +2 -0
+	pci_set_master(pdev);
+	pci_set_dma_mask(pdev, 0xFFFFFFFFULL);

I've been told that the return value of this should be checked as it is possible for it to fail.

Indeed. This patches objective was to convert aacraid to the new-style probing, not to fix bugs, but I'll add the fix to the next revision of the patch anyway.

Ok here's a new patch. Updates:

- check pci_set_dma_mask return value
- fix leak in the HBA remove path
- fix leak in probe_one failure case
- remove unused list of hosts
- avoid scsi.h usage all over driver
- mention the updates in the README file

drivers/scsi/aacraid/README +2 -1
@@ -28,7 +28,8 @@
 People
 -------------------------
 Alan Cox <[email protected]>
-Christoph Hellwig <[email protected]>	(small cleanups/fixes)
+Christoph Hellwig <[email protected]>	(updates for new-style PCI probing and SCSI host registration,
+					 small cleanups/fixes)
 Matt Domsch <[email protected]>	(revision ioctl, adapter messages)
 Deanna Bonds <[email protected]> (non-DASD support, PAE fibs and 64 bit, added new adaptec controllers
 					 added new ioctls, changed scsi interface to use new error handler,

===== drivers/scsi/aacraid/aachba.c 1.20 vs edited =====

drivers/scsi/aacraid/aachba.c +38 -36

235 lines not on this page · raw message

===== drivers/scsi/aacraid/aacraid.h 1.9 vs edited =====

drivers/scsi/aacraid/aacraid.h +4 -6
@@ -520,10 +520,6 @@
 
 struct aac_driver_ident
 {
-	u16	vendor;
-	u16	device;
-	u16	subsystem_vendor;
-	u16	subsystem_device;
 	int 	(*init)(struct aac_dev *dev, unsigned long num);
 	char *	name;
 	char *	vname;
@@ -1466,6 +1462,8 @@
 	return (u32)capacity;
 }
 
+struct scsi_cmnd;
+
 const char *aac_driverinfo(struct Scsi_Host *);
 struct fib *fib_alloc(struct aac_dev *dev);
 int fib_setup(struct aac_dev *dev);
@@ -1480,10 +1478,9 @@
 void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
 int fib_complete(struct fib * context);
 #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
-int aac_detach(struct aac_dev *dev);
 struct aac_dev *aac_init_adapter(struct aac_dev *dev);
 int aac_get_containers(struct aac_dev *dev);
-int aac_scsi_cmd(Scsi_Cmnd *scsi_cmnd_ptr);
+int aac_scsi_cmd(struct scsi_cmnd *cmd);
 int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg);
 int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg);
 int aac_rx_init(struct aac_dev *dev, unsigned long devNumber);
@@ -1495,3 +1492,4 @@
 int fib_adapter_complete(struct fib * fibptr, unsigned short size);
 struct aac_driver_ident* aac_get_driver_ident(int devtype);
 int aac_get_adapter_info(struct aac_dev* dev);
+int aac_send_shutdown(struct aac_dev *dev);

===== drivers/scsi/aacraid/commctrl.c 1.3 vs edited =====

drivers/scsi/aacraid/commctrl.c +7 -9
@@ -28,7 +28,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -37,11 +36,10 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/completion.h>
+#include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
-#include "scsi.h"
-#include "hosts.h"
 
 #include "aacraid.h"
 
@@ -439,16 +437,16 @@
 	
 	switch(srbcmd->flags){
 	case SRB_DataOut:
-		data_dir = SCSI_DATA_WRITE;
+		data_dir = DMA_TO_DEVICE;
 		break;
 	case (SRB_DataIn | SRB_DataOut):
-		data_dir = SCSI_DATA_UNKNOWN;  
+		data_dir = DMA_BIDIRECTIONAL;
 		break;
 	case SRB_DataIn:
-		data_dir = SCSI_DATA_READ;
+		data_dir = DMA_FROM_DEVICE;
 		break;
 	default:
-		data_dir = SCSI_DATA_NONE;
+		data_dir = DMA_NONE;
 	}
 	if( dev->pae_support ==1 ) {
 		struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg;
@@ -484,7 +482,7 @@
 					goto cleanup;
 				}
 			}
-			addr = pci_map_single(dev->pdev, p, psg->sg[i].count, scsi_to_pci_dma_dir(data_dir));
+			addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir);
 
 			le_addr = cpu_to_le64(addr);
 			psg->sg[i].addr[1] = (u32)(le_addr>>32);
@@ -526,7 +524,7 @@
 					goto cleanup;
 				}
 			}
-			addr = pci_map_single(dev->pdev, p, psg->sg[i].count, scsi_to_pci_dma_dir(data_dir));
+			addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir);
 
 			psg->sg[i].addr = cpu_to_le32(addr);
 			psg->sg[i].count = cpu_to_le32(psg->sg[i].count);  

===== drivers/scsi/aacraid/comminit.c 1.7 vs edited =====

drivers/scsi/aacraid/comminit.c +2 -40

77 lines not on this page · raw message

===== drivers/scsi/aacraid/commsup.c 1.6 vs edited =====

drivers/scsi/aacraid/commsup.c +1 -6
@@ -3,7 +3,6 @@
  *	(c) Copyright 2001 Red Hat Inc.	<[email protected]>
  *
  * based on the old aacraid driver that is..
-
  * Adaptec aacraid device driver for Linux.
  *
  * Copyright (c) 2000 Adaptec, Inc. ([email protected])
@@ -28,10 +27,8 @@
  * Abstract: Contain all routines that are required for FSA host/adapter
  *    commuication.
  *
- *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -40,10 +37,8 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/completion.h>
-#include <asm/semaphore.h>
 #include <linux/blkdev.h>
-#include "scsi.h"
-#include "hosts.h"
+#include <asm/semaphore.h>
 
 #include "aacraid.h"
 

===== drivers/scsi/aacraid/dpcsup.c 1.4 vs edited =====

drivers/scsi/aacraid/dpcsup.c +0 -3
@@ -29,7 +29,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -40,8 +39,6 @@
 #include <linux/completion.h>
 #include <linux/blkdev.h>
 #include <asm/semaphore.h>
-#include "scsi.h"
-#include "hosts.h"
 
 #include "aacraid.h"
 

===== drivers/scsi/aacraid/linit.c 1.22 vs edited =====

drivers/scsi/aacraid/linit.c +317 -431

918 lines not on this page · raw message

===== drivers/scsi/aacraid/rx.c 1.4 vs edited =====

drivers/scsi/aacraid/rx.c +2 -3
@@ -28,7 +28,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -41,8 +40,8 @@
 #include <linux/completion.h>
 #include <linux/interrupt.h>
 #include <asm/semaphore.h>
-#include "scsi.h"
-#include "hosts.h"
+
+#include <scsi/scsi_host.h>
 
 #include "aacraid.h"
 

===== drivers/scsi/aacraid/sa.c 1.5 vs edited =====

drivers/scsi/aacraid/sa.c +2 -3
@@ -28,7 +28,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -41,8 +40,8 @@
 #include <linux/completion.h>
 #include <linux/interrupt.h>
 #include <asm/semaphore.h>
-#include "scsi.h"
-#include "hosts.h"
+
+#include <scsi/scsi_host.h>
 
 #include "aacraid.h"
 
#4 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Mark Haverkamp

Review

Quoted 2 lines
(quoted diff) +2 -0
+	pci_set_master(pdev);
+	pci_set_dma_mask(pdev, 0xFFFFFFFFULL);

I've been told that the return value of this should be checked as it is possible for it to fail.

Indeed. This patches objective was to convert aacraid to the new-style probing, not to fix bugs, but I'll add the fix to the next revision of the patch anyway.

Quoted 8 lines

Ok here's a new patch. Updates:

- check pci_set_dma_mask return value
- fix leak in the HBA remove path
- fix leak in probe_one failure case
- remove unused list of hosts
- avoid scsi.h usage all over driver
- mention the updates in the README file

I built and tried this out this morning. It seems to be working OK. One thing, though, there is warning now in:

drivers/scsi/aacraid/aachba.c: In function `aac_send_srb_fib':
drivers/scsi/aacraid/aachba.c:1409: warning: `flag' might be used uninitialized in this function

Although it seems that the compiler should notice that all the enum values are accounted for in the switch statement that sets flag.

Mark.

Quoted 1 line
Signature · 1 line
Mark Haverkamp <[email protected]>