diff options
author | Cástor Muñoz <cmvidal@gmail.com> | 2016-02-16 20:42:42 +0100 |
---|---|---|
committer | Cástor Muñoz <cmvidal@gmail.com> | 2016-02-16 21:42:24 +0100 |
commit | ff637c7641c7dca03ac8b1c73d3e0f6e01995fff (patch) | |
tree | 35ea4c887f2443478011edf090ec5cc8ba9bab20 /apps/debug_menu.c | |
parent | bc56811a0e1df3e7902b85cf2250d970e0a929d5 (diff) |
iPod Classic: size optmizations for HAVE_ATA_SMART
After commit e9497db the switch() in ata_smart_get_attr_name() is no
longer optimized by the compiler, ata_smart_get_attr_rawfmt() is also
updated to prevent that future additions will cause the same problem.
Change-Id: Ib0d6482331f567896720589a5a2d93628f2d8f3d
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 694252a897..57ba9f5d0a 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1514,58 +1514,51 @@ static struct ata_smart_values smart_data STORAGE_ALIGN_ATTR; static const char * ata_smart_get_attr_name(unsigned char id) { - switch (id) - { - case 1: return "Raw Read Error Rate"; - case 2: return "Throughput Performance"; - case 3: return "Spin-Up Time"; - case 4: return "Start/Stop Count"; - case 5: return "Reallocated Sector Count"; - case 7: return "Seek Error Rate"; - case 8: return "Seek Time Performance"; - case 9: return "Power-On Hours Count"; - case 10: return "Spin-Up Retry Count"; - case 12: return "Power Cycle Count"; - case 191: return "G-Sense Error Rate"; - case 192: return "Power-Off Retract Count"; - case 193: return "Load/Unload Cycle Count"; - case 194: return "HDA Temperature"; - case 195: return "Hardware ECC Recovered"; - case 196: return "Reallocated Event Count"; - case 197: return "Current Pending Sector Count"; - case 198: return "Uncorrectable Sector Count"; - case 199: return "UDMA CRC Error Count"; - case 200: return "Write Error Rate"; - case 201: return "TA Counter Detected"; - case 220: return "Disk Shift"; - case 222: return "Loaded Hours"; - case 223: return "Load/Unload Retry Count"; - case 224: return "Load Friction"; - case 225: return "Load Cycle Count"; - case 226: return "Load-In Time"; - case 240: return "Transfer Error Rate"; /* Fujitsu */ - default: return "Unknown Attribute"; - } + if (id == 1) return "Raw Read Error Rate"; + if (id == 2) return "Throughput Performance"; + if (id == 3) return "Spin-Up Time"; + if (id == 4) return "Start/Stop Count"; + if (id == 5) return "Reallocated Sector Count"; + if (id == 7) return "Seek Error Rate"; + if (id == 8) return "Seek Time Performance"; + if (id == 9) return "Power-On Hours Count"; + if (id == 10) return "Spin-Up Retry Count"; + if (id == 12) return "Power Cycle Count"; + if (id == 191) return "G-Sense Error Rate"; + if (id == 192) return "Power-Off Retract Count"; + if (id == 193) return "Load/Unload Cycle Count"; + if (id == 194) return "HDA Temperature"; + if (id == 195) return "Hardware ECC Recovered"; + if (id == 196) return "Reallocated Event Count"; + if (id == 197) return "Current Pending Sector Count"; + if (id == 198) return "Uncorrectable Sector Count"; + if (id == 199) return "UDMA CRC Error Count"; + if (id == 200) return "Write Error Rate"; + if (id == 201) return "TA Counter Detected"; + if (id == 220) return "Disk Shift"; + if (id == 222) return "Loaded Hours"; + if (id == 223) return "Load/Unload Retry Count"; + if (id == 224) return "Load Friction"; + if (id == 225) return "Load Cycle Count"; + if (id == 226) return "Load-In Time"; + if (id == 240) return "Transfer Error Rate"; /* Fujitsu */ + return "Unknown Attribute"; }; static int ata_smart_get_attr_rawfmt(unsigned char id) { - switch (id) - { - case 3: /* Spin-up time */ - return RAWFMT_RAW16_OPT_AVG16; + if (id == 3) /* Spin-up time */ + return RAWFMT_RAW16_OPT_AVG16; - case 5: /* Reallocated sector count */ - case 196: /* Reallocated event count */ - return RAWFMT_RAW16_OPT_RAW16; + if (id == 5 || /* Reallocated sector count */ + id == 196) /* Reallocated event count */ + return RAWFMT_RAW16_OPT_RAW16; - case 190: /* Airflow Temperature */ - case 194: /* HDA Temperature */ - return RAWFMT_TEMPMINMAX; + if (id == 190 || /* Airflow Temperature */ + id == 194) /* HDA Temperature */ + return RAWFMT_TEMPMINMAX; - default: - return RAWFMT_RAW48; - } + return RAWFMT_RAW48; }; static int ata_smart_attr_to_string( |