]> git.pld-linux.org Git - packages/kernel.git/blob - linux-2.4.7-DAC960-completion.patch
- added description of djurban's branch
[packages/kernel.git] / linux-2.4.7-DAC960-completion.patch
1 Hi!
2
3 Linus' decision to replace "DECLARE_MUTEX_LOCKED" by "DECLARE_COMPLETION"
4 apparently hasn't reached the DAC960 driver. This patch fixes that. This means
5 the driver now compiles. I don't have the hardware, so I can't tell if the
6 driver actually works.
7
8 Rolf
9
10 --- linux/drivers/block/DAC960.h.dac960 Wed Feb 21 06:26:22 2001
11 +++ linux/drivers/block/DAC960.h        Sat Jul 21 10:54:04 2001
12 @@ -2153,7 +2153,7 @@
13  typedef struct pt_regs Registers_T;
14  typedef struct request IO_Request_T;
15  typedef request_queue_t RequestQueue_T;
16 -typedef struct semaphore Semaphore_T;
17 +typedef struct completion Wait_T;
18  typedef struct super_block SuperBlock_T;
19  typedef struct timer_list Timer_T;
20  typedef wait_queue_head_t WaitQueue_T;
21 @@ -2220,7 +2220,7 @@
22    DAC960_CommandType_T CommandType;
23    struct DAC960_Controller *Controller;
24    struct DAC960_Command *Next;
25 -  Semaphore_T *Semaphore;
26 +  Wait_T *Wait;
27    unsigned int LogicalDriveNumber;
28    unsigned int BlockNumber;
29    unsigned int BlockCount;
30 --- linux/drivers/block/DAC960.c.dac960 Sun May 27 14:12:55 2001
31 +++ linux/drivers/block/DAC960.c        Sat Jul 21 11:02:28 2001
32 @@ -40,6 +40,7 @@
33  #include <linux/spinlock.h>
34  #include <linux/timer.h>
35  #include <linux/pci.h>
36 +#include <linux/completion.h>
37  #include <asm/io.h>
38  #include <asm/segment.h>
39  #include <asm/uaccess.h>
40 @@ -484,14 +485,14 @@
41  static void DAC960_ExecuteCommand(DAC960_Command_T *Command)
42  {
43    DAC960_Controller_T *Controller = Command->Controller;
44 -  DECLARE_MUTEX_LOCKED(Semaphore);
45 +  DECLARE_COMPLETION(Wait);
46    unsigned long ProcessorFlags;
47 -  Command->Semaphore = &Semaphore;
48 +  Command->Wait = &Wait;
49    DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
50    DAC960_QueueCommand(Command);
51    DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
52    if (in_interrupt()) return;
53 -  down(&Semaphore);
54 +  wait_for_completion(&Wait);
55  }
56  
57  
58 @@ -1316,7 +1317,7 @@
59                                                  *Controller)
60  {
61    DAC960_V1_DCDB_T DCDBs[DAC960_V1_MaxChannels], *DCDB;
62 -  Semaphore_T Semaphores[DAC960_V1_MaxChannels], *Semaphore;
63 +  Wait_T Waits[DAC960_V1_MaxChannels], *Wait;
64    unsigned long ProcessorFlags;
65    int Channel, TargetID;
66    for (TargetID = 0; TargetID < Controller->Targets; TargetID++)
67 @@ -1327,12 +1328,12 @@
68           DAC960_SCSI_Inquiry_T *InquiryStandardData =
69             &Controller->V1.InquiryStandardData[Channel][TargetID];
70           InquiryStandardData->PeripheralDeviceType = 0x1F;
71 -         Semaphore = &Semaphores[Channel];
72 -         init_MUTEX_LOCKED(Semaphore);
73 +         Wait = &Waits[Channel];
74 +         init_completion(Wait);
75           DCDB = &DCDBs[Channel];
76           DAC960_V1_ClearCommand(Command);
77           Command->CommandType = DAC960_ImmediateCommand;
78 -         Command->Semaphore = Semaphore;
79 +         Command->Wait = Wait;
80           Command->V1.CommandMailbox.Type3.CommandOpcode = DAC960_V1_DCDB;
81           Command->V1.CommandMailbox.Type3.BusAddress = Virtual_to_Bus32(DCDB);
82           DCDB->Channel = Channel;
83 @@ -1363,11 +1364,11 @@
84           DAC960_SCSI_Inquiry_UnitSerialNumber_T *InquiryUnitSerialNumber =
85             &Controller->V1.InquiryUnitSerialNumber[Channel][TargetID];
86           InquiryUnitSerialNumber->PeripheralDeviceType = 0x1F;
87 -         Semaphore = &Semaphores[Channel];
88 -         down(Semaphore);
89 +         Wait = &Waits[Channel];
90 +         wait_for_completion(Wait);
91           if (Command->V1.CommandStatus != DAC960_V1_NormalCompletion)
92             continue;
93 -         Command->Semaphore = Semaphore;
94 +         Command->Wait = Wait;
95           DCDB = &DCDBs[Channel];
96           DCDB->TransferLength = sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T);
97           DCDB->BusAddress = Virtual_to_Bus32(InquiryUnitSerialNumber);
98 @@ -1381,7 +1382,7 @@
99           DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
100           DAC960_QueueCommand(Command);
101           DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
102 -         down(Semaphore);
103 +         wait_for_completion(Wait);
104         }
105      }
106    return true;
107 @@ -2768,7 +2769,7 @@
108    if (Request->cmd == READ)
109      Command->CommandType = DAC960_ReadCommand;
110    else Command->CommandType = DAC960_WriteCommand;
111 -  Command->Semaphore = Request->sem;
112 +  Command->Wait = Request->waiting;
113    Command->LogicalDriveNumber = DAC960_LogicalDriveNumber(Request->rq_dev);
114    Command->BlockNumber =
115      Request->sector
116 @@ -2924,10 +2925,10 @@
117           /*
118             Wake up requestor for swap file paging requests.
119           */
120 -         if (Command->Semaphore != NULL)
121 +         if (Command->Wait != NULL)
122             {
123 -             up(Command->Semaphore);
124 -             Command->Semaphore = NULL;
125 +             complete(Command->Wait);
126 +             Command->Wait = NULL;
127             }
128           add_blkdev_randomness(DAC960_MAJOR + Controller->ControllerNumber);
129         }
130 @@ -2972,10 +2973,10 @@
131           /*
132             Wake up requestor for swap file paging requests.
133           */
134 -         if (Command->Semaphore != NULL)
135 +         if (Command->Wait != NULL)
136             {
137 -             up(Command->Semaphore);
138 -             Command->Semaphore = NULL;
139 +             complete(Command->Wait);
140 +             Command->Wait = NULL;
141             }
142         }
143      }
144 @@ -3589,8 +3590,8 @@
145      }
146    if (CommandType == DAC960_ImmediateCommand)
147      {
148 -      up(Command->Semaphore);
149 -      Command->Semaphore = NULL;
150 +      complete(Command->Wait);
151 +      Command->Wait = NULL;
152        return;
153      }
154    if (CommandType == DAC960_QueuedCommand)
155 @@ -3934,10 +3935,10 @@
156           /*
157             Wake up requestor for swap file paging requests.
158           */
159 -         if (Command->Semaphore != NULL)
160 +         if (Command->Wait != NULL)
161             {
162 -             up(Command->Semaphore);
163 -             Command->Semaphore = NULL;
164 +             complete(Command->Wait);
165 +             Command->Wait = NULL;
166             }
167           add_blkdev_randomness(DAC960_MAJOR + Controller->ControllerNumber);
168         }
169 @@ -3982,10 +3983,10 @@
170           /*
171             Wake up requestor for swap file paging requests.
172           */
173 -         if (Command->Semaphore != NULL)
174 +         if (Command->Wait != NULL)
175             {
176 -             up(Command->Semaphore);
177 -             Command->Semaphore = NULL;
178 +             complete(Command->Wait);
179 +             Command->Wait = NULL;
180             }
181         }
182      }
183 @@ -4539,8 +4540,8 @@
184      }
185    if (CommandType == DAC960_ImmediateCommand)
186      {
187 -      up(Command->Semaphore);
188 -      Command->Semaphore = NULL;
189 +      complete(Command->Wait);
190 +      Command->Wait = NULL;
191        return;
192      }
193    if (CommandType == DAC960_QueuedCommand)
194 -
195 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
196 the body of a message to majordomo@vger.kernel.org
197 More majordomo info at  http://vger.kernel.org/majordomo-info.html
198 Please read the FAQ at  http://www.tux.org/lkml/
This page took 0.27572 seconds and 3 git commands to generate.