aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:52 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:52 -0400
commitb73c7ee25da6133f97f47ffd3557288417da7c76 (patch)
tree0d348c81294d246b8417aff6e24502c93b312505 /drivers/ide/ide-taskfile.c
parentc6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21 (diff)
ide: add ->read_status method
* Remove ide_read_status() inline helper. * Add ->read_status method for reading ATA Status register and use it instead of ->INB. While at it: * Don't use HWGROUP() macro. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index c56be289417e..fc2b3957afac 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -124,7 +124,8 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
124 */ 124 */
125static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 125static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
126{ 126{
127 u8 stat = ide_read_status(drive); 127 ide_hwif_t *hwif = drive->hwif;
128 u8 stat = hwif->read_status(hwif);
128 129
129 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 130 if (OK_STAT(stat, READY_STAT, BAD_STAT))
130 drive->mult_count = drive->mult_req; 131 drive->mult_count = drive->mult_req;
@@ -141,10 +142,11 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
141 */ 142 */
142static ide_startstop_t set_geometry_intr(ide_drive_t *drive) 143static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
143{ 144{
145 ide_hwif_t *hwif = drive->hwif;
144 int retries = 5; 146 int retries = 5;
145 u8 stat; 147 u8 stat;
146 148
147 while (((stat = ide_read_status(drive)) & BUSY_STAT) && retries--) 149 while (((stat = hwif->read_status(hwif)) & BUSY_STAT) && retries--)
148 udelay(10); 150 udelay(10);
149 151
150 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 152 if (OK_STAT(stat, READY_STAT, BAD_STAT))
@@ -162,7 +164,8 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
162 */ 164 */
163static ide_startstop_t recal_intr(ide_drive_t *drive) 165static ide_startstop_t recal_intr(ide_drive_t *drive)
164{ 166{
165 u8 stat = ide_read_status(drive); 167 ide_hwif_t *hwif = drive->hwif;
168 u8 stat = hwif->read_status(hwif);
166 169
167 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) 170 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
168 return ide_error(drive, "recal_intr", stat); 171 return ide_error(drive, "recal_intr", stat);
@@ -174,11 +177,12 @@ static ide_startstop_t recal_intr(ide_drive_t *drive)
174 */ 177 */
175static ide_startstop_t task_no_data_intr(ide_drive_t *drive) 178static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
176{ 179{
177 ide_task_t *args = HWGROUP(drive)->rq->special; 180 ide_hwif_t *hwif = drive->hwif;
181 ide_task_t *args = hwif->hwgroup->rq->special;
178 u8 stat; 182 u8 stat;
179 183
180 local_irq_enable_in_hardirq(); 184 local_irq_enable_in_hardirq();
181 stat = ide_read_status(drive); 185 stat = hwif->read_status(hwif);
182 186
183 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) 187 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
184 return ide_error(drive, "task_no_data_intr", stat); 188 return ide_error(drive, "task_no_data_intr", stat);
@@ -192,6 +196,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
192 196
193static u8 wait_drive_not_busy(ide_drive_t *drive) 197static u8 wait_drive_not_busy(ide_drive_t *drive)
194{ 198{
199 ide_hwif_t *hwif = drive->hwif;
195 int retries; 200 int retries;
196 u8 stat; 201 u8 stat;
197 202
@@ -200,7 +205,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
200 * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms. 205 * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
201 */ 206 */
202 for (retries = 0; retries < 1000; retries++) { 207 for (retries = 0; retries < 1000; retries++) {
203 stat = ide_read_status(drive); 208 stat = hwif->read_status(hwif);
204 209
205 if (stat & BUSY_STAT) 210 if (stat & BUSY_STAT)
206 udelay(10); 211 udelay(10);
@@ -383,8 +388,8 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
383static ide_startstop_t task_in_intr(ide_drive_t *drive) 388static ide_startstop_t task_in_intr(ide_drive_t *drive)
384{ 389{
385 ide_hwif_t *hwif = drive->hwif; 390 ide_hwif_t *hwif = drive->hwif;
386 struct request *rq = HWGROUP(drive)->rq; 391 struct request *rq = hwif->hwgroup->rq;
387 u8 stat = ide_read_status(drive); 392 u8 stat = hwif->read_status(hwif);
388 393
389 /* Error? */ 394 /* Error? */
390 if (stat & ERR_STAT) 395 if (stat & ERR_STAT)
@@ -418,7 +423,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
418{ 423{
419 ide_hwif_t *hwif = drive->hwif; 424 ide_hwif_t *hwif = drive->hwif;
420 struct request *rq = HWGROUP(drive)->rq; 425 struct request *rq = HWGROUP(drive)->rq;
421 u8 stat = ide_read_status(drive); 426 u8 stat = hwif->read_status(hwif);
422 427
423 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) 428 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
424 return task_error(drive, rq, __func__, stat); 429 return task_error(drive, rq, __func__, stat);