aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:32 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:32 -0400
commit85e39035ca381846b031690f4d1ac1f0660da0a2 (patch)
treeebdf6b4b173e3e11ce876b8b7b91651a60945f91
parent6b0da28b2d0f4f4e2c55689fc062db569075ff60 (diff)
ide: add ->pc_{update,io}_buffers methods
Add ->pc_{update,io}_buffers methods to ide_drive_t and use them instead of {update,io}_buffers ide_pc_intr() arguments. There should be no functional changes caused by this patch. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-atapi.c14
-rw-r--r--drivers/ide/ide-floppy.c7
-rw-r--r--drivers/ide/ide-tape.c7
-rw-r--r--drivers/scsi/ide-scsi.c6
-rw-r--r--include/linux/ide.h9
5 files changed, 23 insertions, 20 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index d758dcd87178..f46bc5124e00 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -246,10 +246,7 @@ int ide_scsi_expiry(ide_drive_t *drive)
246} 246}
247EXPORT_SYMBOL_GPL(ide_scsi_expiry); 247EXPORT_SYMBOL_GPL(ide_scsi_expiry);
248 248
249/* TODO: unify the code thus making some arguments go away */ 249ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler)
250ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
251 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
252 int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
253{ 250{
254 struct ide_atapi_pc *pc = drive->pc; 251 struct ide_atapi_pc *pc = drive->pc;
255 ide_hwif_t *hwif = drive->hwif; 252 ide_hwif_t *hwif = drive->hwif;
@@ -290,8 +287,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
290 pc->flags |= PC_FLAG_DMA_ERROR; 287 pc->flags |= PC_FLAG_DMA_ERROR;
291 } else { 288 } else {
292 pc->xferred = pc->req_xfer; 289 pc->xferred = pc->req_xfer;
293 if (update_buffers) 290 if (drive->pc_update_buffers)
294 update_buffers(drive, pc); 291 drive->pc_update_buffers(drive, pc);
295 } 292 }
296 debug_log("%s: DMA finished\n", drive->name); 293 debug_log("%s: DMA finished\n", drive->name);
297 } 294 }
@@ -386,7 +383,8 @@ cmd_finished:
386 temp = 0; 383 temp = 0;
387 if (temp) { 384 if (temp) {
388 if (pc->sg) 385 if (pc->sg)
389 io_buffers(drive, pc, temp, 0); 386 drive->pc_io_buffers(drive, pc,
387 temp, 0);
390 else 388 else
391 tp_ops->input_data(drive, NULL, 389 tp_ops->input_data(drive, NULL,
392 pc->cur_pos, temp); 390 pc->cur_pos, temp);
@@ -410,7 +408,7 @@ cmd_finished:
410 if ((drive->media == ide_floppy && !scsi && !pc->buf) || 408 if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
411 (drive->media == ide_tape && !scsi && pc->bh) || 409 (drive->media == ide_tape && !scsi && pc->bh) ||
412 (scsi && pc->sg)) { 410 (scsi && pc->sg)) {
413 int done = io_buffers(drive, pc, bcount, 411 int done = drive->pc_io_buffers(drive, pc, bcount,
414 !!(pc->flags & PC_FLAG_WRITING)); 412 !!(pc->flags & PC_FLAG_WRITING));
415 413
416 /* FIXME: don't do partial completions */ 414 /* FIXME: don't do partial completions */
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 6e62ffafc562..378a22ca55c1 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -196,8 +196,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
196/* The usual interrupt handler called during a packet command. */ 196/* The usual interrupt handler called during a packet command. */
197static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) 197static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
198{ 198{
199 return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers, 199 return ide_pc_intr(drive, idefloppy_pc_intr);
200 ide_io_buffers);
201} 200}
202 201
203/* 202/*
@@ -636,7 +635,9 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
636 635
637 *((u16 *)&gcw) = id[ATA_ID_CONFIG]; 636 *((u16 *)&gcw) = id[ATA_ID_CONFIG];
638 637
639 drive->pc_callback = ide_floppy_callback; 638 drive->pc_callback = ide_floppy_callback;
639 drive->pc_update_buffers = idefloppy_update_buffers;
640 drive->pc_io_buffers = ide_io_buffers;
640 641
641 if (((gcw[0] & 0x60) >> 5) == 1) 642 if (((gcw[0] & 0x60) >> 5) == 1)
642 drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT; 643 drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 72caca3cb7aa..5c26e98e2e39 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -627,8 +627,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
627 */ 627 */
628static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) 628static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
629{ 629{
630 return ide_pc_intr(drive, idetape_pc_intr, idetape_update_buffers, 630 return ide_pc_intr(drive, idetape_pc_intr);
631 ide_tape_io_buffers);
632} 631}
633 632
634/* 633/*
@@ -2211,7 +2210,9 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2211 u8 gcw[2]; 2210 u8 gcw[2];
2212 u16 *ctl = (u16 *)&tape->caps[12]; 2211 u16 *ctl = (u16 *)&tape->caps[12];
2213 2212
2214 drive->pc_callback = ide_tape_callback; 2213 drive->pc_callback = ide_tape_callback;
2214 drive->pc_update_buffers = idetape_update_buffers;
2215 drive->pc_io_buffers = ide_tape_io_buffers;
2215 2216
2216 spin_lock_init(&tape->lock); 2217 spin_lock_init(&tape->lock);
2217 drive->dsc_overlap = 1; 2218 drive->dsc_overlap = 1;
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index ff2b19909838..b4ba40436c4f 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -275,7 +275,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
275 */ 275 */
276static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) 276static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
277{ 277{
278 return ide_pc_intr(drive, idescsi_pc_intr, NULL, ide_io_buffers); 278 return ide_pc_intr(drive, idescsi_pc_intr);
279} 279}
280 280
281static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) 281static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
@@ -407,7 +407,9 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
407 set_bit(IDESCSI_LOG_CMD, &scsi->log); 407 set_bit(IDESCSI_LOG_CMD, &scsi->log);
408#endif /* IDESCSI_DEBUG_LOG */ 408#endif /* IDESCSI_DEBUG_LOG */
409 409
410 drive->pc_callback = ide_scsi_callback; 410 drive->pc_callback = ide_scsi_callback;
411 drive->pc_update_buffers = NULL;
412 drive->pc_io_buffers = ide_io_buffers;
411 413
412 ide_proc_register_driver(drive, scsi->driver); 414 ide_proc_register_driver(drive, scsi->driver);
413} 415}
diff --git a/include/linux/ide.h b/include/linux/ide.h
index d88cced0d02c..f7fc53d1a810 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -555,6 +555,10 @@ struct ide_drive_s {
555 /* callback for packet commands */ 555 /* callback for packet commands */
556 void (*pc_callback)(struct ide_drive_s *, int); 556 void (*pc_callback)(struct ide_drive_s *, int);
557 557
558 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
559 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
560 unsigned int, int);
561
558 unsigned long atapi_flags; 562 unsigned long atapi_flags;
559 563
560 struct ide_atapi_pc request_sense_pc; 564 struct ide_atapi_pc request_sense_pc;
@@ -1184,10 +1188,7 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)
1184 1188
1185int ide_scsi_expiry(ide_drive_t *); 1189int ide_scsi_expiry(ide_drive_t *);
1186 1190
1187ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, 1191ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler);
1188 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
1189 int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
1190 int));
1191ide_startstop_t ide_transfer_pc(ide_drive_t *, 1192ide_startstop_t ide_transfer_pc(ide_drive_t *,
1192 ide_handler_t *, unsigned int, ide_expiry_t *); 1193 ide_handler_t *, unsigned int, ide_expiry_t *);
1193ide_startstop_t ide_issue_pc(ide_drive_t *, 1194ide_startstop_t ide_issue_pc(ide_drive_t *,