diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-28 17:44:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-28 17:44:36 -0400 |
commit | 9567b349f7e7dd7e2483db99ee8e4a6fe0caca38 (patch) | |
tree | 29abab829b52a451567f8da4280d101fafa44527 /drivers/ide/legacy/q40ide.c | |
parent | 92d3ab27e8fd23d1a9dc3b69d17b2afb83e5c6f5 (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/q40ide.c')
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index deae3d2ca65e..6f535d00e638 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, | |||
72 | hw->ack_intr = ack_intr; | 72 | hw->ack_intr = ack_intr; |
73 | } | 73 | } |
74 | 74 | ||
75 | static void q40ide_atapi_input_bytes(ide_drive_t *drive, void *buf, | 75 | static void q40ide_input_data(ide_drive_t *drive, struct request *rq, |
76 | unsigned int len) | 76 | void *buf, unsigned int len) |
77 | { | 77 | { |
78 | insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 78 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
79 | } | ||
80 | |||
81 | static void q40ide_atapi_output_bytes(ide_drive_t *drive, void *buf, | ||
82 | unsigned int len) | ||
83 | { | ||
84 | outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | ||
85 | } | ||
86 | 79 | ||
87 | static void q40ide_ata_input_data(ide_drive_t *drive, struct request *rq, | ||
88 | void *buf, unsigned int wcount) | ||
89 | { | ||
90 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 80 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) |
91 | return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2); | 81 | return insw(data_addr, buf, (len + 1) / 2); |
92 | 82 | ||
93 | q40ide_atapi_input_bytes(drive, buf, wcount * 4); | 83 | insw_swapw(data_addr, buf, (len + 1) / 2); |
94 | } | 84 | } |
95 | 85 | ||
96 | static void q40ide_ata_output_data(ide_drive_t *drive, struct request *rq, | 86 | static void q40ide_output_data(ide_drive_t *drive, struct request *rq, |
97 | void *buf, unsigned int wcount) | 87 | void *buf, unsigned int len) |
98 | { | 88 | { |
89 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | ||
90 | |||
99 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 91 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) |
100 | return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2); | 92 | return outsw(data_addr, buf, (len + 1) / 2); |
101 | 93 | ||
102 | q40ide_atapi_output_bytes(drive, buf, wcount * 4); | 94 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
103 | } | 95 | } |
104 | 96 | ||
105 | /* | 97 | /* |
@@ -152,10 +144,8 @@ static int __init q40ide_init(void) | |||
152 | ide_init_port_hw(hwif, &hw); | 144 | ide_init_port_hw(hwif, &hw); |
153 | 145 | ||
154 | /* Q40 has a byte-swapped IDE interface */ | 146 | /* Q40 has a byte-swapped IDE interface */ |
155 | hwif->atapi_input_bytes = q40ide_atapi_input_bytes; | 147 | hwif->input_data = q40ide_input_data; |
156 | hwif->atapi_output_bytes = q40ide_atapi_output_bytes; | 148 | hwif->output_data = q40ide_output_data; |
157 | hwif->ata_input_data = q40ide_ata_input_data; | ||
158 | hwif->ata_output_data = q40ide_ata_output_data; | ||
159 | 149 | ||
160 | idx[i] = hwif->index; | 150 | idx[i] = hwif->index; |
161 | } | 151 | } |