linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: tech@psidisk.com, linux-kernel@vger.kernel.org
Subject: Patch?: linux-2.5.6-pre1/drivers/scsi/pci2000.c compilation fixes + pci device ID table
Date: Thu, 28 Feb 2002 07:34:46 -0800	[thread overview]
Message-ID: <20020228073446.A6541@baldur.yggdrasil.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

	The following patch is my attempt at getting
linux-2.5.6-pre1/drivers/scsi/pci2000.c to compile, and also adds
a pci_device_id table for automatic module loading.  I would
especially appreciate any input on whether I can use sg_dma_address
the way I have in this patch.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

[-- Attachment #2: pci2000.patch --]
[-- Type: text/plain, Size: 2259 bytes --]

--- linux-2.5.6-pre1/drivers/scsi/pci2000.c	Tue Feb 19 18:10:55 2002
+++ linux/drivers/scsi/pci2000.c	Thu Feb 28 07:14:00 2002
@@ -53,6 +53,7 @@
 #include "hosts.h"
 #include <linux/stat.h>
 #include <linux/spinlock.h>
+#include <linux/init.h>
 
 #include "pci2000.h"
 #include "psi_roy.h"
@@ -102,6 +103,18 @@
 #define HOSTDATA(host) ((PADAPTER2000)&host->hostdata)
 #define consistentLen (MAX_BUS * MAX_UNITS * (16 * sizeof (SCATGATH) + MAX_COMMAND_SIZE))
 
+#ifdef MODULE
+static struct pci_device_id pci2000_pci_tbl[] __initdata = {
+	{
+	  vendor: VENDOR_PSI,
+	  device: DEVICE_ROY_1,
+	  subvendor: PCI_ANY_ID,
+	  subdevice: PCI_ANY_ID,
+	},
+	{ }			/* Terminating entry */
+};
+MODULE_DEVICE_TABLE(pci, pci2000_pci_tbl);
+#endif
 
 static struct	Scsi_Host 	   *PsiHost[MAXADAPTER] = {NULL,};  // One for each adapter
 static			int				NumAdapters = 0;
@@ -337,7 +350,7 @@
 				goto irqProceed;
 			}
 		}
-	if ( SCpnt->SCp.have_data_in )
+	if ( SCpnt->SCp.have_data_in  && !SCpnt->use_sg)
 		pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, SCpnt->request_bufflen, scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
 	else 
 		{
@@ -389,7 +402,7 @@
 	OpDone (SCpnt, DID_OK << 16);
 
 irq_return:
-    spin_unlock_irqrestore(&shost->host_lock, flags);
+    spin_unlock_irqrestore(shost->host_lock, flags);
 out:;
 }
 /****************************************************************
@@ -505,8 +518,7 @@
 			
 			if ( SCpnt->use_sg )
 				{
-				SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, ((struct scatterlist *)SCpnt->request_buffer)->address, 
-										  SCpnt->request_bufflen, scsi_to_pci_dma_dir (SCpnt->sc_data_direction));
+				SCpnt->SCp.have_data_in = sg_dma_address((struct scatterlist *)SCpnt->request_buffer);
 				}
 			else
 				{
@@ -528,8 +540,7 @@
 		case SCSIOP_READ_CAPACITY:			  	// read capacity CDB
 			if ( SCpnt->use_sg )
 				{
-				SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, ((struct scatterlist *)(SCpnt->request_buffer))->address,
-										  8, PCI_DMA_FROMDEVICE);
+				SCpnt->SCp.have_data_in = sg_dma_address((struct scatterlist *)SCpnt->request_buffer);
 				}
 			else
 				SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, 8, PCI_DMA_FROMDEVICE);

                 reply	other threads:[~2002-02-28 15:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020228073446.A6541@baldur.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tech@psidisk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).