[PATCH] DAC960: remove redundant (and uninitialized)
authorAndrew Morton <akpm@osdl.org>
Tue, 23 Sep 2003 16:44:21 +0000 (09:44 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 23 Sep 2003 16:44:21 +0000 (09:44 -0700)
From: Dave Olien <dmo@osdl.org>

this patch fixes a bug that appeared only on Alpha hardware with
DAC960 controllers.  The Command->PciDevice structure member was
never initialized.  This was passed to the pci scatter/gather functions.
This didn't cause a problem for x86 platforms because the scatter/gather
funtions never really used that information.  Alpha platforms do use
that pointer.

The Command->PciDevice field was also redundant with the Controller->PCIDevice
field, which IS initialized properly.  So, eliminating the redundant
structure member and substituting the Controller's member fixes the bug.

drivers/block/DAC960.c
drivers/block/DAC960.h

index 03f8fc2..a152273 100644 (file)
@@ -3300,7 +3300,7 @@ static boolean DAC960_ProcessRequest(DAC960_Controller_T *Controller,
   Command->SegmentCount = blk_rq_map_sg(Controller->RequestQueue,
                  Command->Request, Command->cmd_sglist);
   /* pci_map_sg MAY change the value of SegCount */
-  Command->SegmentCount = pci_map_sg(Command->PciDevice, Command->cmd_sglist,
+  Command->SegmentCount = pci_map_sg(Controller->PCIDevice, Command->cmd_sglist,
                 Command->SegmentCount, Command->DmaDirection);
 
   DAC960_QueueReadWriteCommand(Command);
@@ -3336,7 +3336,7 @@ static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
   (void)blk_rq_map_sg(Controller->RequestQueue, Command->Request,
                                         Command->cmd_sglist);
 
-  (void)pci_map_sg(Command->PciDevice, Command->cmd_sglist, 1,
+  (void)pci_map_sg(Controller->PCIDevice, Command->cmd_sglist, 1,
                                        Command->DmaDirection);
   /*
    * Resubmitting the request sector at a time is really tedious.
@@ -3377,7 +3377,7 @@ static inline boolean DAC960_ProcessCompletedRequest(DAC960_Command_T *Command,
        if (SuccessfulIO)
                UpToDate = 1;
 
-       pci_unmap_sg(Command->PciDevice, Command->cmd_sglist,
+       pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist,
                Command->SegmentCount, Command->DmaDirection);
 
         if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) {
index 28fb52a..006cbec 100644 (file)
@@ -2248,7 +2248,6 @@ typedef struct DAC960_Command
   int  DmaDirection;
   struct scatterlist *cmd_sglist;
   struct request *Request;
-  struct pci_dev *PciDevice;
   union {
     struct {
       DAC960_V1_CommandMailbox_T CommandMailbox;