aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/falconide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
commit9567b349f7e7dd7e2483db99ee8e4a6fe0caca38 (patch)
tree29abab829b52a451567f8da4280d101fafa44527 /drivers/ide/legacy/falconide.c
parent92d3ab27e8fd23d1a9dc3b69d17b2afb83e5c6f5 (diff)
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 <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/falconide.c')
-rw-r--r--drivers/ide/legacy/falconide.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 32c044b17d45..83555ca513b5 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -44,34 +44,26 @@
44int falconide_intr_lock; 44int falconide_intr_lock;
45EXPORT_SYMBOL(falconide_intr_lock); 45EXPORT_SYMBOL(falconide_intr_lock);
46 46
47static void falconide_atapi_input_bytes(ide_drive_t *drive, void *buf, 47static void falconide_input_data(ide_drive_t *drive, struct request *rq,
48 unsigned int len) 48 void *buf, unsigned int len)
49{ 49{
50 insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 50 unsigned long data_addr = drive->hwif->io_ports.data_addr;
51}
52
53static void falconide_atapi_output_bytes(ide_drive_t *drive, void *buf,
54 unsigned int len)
55{
56 outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
57}
58 51
59static void falconide_ata_input_data(ide_drive_t *drive, struct request *rq,
60 void *buf, unsigned int wcount)
61{
62 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 52 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
63 return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2); 53 return insw(data_addr, buf, (len + 1) / 2);
64 54
65 falconide_atapi_input_bytes(drive, buf, wcount * 4); 55 insw_swapw(data_addr, buf, (len + 1) / 2);
66} 56}
67 57
68static void falconide_ata_output_data(ide_drive_t *drive, struct request *rq, 58static void falconide_output_data(ide_drive_t *drive, struct request *rq,
69 void *buf, unsigned int wcount) 59 void *buf, unsigned int len)
70{ 60{
61 unsigned long data_addr = drive->hwif->io_ports.data_addr;
62
71 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 63 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
72 return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2); 64 return outsw(data_adr, buf, (len + 1) / 2);
73 65
74 falconide_atapi_output_bytes(drive, buf, wcount * 4); 66 outsw_swapw(data_addr, buf, (len + 1) / 2);
75} 67}
76 68
77static void __init falconide_setup_ports(hw_regs_t *hw) 69static void __init falconide_setup_ports(hw_regs_t *hw)
@@ -121,10 +113,8 @@ static int __init falconide_init(void)
121 ide_init_port_hw(hwif, &hw); 113 ide_init_port_hw(hwif, &hw);
122 114
123 /* Atari has a byte-swapped IDE interface */ 115 /* Atari has a byte-swapped IDE interface */
124 hwif->atapi_input_bytes = falconide_atapi_input_bytes; 116 hwif->input_data = falconide_input_data;
125 hwif->atapi_output_bytes = falconide_atapi_output_bytes; 117 hwif->output_data = falconide_output_data;
126 hwif->ata_input_data = falconide_ata_input_data;
127 hwif->ata_output_data = falconide_ata_output_data;
128 118
129 ide_get_lock(NULL, NULL); 119 ide_get_lock(NULL, NULL);
130 ide_device_add(idx, NULL); 120 ide_device_add(idx, NULL);