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 | |
parent | bc56811a0e1df3e7902b85cf2250d970e0a929d5 (diff) | |
download | rockbox-ff637c7641c7dca03ac8b1c73d3e0f6e01995fff.tar.gz rockbox-ff637c7641c7dca03ac8b1c73d3e0f6e01995fff.zip |
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')
-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; | |||
1514 | 1514 | ||
1515 | static const char * ata_smart_get_attr_name(unsigned char id) | 1515 | static const char * ata_smart_get_attr_name(unsigned char id) |
1516 | { | 1516 | { |
1517 | switch (id) | 1517 | if (id == 1) return "Raw Read Error Rate"; |
1518 | { | 1518 | if (id == 2) return "Throughput Performance"; |
1519 | case 1: return "Raw Read Error Rate"; | 1519 | if (id == 3) return "Spin-Up Time"; |
1520 | case 2: return "Throughput Performance"; | 1520 | if (id == 4) return "Start/Stop Count"; |
1521 | case 3: return "Spin-Up Time"; | 1521 | if (id == 5) return "Reallocated Sector Count"; |
1522 | case 4: return "Start/Stop Count"; | 1522 | if (id == 7) return "Seek Error Rate"; |
1523 | case 5: return "Reallocated Sector Count"; | 1523 | if (id == 8) return "Seek Time Performance"; |
1524 | case 7: return "Seek Error Rate"; | 1524 | if (id == 9) return "Power-On Hours Count"; |
1525 | case 8: return "Seek Time Performance"; | 1525 | if (id == 10) return "Spin-Up Retry Count"; |
1526 | case 9: return "Power-On Hours Count"; | 1526 | if (id == 12) return "Power Cycle Count"; |
1527 | case 10: return "Spin-Up Retry Count"; | 1527 | if (id == 191) return "G-Sense Error Rate"; |
1528 | case 12: return "Power Cycle Count"; | 1528 | if (id == 192) return "Power-Off Retract Count"; |
1529 | case 191: return "G-Sense Error Rate"; | 1529 | if (id == 193) return "Load/Unload Cycle Count"; |
1530 | case 192: return "Power-Off Retract Count"; | 1530 | if (id == 194) return "HDA Temperature"; |
1531 | case 193: return "Load/Unload Cycle Count"; | 1531 | if (id == 195) return "Hardware ECC Recovered"; |
1532 | case 194: return "HDA Temperature"; | 1532 | if (id == 196) return "Reallocated Event Count"; |
1533 | case 195: return "Hardware ECC Recovered"; | 1533 | if (id == 197) return "Current Pending Sector Count"; |
1534 | case 196: return "Reallocated Event Count"; | 1534 | if (id == 198) return "Uncorrectable Sector Count"; |
1535 | case 197: return "Current Pending Sector Count"; | 1535 | if (id == 199) return "UDMA CRC Error Count"; |
1536 | case 198: return "Uncorrectable Sector Count"; | 1536 | if (id == 200) return "Write Error Rate"; |
1537 | case 199: return "UDMA CRC Error Count"; | 1537 | if (id == 201) return "TA Counter Detected"; |
1538 | case 200: return "Write Error Rate"; | 1538 | if (id == 220) return "Disk Shift"; |
1539 | case 201: return "TA Counter Detected"; | 1539 | if (id == 222) return "Loaded Hours"; |
1540 | case 220: return "Disk Shift"; | 1540 | if (id == 223) return "Load/Unload Retry Count"; |
1541 | case 222: return "Loaded Hours"; | 1541 | if (id == 224) return "Load Friction"; |
1542 | case 223: return "Load/Unload Retry Count"; | 1542 | if (id == 225) return "Load Cycle Count"; |
1543 | case 224: return "Load Friction"; | 1543 | if (id == 226) return "Load-In Time"; |
1544 | case 225: return "Load Cycle Count"; | 1544 | if (id == 240) return "Transfer Error Rate"; /* Fujitsu */ |
1545 | case 226: return "Load-In Time"; | 1545 | return "Unknown Attribute"; |
1546 | case 240: return "Transfer Error Rate"; /* Fujitsu */ | ||
1547 | default: return "Unknown Attribute"; | ||
1548 | } | ||
1549 | }; | 1546 | }; |
1550 | 1547 | ||
1551 | static int ata_smart_get_attr_rawfmt(unsigned char id) | 1548 | static int ata_smart_get_attr_rawfmt(unsigned char id) |
1552 | { | 1549 | { |
1553 | switch (id) | 1550 | if (id == 3) /* Spin-up time */ |
1554 | { | 1551 | return RAWFMT_RAW16_OPT_AVG16; |
1555 | case 3: /* Spin-up time */ | ||
1556 | return RAWFMT_RAW16_OPT_AVG16; | ||
1557 | 1552 | ||
1558 | case 5: /* Reallocated sector count */ | 1553 | if (id == 5 || /* Reallocated sector count */ |
1559 | case 196: /* Reallocated event count */ | 1554 | id == 196) /* Reallocated event count */ |
1560 | return RAWFMT_RAW16_OPT_RAW16; | 1555 | return RAWFMT_RAW16_OPT_RAW16; |
1561 | 1556 | ||
1562 | case 190: /* Airflow Temperature */ | 1557 | if (id == 190 || /* Airflow Temperature */ |
1563 | case 194: /* HDA Temperature */ | 1558 | id == 194) /* HDA Temperature */ |
1564 | return RAWFMT_TEMPMINMAX; | 1559 | return RAWFMT_TEMPMINMAX; |
1565 | 1560 | ||
1566 | default: | 1561 | return RAWFMT_RAW48; |
1567 | return RAWFMT_RAW48; | ||
1568 | } | ||
1569 | }; | 1562 | }; |
1570 | 1563 | ||
1571 | static int ata_smart_attr_to_string( | 1564 | static int ata_smart_attr_to_string( |