diff options
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index b33080675f6b..cb89caf07913 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -159,7 +159,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive, | |||
159 | static void ide_floppy_callback(ide_drive_t *drive, int dsc) | 159 | static void ide_floppy_callback(ide_drive_t *drive, int dsc) |
160 | { | 160 | { |
161 | idefloppy_floppy_t *floppy = drive->driver_data; | 161 | idefloppy_floppy_t *floppy = drive->driver_data; |
162 | struct ide_atapi_pc *pc = floppy->pc; | 162 | struct ide_atapi_pc *pc = drive->pc; |
163 | int uptodate = pc->error ? 0 : 1; | 163 | int uptodate = pc->error ? 0 : 1; |
164 | 164 | ||
165 | debug_log("Reached %s\n", __func__); | 165 | debug_log("Reached %s\n", __func__); |
@@ -171,7 +171,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) | |||
171 | (pc->rq && blk_pc_request(pc->rq))) | 171 | (pc->rq && blk_pc_request(pc->rq))) |
172 | uptodate = 1; /* FIXME */ | 172 | uptodate = 1; /* FIXME */ |
173 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { | 173 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
174 | u8 *buf = floppy->pc->buf; | 174 | u8 *buf = pc->buf; |
175 | 175 | ||
176 | if (!pc->error) { | 176 | if (!pc->error) { |
177 | floppy->sense_key = buf[2] & 0x0F; | 177 | floppy->sense_key = buf[2] & 0x0F; |
@@ -219,9 +219,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive) | |||
219 | /* The usual interrupt handler called during a packet command. */ | 219 | /* The usual interrupt handler called during a packet command. */ |
220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) | 220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) |
221 | { | 221 | { |
222 | idefloppy_floppy_t *floppy = drive->driver_data; | 222 | return ide_pc_intr(drive, idefloppy_pc_intr, |
223 | |||
224 | return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr, | ||
225 | WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers, | 223 | WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers, |
226 | idefloppy_retry_pc, ide_io_buffers); | 224 | idefloppy_retry_pc, ide_io_buffers); |
227 | } | 225 | } |
@@ -234,10 +232,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) | |||
234 | */ | 232 | */ |
235 | static int idefloppy_transfer_pc(ide_drive_t *drive) | 233 | static int idefloppy_transfer_pc(ide_drive_t *drive) |
236 | { | 234 | { |
237 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
238 | |||
239 | /* Send the actual packet */ | 235 | /* Send the actual packet */ |
240 | drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12); | 236 | drive->hwif->tp_ops->output_data(drive, NULL, drive->pc->c, 12); |
241 | 237 | ||
242 | /* Timeout for the packet command */ | 238 | /* Timeout for the packet command */ |
243 | return WAIT_FLOPPY_CMD; | 239 | return WAIT_FLOPPY_CMD; |
@@ -251,7 +247,6 @@ static int idefloppy_transfer_pc(ide_drive_t *drive) | |||
251 | static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) | 247 | static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) |
252 | { | 248 | { |
253 | idefloppy_floppy_t *floppy = drive->driver_data; | 249 | idefloppy_floppy_t *floppy = drive->driver_data; |
254 | struct ide_atapi_pc *pc = floppy->pc; | ||
255 | ide_expiry_t *expiry; | 250 | ide_expiry_t *expiry; |
256 | unsigned int timeout; | 251 | unsigned int timeout; |
257 | 252 | ||
@@ -271,7 +266,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) | |||
271 | expiry = NULL; | 266 | expiry = NULL; |
272 | } | 267 | } |
273 | 268 | ||
274 | return ide_transfer_pc(drive, pc, idefloppy_pc_intr, timeout, expiry); | 269 | return ide_transfer_pc(drive, idefloppy_pc_intr, timeout, expiry); |
275 | } | 270 | } |
276 | 271 | ||
277 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, | 272 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, |
@@ -298,8 +293,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
298 | if (floppy->failed_pc == NULL && | 293 | if (floppy->failed_pc == NULL && |
299 | pc->c[0] != GPCMD_REQUEST_SENSE) | 294 | pc->c[0] != GPCMD_REQUEST_SENSE) |
300 | floppy->failed_pc = pc; | 295 | floppy->failed_pc = pc; |
296 | |||
301 | /* Set the current packet command */ | 297 | /* Set the current packet command */ |
302 | floppy->pc = pc; | 298 | drive->pc = pc; |
303 | 299 | ||
304 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { | 300 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { |
305 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) | 301 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) |
@@ -316,7 +312,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
316 | 312 | ||
317 | pc->retries++; | 313 | pc->retries++; |
318 | 314 | ||
319 | return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer, | 315 | return ide_issue_pc(drive, idefloppy_start_pc_transfer, |
320 | WAIT_FLOPPY_CMD, NULL); | 316 | WAIT_FLOPPY_CMD, NULL); |
321 | } | 317 | } |
322 | 318 | ||