aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2008-02-02 13:56:34 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:34 -0500
commita6ff2d3b08fe0780063bb159c7beab9c4ecda3b8 (patch)
tree783b120382b134ba14fd6f2c8b1fae3550997f83
parent4d37d32e4ab5241554ab4a60ff8ee159ba48851c (diff)
ide-floppy: remove struct idefloppy_request_sense_result
While at it, collapse idefloppy_analyze_error() into idefloppy_request_sense_callback() since the latter was its only user. Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-floppy.c82
1 files changed, 24 insertions, 58 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index c346c2174d0b..98df4023ecdf 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -285,39 +285,6 @@ struct idefloppy_id_gcw {
285}; 285};
286 286
287/* 287/*
288 * REQUEST SENSE packet command result - Data Format.
289 */
290typedef struct {
291#if defined(__LITTLE_ENDIAN_BITFIELD)
292 unsigned error_code :7; /* Current error (0x70) */
293 unsigned valid :1; /* The information field conforms to SFF-8070i */
294 u8 reserved1 :8; /* Reserved */
295 unsigned sense_key :4; /* Sense Key */
296 unsigned reserved2_4 :1; /* Reserved */
297 unsigned ili :1; /* Incorrect Length Indicator */
298 unsigned reserved2_67 :2;
299#elif defined(__BIG_ENDIAN_BITFIELD)
300 unsigned valid :1; /* The information field conforms to SFF-8070i */
301 unsigned error_code :7; /* Current error (0x70) */
302 u8 reserved1 :8; /* Reserved */
303 unsigned reserved2_67 :2;
304 unsigned ili :1; /* Incorrect Length Indicator */
305 unsigned reserved2_4 :1; /* Reserved */
306 unsigned sense_key :4; /* Sense Key */
307#else
308#error "Bitfield endianness not defined! Check your byteorder.h"
309#endif
310 u32 information __attribute__ ((packed));
311 u8 asl; /* Additional sense length (n-7) */
312 u32 command_specific; /* Additional command specific information */
313 u8 asc; /* Additional Sense Code */
314 u8 ascq; /* Additional Sense Code Qualifier */
315 u8 replaceable_unit_code; /* Field Replaceable Unit Code */
316 u8 sksv[3];
317 u8 pad[2]; /* Padding to 20 bytes */
318} idefloppy_request_sense_result_t;
319
320/*
321 * Pages of the SELECT SENSE / MODE SENSE packet commands. 288 * Pages of the SELECT SENSE / MODE SENSE packet commands.
322 * See SFF-8070i spec. 289 * See SFF-8070i spec.
323 */ 290 */
@@ -533,39 +500,38 @@ static struct request *idefloppy_next_rq_storage (ide_drive_t *drive)
533 return (&floppy->rq_stack[floppy->rq_stack_index++]); 500 return (&floppy->rq_stack[floppy->rq_stack_index++]);
534} 501}
535 502
536/* 503static void idefloppy_request_sense_callback(ide_drive_t *drive)
537 * idefloppy_analyze_error is called on each failed packet command retry
538 * to analyze the request sense.
539 */
540static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_result_t *result)
541{
542 idefloppy_floppy_t *floppy = drive->driver_data;
543
544 floppy->sense_key = result->sense_key;
545 floppy->asc = result->asc;
546 floppy->ascq = result->ascq;
547 floppy->progress_indication = result->sksv[0] & 0x80 ?
548 (u16)get_unaligned((u16 *)(result->sksv+1)):0x10000;
549 if (floppy->failed_pc)
550 debug_log("pc = %x, sense key = %x, asc = %x, ascq = %x\n",
551 floppy->failed_pc->c[0], result->sense_key,
552 result->asc, result->ascq);
553 else
554 debug_log("sense key = %x, asc = %x, ascq = %x\n",
555 result->sense_key, result->asc, result->ascq);
556}
557
558static void idefloppy_request_sense_callback (ide_drive_t *drive)
559{ 504{
560 idefloppy_floppy_t *floppy = drive->driver_data; 505 idefloppy_floppy_t *floppy = drive->driver_data;
506 u8 *buf = floppy->pc->buffer;
561 507
562 debug_log("Reached %s\n", __func__); 508 debug_log("Reached %s\n", __func__);
563 509
564 if (!floppy->pc->error) { 510 if (!floppy->pc->error) {
565 idefloppy_analyze_error(drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer); 511 floppy->sense_key = buf[2] & 0x0F;
512 floppy->asc = buf[12];
513 floppy->ascq = buf[13];
514 floppy->progress_indication = buf[15] & 0x80 ?
515 (u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
516
517 if (floppy->failed_pc)
518 debug_log("pc = %x, sense key = %x, asc = %x,"
519 " ascq = %x\n",
520 floppy->failed_pc->c[0],
521 floppy->sense_key,
522 floppy->asc,
523 floppy->ascq);
524 else
525 debug_log("sense key = %x, asc = %x, ascq = %x\n",
526 floppy->sense_key,
527 floppy->asc,
528 floppy->ascq);
529
530
566 idefloppy_do_end_request(drive, 1, 0); 531 idefloppy_do_end_request(drive, 1, 0);
567 } else { 532 } else {
568 printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting request!\n"); 533 printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting"
534 " request!\n");
569 idefloppy_do_end_request(drive, 0, 0); 535 idefloppy_do_end_request(drive, 0, 0);
570 } 536 }
571} 537}