Commit 77bcf0fa authored by Matt Domsch's avatar Matt Domsch Committed by Linus Torvalds

[PATCH] idefloppy: suppress media not present errors

Below is a patch to suppress printing uninformative errors from
ide-floppy.c in response to commands to floppy drives in which no media is
present.

Without this patch, commands sent to ide-floppy devices without media
inserted cause error messages on the console (KERN_ERR level) such as:

ide-floppy: ide: I/O error, pc = 0 key = 2, asc = 3a asq = 0
ide-floppy: ide: I/O error, pc = 1b key = 2, asc = 3a asq = 0
ide-floppy: ide: I/O error, pc = 23 key = 2, asc = 3a asq = 0
ide-floppy: ide: I/O error, pc = 1e key = 2, asc = 3a asq = 0
ide-floppy: ide: I/O error, pc = 1e key = 2, asc = 3a asq = 0

Dell's Virtual Floppy (system management presents to the local system an
IDE floppy device, which is actually a floppy device in a remote system
connected over an IP link) exhibits this also, when connecting to a remote
floppy drive with no media present.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d537dd3d
...@@ -989,6 +989,20 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) ...@@ -989,6 +989,20 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
return ide_started; return ide_started;
} }
/**
* idefloppy_should_report_error()
*
* Supresses error messages resulting from Medium not present
*/
static inline int idefloppy_should_report_error(idefloppy_floppy_t *floppy)
{
if (floppy->sense_key == 0x02 &&
floppy->asc == 0x3a &&
floppy->ascq == 0x00)
return 0;
return 1;
}
/* /*
* Issue a packet command * Issue a packet command
*/ */
...@@ -1022,12 +1036,13 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1022,12 +1036,13 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
*/ */
if (!test_bit(PC_ABORT, &pc->flags)) { if (!test_bit(PC_ABORT, &pc->flags)) {
if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags)) { if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags)) {
printk(KERN_ERR "ide-floppy: %s: I/O error, " if (idefloppy_should_report_error(floppy))
"pc = %2x, key = %2x, " printk(KERN_ERR "ide-floppy: %s: I/O error, "
"asc = %2x, ascq = %2x\n", "pc = %2x, key = %2x, "
drive->name, pc->c[0], "asc = %2x, ascq = %2x\n",
floppy->sense_key, drive->name, pc->c[0],
floppy->asc, floppy->ascq); floppy->sense_key,
floppy->asc, floppy->ascq);
} }
/* Giving up */ /* Giving up */
pc->error = IDEFLOPPY_ERROR_GENERAL; pc->error = IDEFLOPPY_ERROR_GENERAL;
...@@ -1238,11 +1253,13 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request ...@@ -1238,11 +1253,13 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request
rq->nr_sectors, rq->current_nr_sectors); rq->nr_sectors, rq->current_nr_sectors);
if (rq->errors >= ERROR_MAX) { if (rq->errors >= ERROR_MAX) {
if (floppy->failed_pc != NULL) if (floppy->failed_pc != NULL) {
printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x," if (idefloppy_should_report_error(floppy))
" key = %2x, asc = %2x, ascq = %2x\n", printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x,"
drive->name, floppy->failed_pc->c[0], " key = %2x, asc = %2x, ascq = %2x\n",
floppy->sense_key, floppy->asc, floppy->ascq); drive->name, floppy->failed_pc->c[0],
floppy->sense_key, floppy->asc, floppy->ascq);
}
else else
printk(KERN_ERR "ide-floppy: %s: I/O error\n", printk(KERN_ERR "ide-floppy: %s: I/O error\n",
drive->name); drive->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment