diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:31 -0400 |
commit | 844b9468523c8c2c45b90df4efcabcbe4926b5ab (patch) | |
tree | 64d239e810c6f143f6d3206fc37200af47f9eee0 /drivers | |
parent | 2b9efba48283f34083df6bc53f6752fba4e4d409 (diff) |
ide: drop 'timeout' and 'expiry' arguments from ide_pc_intr()
* Move idescsi_expiry() to ide-atapi.c.
* Move get_timeout() to <linux/ide.h>.
* Drop 'timeout' and 'expiry' arguments from ide_pc_intr().
While at it:
* idescsi_expiry() -> ide_scsi_expiry()
* get_timeout() -> ide_scsi_get_timeout()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-atapi.c | 34 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 5 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 25 |
4 files changed, 34 insertions, 33 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 0069c4f08244..184835141412 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -203,9 +203,21 @@ int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on) | |||
203 | } | 203 | } |
204 | EXPORT_SYMBOL_GPL(ide_set_media_lock); | 204 | EXPORT_SYMBOL_GPL(ide_set_media_lock); |
205 | 205 | ||
206 | int ide_scsi_expiry(ide_drive_t *drive) | ||
207 | { | ||
208 | struct ide_atapi_pc *pc = drive->pc; | ||
209 | |||
210 | debug_log("%s called for %lu at %lu\n", __func__, | ||
211 | pc->scsi_cmd->serial_number, jiffies); | ||
212 | |||
213 | pc->flags |= PC_FLAG_TIMEDOUT; | ||
214 | |||
215 | return 0; /* we do not want the IDE subsystem to retry */ | ||
216 | } | ||
217 | EXPORT_SYMBOL_GPL(ide_scsi_expiry); | ||
218 | |||
206 | /* TODO: unify the code thus making some arguments go away */ | 219 | /* TODO: unify the code thus making some arguments go away */ |
207 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, | 220 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, |
208 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | ||
209 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), | 221 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), |
210 | void (*retry_pc)(ide_drive_t *), | 222 | void (*retry_pc)(ide_drive_t *), |
211 | int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) | 223 | int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) |
@@ -215,12 +227,22 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, | |||
215 | struct request *rq = hwif->hwgroup->rq; | 227 | struct request *rq = hwif->hwgroup->rq; |
216 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 228 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
217 | xfer_func_t *xferfunc; | 229 | xfer_func_t *xferfunc; |
218 | unsigned int temp; | 230 | ide_expiry_t *expiry; |
231 | unsigned int timeout, temp; | ||
219 | u16 bcount; | 232 | u16 bcount; |
220 | u8 stat, ireason, scsi = drive->scsi, dsc = 0; | 233 | u8 stat, ireason, scsi = drive->scsi, dsc = 0; |
221 | 234 | ||
222 | debug_log("Enter %s - interrupt handler\n", __func__); | 235 | debug_log("Enter %s - interrupt handler\n", __func__); |
223 | 236 | ||
237 | if (scsi) { | ||
238 | timeout = ide_scsi_get_timeout(pc); | ||
239 | expiry = ide_scsi_expiry; | ||
240 | } else { | ||
241 | timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD | ||
242 | : WAIT_TAPE_CMD; | ||
243 | expiry = NULL; | ||
244 | } | ||
245 | |||
224 | if (pc->flags & PC_FLAG_TIMEDOUT) { | 246 | if (pc->flags & PC_FLAG_TIMEDOUT) { |
225 | drive->pc_callback(drive, 0); | 247 | drive->pc_callback(drive, 0); |
226 | return ide_stopped; | 248 | return ide_stopped; |
@@ -347,9 +369,7 @@ cmd_finished: | |||
347 | pc->xferred += temp; | 369 | pc->xferred += temp; |
348 | pc->cur_pos += temp; | 370 | pc->cur_pos += temp; |
349 | ide_pad_transfer(drive, 0, bcount - temp); | 371 | ide_pad_transfer(drive, 0, bcount - temp); |
350 | ide_set_handler(drive, handler, timeout, | 372 | goto next_irq; |
351 | expiry); | ||
352 | return ide_started; | ||
353 | } | 373 | } |
354 | debug_log("The device wants to send us more data than " | 374 | debug_log("The device wants to send us more data than " |
355 | "expected - allowing transfer\n"); | 375 | "expected - allowing transfer\n"); |
@@ -376,7 +396,7 @@ cmd_finished: | |||
376 | 396 | ||
377 | debug_log("[cmd %x] transferred %d bytes on that intr.\n", | 397 | debug_log("[cmd %x] transferred %d bytes on that intr.\n", |
378 | rq->cmd[0], bcount); | 398 | rq->cmd[0], bcount); |
379 | 399 | next_irq: | |
380 | /* And set the interrupt handler again */ | 400 | /* And set the interrupt handler again */ |
381 | ide_set_handler(drive, handler, timeout, expiry); | 401 | ide_set_handler(drive, handler, timeout, expiry); |
382 | return ide_started; | 402 | return ide_started; |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index cb89caf07913..49e702670b8e 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -219,8 +219,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive) | |||
219 | /* The usual interrupt handler called during a packet command. */ | 219 | /* The usual interrupt handler called during a packet command. */ |
220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) | 220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) |
221 | { | 221 | { |
222 | return ide_pc_intr(drive, idefloppy_pc_intr, | 222 | return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers, |
223 | WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers, | ||
224 | idefloppy_retry_pc, ide_io_buffers); | 223 | idefloppy_retry_pc, ide_io_buffers); |
225 | } | 224 | } |
226 | 225 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 5b2ac04d9be9..fe8502afd2ea 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -655,9 +655,8 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
655 | */ | 655 | */ |
656 | static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | 656 | static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) |
657 | { | 657 | { |
658 | return ide_pc_intr(drive, idetape_pc_intr, WAIT_TAPE_CMD, | 658 | return ide_pc_intr(drive, idetape_pc_intr, idetape_update_buffers, |
659 | NULL, idetape_update_buffers, idetape_retry_pc, | 659 | idetape_retry_pc, ide_tape_io_buffers); |
660 | ide_tape_io_buffers); | ||
661 | } | 660 | } |
662 | 661 | ||
663 | /* | 662 | /* |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index bb8b3b123c7d..f71d1b34c3b1 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -270,36 +270,19 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | 272 | ||
273 | static inline unsigned long get_timeout(struct ide_atapi_pc *pc) | ||
274 | { | ||
275 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | ||
276 | } | ||
277 | |||
278 | static int idescsi_expiry(ide_drive_t *drive) | ||
279 | { | ||
280 | struct ide_atapi_pc *pc = drive->pc; | ||
281 | |||
282 | debug_log("%s called for %lu at %lu\n", __func__, | ||
283 | pc->scsi_cmd->serial_number, jiffies); | ||
284 | |||
285 | pc->flags |= PC_FLAG_TIMEDOUT; | ||
286 | |||
287 | return 0; /* we do not want the ide subsystem to retry */ | ||
288 | } | ||
289 | |||
290 | /* | 273 | /* |
291 | * Our interrupt handler. | 274 | * Our interrupt handler. |
292 | */ | 275 | */ |
293 | static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | 276 | static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) |
294 | { | 277 | { |
295 | return ide_pc_intr(drive, idescsi_pc_intr, get_timeout(drive->pc), | 278 | return ide_pc_intr(drive, idescsi_pc_intr, NULL, NULL, ide_io_buffers); |
296 | idescsi_expiry, NULL, NULL, ide_io_buffers); | ||
297 | } | 279 | } |
298 | 280 | ||
299 | static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | 281 | static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) |
300 | { | 282 | { |
301 | return ide_transfer_pc(drive, idescsi_pc_intr, | 283 | return ide_transfer_pc(drive, idescsi_pc_intr, |
302 | get_timeout(drive->pc), idescsi_expiry); | 284 | ide_scsi_get_timeout(drive->pc), |
285 | ide_scsi_expiry); | ||
303 | } | 286 | } |
304 | 287 | ||
305 | static inline int idescsi_set_direction(struct ide_atapi_pc *pc) | 288 | static inline int idescsi_set_direction(struct ide_atapi_pc *pc) |
@@ -348,7 +331,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive, | |||
348 | drive->pc = pc; | 331 | drive->pc = pc; |
349 | 332 | ||
350 | return ide_issue_pc(drive, idescsi_transfer_pc, | 333 | return ide_issue_pc(drive, idescsi_transfer_pc, |
351 | get_timeout(pc), idescsi_expiry); | 334 | ide_scsi_get_timeout(pc), ide_scsi_expiry); |
352 | } | 335 | } |
353 | 336 | ||
354 | /* | 337 | /* |