diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:16 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:16 -0500 |
commit | 57d7366b78b74a9eef873e8212c03d8c2033a764 (patch) | |
tree | 5b3cefe3c08e765bf83050ddaf21e98b15f7949d /drivers/ide/ide-taskfile.c | |
parent | 1192e528e064ebb9a578219731d2b0f78ca3c1ec (diff) |
ide: remove 'handler' field from ide_task_t (take 2)
* Add IDE_TFLAG_CUSTOM_HANDLER taskfile flag and use it for internal requests
which require custom handlers. Check the flag in do_rw_taskfile() and set
handler accordingly.
* Cleanup ide_init_{specify,restore,setmult}_cmd() and rename it to
ide_tf_set_{specify,restore,setmult}_cmd().
* Make {set_geometry,recal,set_multmode}_intr() static.
* Remove no longer needed 'handler' field from ide_task_t.
v2:
* 'handler' in do_rw_taskfile() must be set to NULL initially.
There should be no functionality changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 835465d61f70..236f91f11a73 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -151,12 +151,15 @@ static int inline task_dma_ok(ide_task_t *task) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | static ide_startstop_t task_no_data_intr(ide_drive_t *); | 153 | static ide_startstop_t task_no_data_intr(ide_drive_t *); |
154 | static ide_startstop_t task_out_intr(ide_drive_t *); | 154 | static ide_startstop_t set_geometry_intr(ide_drive_t *); |
155 | static ide_startstop_t recal_intr(ide_drive_t *); | ||
156 | static ide_startstop_t set_multmode_intr(ide_drive_t *); | ||
155 | 157 | ||
156 | ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | 158 | ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) |
157 | { | 159 | { |
158 | ide_hwif_t *hwif = HWIF(drive); | 160 | ide_hwif_t *hwif = HWIF(drive); |
159 | struct ide_taskfile *tf = &task->tf; | 161 | struct ide_taskfile *tf = &task->tf; |
162 | ide_handler_t *handler = NULL; | ||
160 | 163 | ||
161 | if (task->data_phase == TASKFILE_MULTI_IN || | 164 | if (task->data_phase == TASKFILE_MULTI_IN || |
162 | task->data_phase == TASKFILE_MULTI_OUT) { | 165 | task->data_phase == TASKFILE_MULTI_OUT) { |
@@ -175,19 +178,26 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
175 | switch (task->data_phase) { | 178 | switch (task->data_phase) { |
176 | case TASKFILE_MULTI_OUT: | 179 | case TASKFILE_MULTI_OUT: |
177 | case TASKFILE_OUT: | 180 | case TASKFILE_OUT: |
178 | task->handler = task_out_intr; | ||
179 | hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG); | 181 | hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG); |
180 | ndelay(400); /* FIXME */ | 182 | ndelay(400); /* FIXME */ |
181 | return pre_task_out_intr(drive, task->rq); | 183 | return pre_task_out_intr(drive, task->rq); |
182 | case TASKFILE_MULTI_IN: | 184 | case TASKFILE_MULTI_IN: |
183 | case TASKFILE_IN: | 185 | case TASKFILE_IN: |
184 | task->handler = task_in_intr; | 186 | handler = task_in_intr; |
185 | /* fall-through */ | 187 | /* fall-through */ |
186 | case TASKFILE_NO_DATA: | 188 | case TASKFILE_NO_DATA: |
189 | if (handler == NULL) | ||
190 | handler = task_no_data_intr; | ||
187 | /* WIN_{SPECIFY,RESTORE,SETMULT} use custom handlers */ | 191 | /* WIN_{SPECIFY,RESTORE,SETMULT} use custom handlers */ |
188 | if (task->handler == NULL) | 192 | if (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) { |
189 | task->handler = task_no_data_intr; | 193 | switch (tf->command) { |
190 | ide_execute_command(drive, tf->command, task->handler, WAIT_WORSTCASE, NULL); | 194 | case WIN_SPECIFY: handler = set_geometry_intr; break; |
195 | case WIN_RESTORE: handler = recal_intr; break; | ||
196 | case WIN_SETMULT: handler = set_multmode_intr; break; | ||
197 | } | ||
198 | } | ||
199 | ide_execute_command(drive, tf->command, handler, | ||
200 | WAIT_WORSTCASE, NULL); | ||
191 | return ide_started; | 201 | return ide_started; |
192 | default: | 202 | default: |
193 | if (task_dma_ok(task) == 0 || drive->using_dma == 0 || | 203 | if (task_dma_ok(task) == 0 || drive->using_dma == 0 || |
@@ -202,7 +212,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
202 | /* | 212 | /* |
203 | * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd. | 213 | * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd. |
204 | */ | 214 | */ |
205 | ide_startstop_t set_multmode_intr (ide_drive_t *drive) | 215 | static ide_startstop_t set_multmode_intr(ide_drive_t *drive) |
206 | { | 216 | { |
207 | ide_hwif_t *hwif = HWIF(drive); | 217 | ide_hwif_t *hwif = HWIF(drive); |
208 | u8 stat; | 218 | u8 stat; |
@@ -220,7 +230,7 @@ ide_startstop_t set_multmode_intr (ide_drive_t *drive) | |||
220 | /* | 230 | /* |
221 | * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd. | 231 | * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd. |
222 | */ | 232 | */ |
223 | ide_startstop_t set_geometry_intr (ide_drive_t *drive) | 233 | static ide_startstop_t set_geometry_intr(ide_drive_t *drive) |
224 | { | 234 | { |
225 | ide_hwif_t *hwif = HWIF(drive); | 235 | ide_hwif_t *hwif = HWIF(drive); |
226 | int retries = 5; | 236 | int retries = 5; |
@@ -243,7 +253,7 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive) | |||
243 | /* | 253 | /* |
244 | * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd. | 254 | * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd. |
245 | */ | 255 | */ |
246 | ide_startstop_t recal_intr (ide_drive_t *drive) | 256 | static ide_startstop_t recal_intr(ide_drive_t *drive) |
247 | { | 257 | { |
248 | ide_hwif_t *hwif = HWIF(drive); | 258 | ide_hwif_t *hwif = HWIF(drive); |
249 | u8 stat; | 259 | u8 stat; |