aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:41 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:41 -0400
commit0e3d84a500d4e1672332b4961b98c35f6168e6f1 (patch)
tree4beca6d0585900fcd43fb12c7852290c7477346b /drivers/ide/ide-iops.c
parent6982daf71ca9a0b0c36043315e1968b3cb709b7c (diff)
ide: factor out reset error reporting from reset_pollfunc()
Factor out reset error reporting from reset_pollfunc() to ide_reset_report_error() helper. While at it: - fix KERN_* printk() levels - remove 'switch ()' Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 925fd037cdde..91182ebed468 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -940,6 +940,25 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
940 return ide_stopped; 940 return ide_stopped;
941} 941}
942 942
943static void ide_reset_report_error(ide_hwif_t *hwif, u8 err)
944{
945 static const char *err_master_vals[] =
946 { NULL, "passed", "formatter device error",
947 "sector buffer error", "ECC circuitry error",
948 "controlling MPU error" };
949
950 u8 err_master = err & 0x7f;
951
952 printk(KERN_ERR "%s: reset: master: ", hwif->name);
953 if (err_master && err_master < 6)
954 printk(KERN_CONT "%s", err_master_vals[err_master]);
955 else
956 printk(KERN_CONT "error (0x%02x?)", err);
957 if (err & 0x80)
958 printk(KERN_CONT "; slave: failed");
959 printk(KERN_CONT "\n");
960}
961
943/* 962/*
944 * reset_pollfunc() gets invoked to poll the interface for completion every 50ms 963 * reset_pollfunc() gets invoked to poll the interface for completion every 50ms
945 * during an ide reset operation. If the drives have not yet responded, 964 * during an ide reset operation. If the drives have not yet responded,
@@ -975,31 +994,14 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
975 drive->failures++; 994 drive->failures++;
976 err = -EIO; 995 err = -EIO;
977 } else { 996 } else {
978 printk("%s: reset: ", hwif->name);
979 tmp = ide_read_error(drive); 997 tmp = ide_read_error(drive);
980 998
981 if (tmp == 1) { 999 if (tmp == 1) {
982 printk("success\n"); 1000 printk(KERN_INFO "%s: reset: success\n", hwif->name);
983 drive->failures = 0; 1001 drive->failures = 0;
984 } else { 1002 } else {
1003 ide_reset_report_error(hwif, tmp);
985 drive->failures++; 1004 drive->failures++;
986 printk("master: ");
987 switch (tmp & 0x7f) {
988 case 1: printk("passed");
989 break;
990 case 2: printk("formatter device error");
991 break;
992 case 3: printk("sector buffer error");
993 break;
994 case 4: printk("ECC circuitry error");
995 break;
996 case 5: printk("controlling MPU error");
997 break;
998 default:printk("error (0x%02x?)", tmp);
999 }
1000 if (tmp & 0x80)
1001 printk("; slave: failed");
1002 printk("\n");
1003 err = -EIO; 1005 err = -EIO;
1004 } 1006 }
1005 } 1007 }