From 9567b349f7e7dd7e2483db99ee8e4a6fe0caca38 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 28 Apr 2008 23:44:36 +0200 Subject: ide: merge ->atapi_*put_bytes and ->ata_*put_data methods * Merge ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods into new ->{in,out}put_data methods which take number of bytes to transfer as an argument and always do padding. While at it: * Use 'hwif' or 'drive->hwif' instead of 'HWIF(drive)'. There should be no functional changes caused by this patch (all users of ->ata_{in,out}put_data methods were using multiply-of-4 word counts). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/q40ide.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'drivers/ide/legacy/q40ide.c') diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index deae3d2ca65..6f535d00e63 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c @@ -72,34 +72,26 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base, hw->ack_intr = ack_intr; } -static void q40ide_atapi_input_bytes(ide_drive_t *drive, void *buf, - unsigned int len) +static void q40ide_input_data(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) { - insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); -} - -static void q40ide_atapi_output_bytes(ide_drive_t *drive, void *buf, - unsigned int len) -{ - outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); -} + unsigned long data_addr = drive->hwif->io_ports.data_addr; -static void q40ide_ata_input_data(ide_drive_t *drive, struct request *rq, - void *buf, unsigned int wcount) -{ if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) - return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2); + return insw(data_addr, buf, (len + 1) / 2); - q40ide_atapi_input_bytes(drive, buf, wcount * 4); + insw_swapw(data_addr, buf, (len + 1) / 2); } -static void q40ide_ata_output_data(ide_drive_t *drive, struct request *rq, - void *buf, unsigned int wcount) +static void q40ide_output_data(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) { + unsigned long data_addr = drive->hwif->io_ports.data_addr; + if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) - return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2); + return outsw(data_addr, buf, (len + 1) / 2); - q40ide_atapi_output_bytes(drive, buf, wcount * 4); + outsw_swapw(data_addr, buf, (len + 1) / 2); } /* @@ -152,10 +144,8 @@ static int __init q40ide_init(void) ide_init_port_hw(hwif, &hw); /* Q40 has a byte-swapped IDE interface */ - hwif->atapi_input_bytes = q40ide_atapi_input_bytes; - hwif->atapi_output_bytes = q40ide_atapi_output_bytes; - hwif->ata_input_data = q40ide_ata_input_data; - hwif->ata_output_data = q40ide_ata_output_data; + hwif->input_data = q40ide_input_data; + hwif->output_data = q40ide_output_data; idx[i] = hwif->index; } -- cgit v1.2.3