Skip to contentSkip to conversation

fixes compile errors in cpqfcTS driver

PATCH Superseded Mike Christie 3 participants 3 messages Apr 21, 2003 – Apr 22, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixes compile errors in cpqfcTS driver

The attached patch fixes the compile errors in the cpqfcTS driver caused by changes in Scsi_Cmnd described in Bugzilla bug #346 at http://bugme.osdl.org/show_bug.cgi?id=346. It was built against 2.5.68. I do not have the hardware, so I have only verified that it compiles correctly.

Mike Christie
[email protected]

cpqfcTSinit.c | 6 ++++--
cpqfcTSworker.c | 44 ++++++++++++++++++++++----------------------

2 files changed, 26 insertions(+), 24 deletions(-)
drivers/scsi/cpqfcTSinit.c +4 -2
diff -puNr linux-2.5.68-orig/drivers/scsi/cpqfcTSinit.c linux-2.5.68/drivers/scsi/cpqfcTSinit.c
@@ -931,6 +931,7 @@ int cpqfcTS_proc_info (char *buffer, cha
 {
   struct Scsi_Host *host;
   Scsi_Cmnd DumCmnd;
+  Scsi_Device DumSdev;
   int Chan, Targ, i;
   struct info_str info;
   CPQFCHBA *cpqfcHBA;
@@ -963,11 +964,12 @@ int cpqfcTS_proc_info (char *buffer, cha
 
 #define DISPLAY_WWN_INFO
 #ifdef DISPLAY_WWN_INFO
+  DumCmnd.device = &DumSdev;
   copy_info(&info, "WWN database: (\"port_id: 000000\" means disconnected)\n");
   for ( Chan=0; Chan <= host->max_channel; Chan++) {
-    DumCmnd.channel = Chan;
+    DumCmnd.device->channel = Chan;
     for (Targ=0; Targ <= host->max_id; Targ++) {
-      DumCmnd.target = Targ;
+      DumCmnd.device->id = Targ;
       if ((pLoggedInPort = fcFindLoggedInPort( fcChip,
 	    			&DumCmnd, // search Scsi Nexus
     				0,        // DON'T search list for FC port id
drivers/scsi/cpqfcTSworker.c +22 -22

112 lines not on this page · raw message

#1 lore raw
Quoted 1 line · Mike Christie

+ Scsi_Device DumSdev;

Please use struct scsi_device in any new code.

drivers/scsi/cpqfcTSinit.c int cpqfcTS_proc_info (char *buffer, cha · line 967

Quoted 8 lines
   int Chan, Targ, i;
   struct info_str info;
   CPQFCHBA *cpqfcHBA;
drivers/scsi/cpqfcTSinit.c +1 -0
@@ -963,11 +964,12 @@ int cpqfcTS_proc_info (char *buffer, cha
 
 #define DISPLAY_WWN_INFO
 #ifdef DISPLAY_WWN_INFO
+  DumCmnd.device = &DumSdev;

I don't think the onstack command/device will work anymore. You'll have to use scsi_get_command/scsi_put_command I guess

#2 lore raw
Quoted 2 lines · Christoph Hellwig

I don't think the onstack command/device will work anymore. You'll have to use scsi_get_command/scsi_put_command I guess

Actually on stack command allocation never was legal, although we seem to have quite a few drivers that do it. The reason (aside from the fact that the stack is a precious resource in the kernel) is that struct scsi_cmnds can be used by the driver to DMA to the device and DMAable memory should never be allocated on the stack (mainly because of alignment and flushing issues that can cause memory corruption).

Unfortunately, the bugs stack allocation causes don't show up on the x86 architecture giving a driver that seems to work for the majority of users but which can cause weird hangs and crashes on non-x86 platforms.

James