aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAndy Shevchenko <ext-andriy.shevchenko@nokia.com>2011-05-10 08:59:01 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 23:53:49 -0400
commit253d6a280f77a9b61a76f9b1bfb83545fbd58726 (patch)
tree789a8a45a28163ded5d9c52e490d603b9ea001e4 /drivers/mmc
parentaea253ecffecd38b5ab97edd73fbe2842a7de371 (diff)
mmc: mmc_test: minor clean up, use t = &test.area everywhere
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/mmc_test.c75
1 files changed, 44 insertions, 31 deletions
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 35252c1e7a20..233cdfae92f4 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1386,8 +1386,9 @@ static int mmc_test_area_io(struct mmc_test_card *test, unsigned long sz,
1386 */ 1386 */
1387static int mmc_test_area_fill(struct mmc_test_card *test) 1387static int mmc_test_area_fill(struct mmc_test_card *test)
1388{ 1388{
1389 return mmc_test_area_io(test, test->area.max_tfr, test->area.dev_addr, 1389 struct mmc_test_area *t = &test->area;
1390 1, 0, 0); 1390
1391 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, 1, 0, 0);
1391} 1392}
1392 1393
1393/* 1394/*
@@ -1400,7 +1401,7 @@ static int mmc_test_area_erase(struct mmc_test_card *test)
1400 if (!mmc_can_erase(test->card)) 1401 if (!mmc_can_erase(test->card))
1401 return 0; 1402 return 0;
1402 1403
1403 return mmc_erase(test->card, t->dev_addr, test->area.max_sz >> 9, 1404 return mmc_erase(test->card, t->dev_addr, t->max_sz >> 9,
1404 MMC_ERASE_ARG); 1405 MMC_ERASE_ARG);
1405} 1406}
1406 1407
@@ -1527,8 +1528,10 @@ static int mmc_test_area_prepare_fill(struct mmc_test_card *test)
1527static int mmc_test_best_performance(struct mmc_test_card *test, int write, 1528static int mmc_test_best_performance(struct mmc_test_card *test, int write,
1528 int max_scatter) 1529 int max_scatter)
1529{ 1530{
1530 return mmc_test_area_io(test, test->area.max_tfr, test->area.dev_addr, 1531 struct mmc_test_area *t = &test->area;
1531 write, max_scatter, 1); 1532
1533 return mmc_test_area_io(test, t->max_tfr, t->dev_addr, write,
1534 max_scatter, 1);
1532} 1535}
1533 1536
1534/* 1537/*
@@ -1568,18 +1571,19 @@ static int mmc_test_best_write_perf_max_scatter(struct mmc_test_card *test)
1568 */ 1571 */
1569static int mmc_test_profile_read_perf(struct mmc_test_card *test) 1572static int mmc_test_profile_read_perf(struct mmc_test_card *test)
1570{ 1573{
1574 struct mmc_test_area *t = &test->area;
1571 unsigned long sz; 1575 unsigned long sz;
1572 unsigned int dev_addr; 1576 unsigned int dev_addr;
1573 int ret; 1577 int ret;
1574 1578
1575 for (sz = 512; sz < test->area.max_tfr; sz <<= 1) { 1579 for (sz = 512; sz < t->max_tfr; sz <<= 1) {
1576 dev_addr = test->area.dev_addr + (sz >> 9); 1580 dev_addr = t->dev_addr + (sz >> 9);
1577 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); 1581 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 1);
1578 if (ret) 1582 if (ret)
1579 return ret; 1583 return ret;
1580 } 1584 }
1581 sz = test->area.max_tfr; 1585 sz = t->max_tfr;
1582 dev_addr = test->area.dev_addr; 1586 dev_addr = t->dev_addr;
1583 return mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); 1587 return mmc_test_area_io(test, sz, dev_addr, 0, 0, 1);
1584} 1588}
1585 1589
@@ -1588,6 +1592,7 @@ static int mmc_test_profile_read_perf(struct mmc_test_card *test)
1588 */ 1592 */
1589static int mmc_test_profile_write_perf(struct mmc_test_card *test) 1593static int mmc_test_profile_write_perf(struct mmc_test_card *test)
1590{ 1594{
1595 struct mmc_test_area *t = &test->area;
1591 unsigned long sz; 1596 unsigned long sz;
1592 unsigned int dev_addr; 1597 unsigned int dev_addr;
1593 int ret; 1598 int ret;
@@ -1595,8 +1600,8 @@ static int mmc_test_profile_write_perf(struct mmc_test_card *test)
1595 ret = mmc_test_area_erase(test); 1600 ret = mmc_test_area_erase(test);
1596 if (ret) 1601 if (ret)
1597 return ret; 1602 return ret;
1598 for (sz = 512; sz < test->area.max_tfr; sz <<= 1) { 1603 for (sz = 512; sz < t->max_tfr; sz <<= 1) {
1599 dev_addr = test->area.dev_addr + (sz >> 9); 1604 dev_addr = t->dev_addr + (sz >> 9);
1600 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); 1605 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 1);
1601 if (ret) 1606 if (ret)
1602 return ret; 1607 return ret;
@@ -1604,8 +1609,8 @@ static int mmc_test_profile_write_perf(struct mmc_test_card *test)
1604 ret = mmc_test_area_erase(test); 1609 ret = mmc_test_area_erase(test);
1605 if (ret) 1610 if (ret)
1606 return ret; 1611 return ret;
1607 sz = test->area.max_tfr; 1612 sz = t->max_tfr;
1608 dev_addr = test->area.dev_addr; 1613 dev_addr = t->dev_addr;
1609 return mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); 1614 return mmc_test_area_io(test, sz, dev_addr, 1, 0, 1);
1610} 1615}
1611 1616
@@ -1614,6 +1619,7 @@ static int mmc_test_profile_write_perf(struct mmc_test_card *test)
1614 */ 1619 */
1615static int mmc_test_profile_trim_perf(struct mmc_test_card *test) 1620static int mmc_test_profile_trim_perf(struct mmc_test_card *test)
1616{ 1621{
1622 struct mmc_test_area *t = &test->area;
1617 unsigned long sz; 1623 unsigned long sz;
1618 unsigned int dev_addr; 1624 unsigned int dev_addr;
1619 struct timespec ts1, ts2; 1625 struct timespec ts1, ts2;
@@ -1625,8 +1631,8 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test)
1625 if (!mmc_can_erase(test->card)) 1631 if (!mmc_can_erase(test->card))
1626 return RESULT_UNSUP_HOST; 1632 return RESULT_UNSUP_HOST;
1627 1633
1628 for (sz = 512; sz < test->area.max_sz; sz <<= 1) { 1634 for (sz = 512; sz < t->max_sz; sz <<= 1) {
1629 dev_addr = test->area.dev_addr + (sz >> 9); 1635 dev_addr = t->dev_addr + (sz >> 9);
1630 getnstimeofday(&ts1); 1636 getnstimeofday(&ts1);
1631 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); 1637 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG);
1632 if (ret) 1638 if (ret)
@@ -1634,7 +1640,7 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test)
1634 getnstimeofday(&ts2); 1640 getnstimeofday(&ts2);
1635 mmc_test_print_rate(test, sz, &ts1, &ts2); 1641 mmc_test_print_rate(test, sz, &ts1, &ts2);
1636 } 1642 }
1637 dev_addr = test->area.dev_addr; 1643 dev_addr = t->dev_addr;
1638 getnstimeofday(&ts1); 1644 getnstimeofday(&ts1);
1639 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); 1645 ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG);
1640 if (ret) 1646 if (ret)
@@ -1646,12 +1652,13 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test)
1646 1652
1647static int mmc_test_seq_read_perf(struct mmc_test_card *test, unsigned long sz) 1653static int mmc_test_seq_read_perf(struct mmc_test_card *test, unsigned long sz)
1648{ 1654{
1655 struct mmc_test_area *t = &test->area;
1649 unsigned int dev_addr, i, cnt; 1656 unsigned int dev_addr, i, cnt;
1650 struct timespec ts1, ts2; 1657 struct timespec ts1, ts2;
1651 int ret; 1658 int ret;
1652 1659
1653 cnt = test->area.max_sz / sz; 1660 cnt = t->max_sz / sz;
1654 dev_addr = test->area.dev_addr; 1661 dev_addr = t->dev_addr;
1655 getnstimeofday(&ts1); 1662 getnstimeofday(&ts1);
1656 for (i = 0; i < cnt; i++) { 1663 for (i = 0; i < cnt; i++) {
1657 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 0); 1664 ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 0);
@@ -1669,20 +1676,22 @@ static int mmc_test_seq_read_perf(struct mmc_test_card *test, unsigned long sz)
1669 */ 1676 */
1670static int mmc_test_profile_seq_read_perf(struct mmc_test_card *test) 1677static int mmc_test_profile_seq_read_perf(struct mmc_test_card *test)
1671{ 1678{
1679 struct mmc_test_area *t = &test->area;
1672 unsigned long sz; 1680 unsigned long sz;
1673 int ret; 1681 int ret;
1674 1682
1675 for (sz = 512; sz < test->area.max_tfr; sz <<= 1) { 1683 for (sz = 512; sz < t->max_tfr; sz <<= 1) {
1676 ret = mmc_test_seq_read_perf(test, sz); 1684 ret = mmc_test_seq_read_perf(test, sz);
1677 if (ret) 1685 if (ret)
1678 return ret; 1686 return ret;
1679 } 1687 }
1680 sz = test->area.max_tfr; 1688 sz = t->max_tfr;
1681 return mmc_test_seq_read_perf(test, sz); 1689 return mmc_test_seq_read_perf(test, sz);
1682} 1690}
1683 1691
1684static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz) 1692static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz)
1685{ 1693{
1694 struct mmc_test_area *t = &test->area;
1686 unsigned int dev_addr, i, cnt; 1695 unsigned int dev_addr, i, cnt;
1687 struct timespec ts1, ts2; 1696 struct timespec ts1, ts2;
1688 int ret; 1697 int ret;
@@ -1690,8 +1699,8 @@ static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz)
1690 ret = mmc_test_area_erase(test); 1699 ret = mmc_test_area_erase(test);
1691 if (ret) 1700 if (ret)
1692 return ret; 1701 return ret;
1693 cnt = test->area.max_sz / sz; 1702 cnt = t->max_sz / sz;
1694 dev_addr = test->area.dev_addr; 1703 dev_addr = t->dev_addr;
1695 getnstimeofday(&ts1); 1704 getnstimeofday(&ts1);
1696 for (i = 0; i < cnt; i++) { 1705 for (i = 0; i < cnt; i++) {
1697 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 0); 1706 ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 0);
@@ -1709,15 +1718,16 @@ static int mmc_test_seq_write_perf(struct mmc_test_card *test, unsigned long sz)
1709 */ 1718 */
1710static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test) 1719static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test)
1711{ 1720{
1721 struct mmc_test_area *t = &test->area;
1712 unsigned long sz; 1722 unsigned long sz;
1713 int ret; 1723 int ret;
1714 1724
1715 for (sz = 512; sz < test->area.max_tfr; sz <<= 1) { 1725 for (sz = 512; sz < t->max_tfr; sz <<= 1) {
1716 ret = mmc_test_seq_write_perf(test, sz); 1726 ret = mmc_test_seq_write_perf(test, sz);
1717 if (ret) 1727 if (ret)
1718 return ret; 1728 return ret;
1719 } 1729 }
1720 sz = test->area.max_tfr; 1730 sz = t->max_tfr;
1721 return mmc_test_seq_write_perf(test, sz); 1731 return mmc_test_seq_write_perf(test, sz);
1722} 1732}
1723 1733
@@ -1726,6 +1736,7 @@ static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test)
1726 */ 1736 */
1727static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) 1737static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test)
1728{ 1738{
1739 struct mmc_test_area *t = &test->area;
1729 unsigned long sz; 1740 unsigned long sz;
1730 unsigned int dev_addr, i, cnt; 1741 unsigned int dev_addr, i, cnt;
1731 struct timespec ts1, ts2; 1742 struct timespec ts1, ts2;
@@ -1737,15 +1748,15 @@ static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test)
1737 if (!mmc_can_erase(test->card)) 1748 if (!mmc_can_erase(test->card))
1738 return RESULT_UNSUP_HOST; 1749 return RESULT_UNSUP_HOST;
1739 1750
1740 for (sz = 512; sz <= test->area.max_sz; sz <<= 1) { 1751 for (sz = 512; sz <= t->max_sz; sz <<= 1) {
1741 ret = mmc_test_area_erase(test); 1752 ret = mmc_test_area_erase(test);
1742 if (ret) 1753 if (ret)
1743 return ret; 1754 return ret;
1744 ret = mmc_test_area_fill(test); 1755 ret = mmc_test_area_fill(test);
1745 if (ret) 1756 if (ret)
1746 return ret; 1757 return ret;
1747 cnt = test->area.max_sz / sz; 1758 cnt = t->max_sz / sz;
1748 dev_addr = test->area.dev_addr; 1759 dev_addr = t->dev_addr;
1749 getnstimeofday(&ts1); 1760 getnstimeofday(&ts1);
1750 for (i = 0; i < cnt; i++) { 1761 for (i = 0; i < cnt; i++) {
1751 ret = mmc_erase(test->card, dev_addr, sz >> 9, 1762 ret = mmc_erase(test->card, dev_addr, sz >> 9,
@@ -1808,11 +1819,12 @@ static int mmc_test_rnd_perf(struct mmc_test_card *test, int write, int print,
1808 1819
1809static int mmc_test_random_perf(struct mmc_test_card *test, int write) 1820static int mmc_test_random_perf(struct mmc_test_card *test, int write)
1810{ 1821{
1822 struct mmc_test_area *t = &test->area;
1811 unsigned int next; 1823 unsigned int next;
1812 unsigned long sz; 1824 unsigned long sz;
1813 int ret; 1825 int ret;
1814 1826
1815 for (sz = 512; sz < test->area.max_tfr; sz <<= 1) { 1827 for (sz = 512; sz < t->max_tfr; sz <<= 1) {
1816 /* 1828 /*
1817 * When writing, try to get more consistent results by running 1829 * When writing, try to get more consistent results by running
1818 * the test twice with exactly the same I/O but outputting the 1830 * the test twice with exactly the same I/O but outputting the
@@ -1829,7 +1841,7 @@ static int mmc_test_random_perf(struct mmc_test_card *test, int write)
1829 if (ret) 1841 if (ret)
1830 return ret; 1842 return ret;
1831 } 1843 }
1832 sz = test->area.max_tfr; 1844 sz = t->max_tfr;
1833 if (write) { 1845 if (write) {
1834 next = rnd_next; 1846 next = rnd_next;
1835 ret = mmc_test_rnd_perf(test, write, 0, sz); 1847 ret = mmc_test_rnd_perf(test, write, 0, sz);
@@ -1859,17 +1871,18 @@ static int mmc_test_random_write_perf(struct mmc_test_card *test)
1859static int mmc_test_seq_perf(struct mmc_test_card *test, int write, 1871static int mmc_test_seq_perf(struct mmc_test_card *test, int write,
1860 unsigned int tot_sz, int max_scatter) 1872 unsigned int tot_sz, int max_scatter)
1861{ 1873{
1874 struct mmc_test_area *t = &test->area;
1862 unsigned int dev_addr, i, cnt, sz, ssz; 1875 unsigned int dev_addr, i, cnt, sz, ssz;
1863 struct timespec ts1, ts2; 1876 struct timespec ts1, ts2;
1864 int ret; 1877 int ret;
1865 1878
1866 sz = test->area.max_tfr; 1879 sz = t->max_tfr;
1880
1867 /* 1881 /*
1868 * In the case of a maximally scattered transfer, the maximum transfer 1882 * In the case of a maximally scattered transfer, the maximum transfer
1869 * size is further limited by using PAGE_SIZE segments. 1883 * size is further limited by using PAGE_SIZE segments.
1870 */ 1884 */
1871 if (max_scatter) { 1885 if (max_scatter) {
1872 struct mmc_test_area *t = &test->area;
1873 unsigned long max_tfr; 1886 unsigned long max_tfr;
1874 1887
1875 if (t->max_seg_sz >= PAGE_SIZE) 1888 if (t->max_seg_sz >= PAGE_SIZE)