Commit a6ff2d3b08fe0780063bb159c7beab9c4ecda3b8
Committed by
Bartlomiej Zolnierkiewicz
1 parent
4d37d32e4a
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 24 additions and 58 deletions Side-by-side Diff
drivers/ide/ide-floppy.c
... | ... | @@ -285,39 +285,6 @@ |
285 | 285 | }; |
286 | 286 | |
287 | 287 | /* |
288 | - * REQUEST SENSE packet command result - Data Format. | |
289 | - */ | |
290 | -typedef 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 | 288 | * Pages of the SELECT SENSE / MODE SENSE packet commands. |
322 | 289 | * See SFF-8070i spec. |
323 | 290 | */ |
324 | 291 | |
325 | 292 | |
326 | 293 | |
327 | 294 | |
... | ... | @@ -533,39 +500,38 @@ |
533 | 500 | return (&floppy->rq_stack[floppy->rq_stack_index++]); |
534 | 501 | } |
535 | 502 | |
536 | -/* | |
537 | - * idefloppy_analyze_error is called on each failed packet command retry | |
538 | - * to analyze the request sense. | |
539 | - */ | |
540 | -static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_result_t *result) | |
503 | +static void idefloppy_request_sense_callback(ide_drive_t *drive) | |
541 | 504 | { |
542 | 505 | idefloppy_floppy_t *floppy = drive->driver_data; |
506 | + u8 *buf = floppy->pc->buffer; | |
543 | 507 | |
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 | - | |
558 | -static void idefloppy_request_sense_callback (ide_drive_t *drive) | |
559 | -{ | |
560 | - idefloppy_floppy_t *floppy = drive->driver_data; | |
561 | - | |
562 | 508 | debug_log("Reached %s\n", __func__); |
563 | 509 | |
564 | 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 | 531 | idefloppy_do_end_request(drive, 1, 0); |
567 | 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 | 535 | idefloppy_do_end_request(drive, 0, 0); |
570 | 536 | } |
571 | 537 | } |