diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
commit | a56f1ca1ed63b93eb61fd5319f47347b3eb1e364 (patch) | |
tree | 62a253ba44b23c1867cef59fee40b40092719ee1 /firmware/target/arm/as3525/sd-as3525.c | |
parent | c13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682 (diff) | |
download | rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.gz rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.zip |
Cleanup MV/MD macros a little.
When using variadic macros there's no need for IF_MD2/IF_MV2 to deal
with function parameters. IF_MD/IF_MV are enough.
Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0
if not.
Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 5bed36e51e..c80c7f7491 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -693,7 +693,7 @@ static int sd_select_bank(signed char bank) | |||
693 | return 0; | 693 | return 0; |
694 | } | 694 | } |
695 | 695 | ||
696 | static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | 696 | static int sd_transfer_sectors(IF_MD(int drive,) unsigned long start, |
697 | int count, void* buf, const bool write) | 697 | int count, void* buf, const bool write) |
698 | { | 698 | { |
699 | #ifndef HAVE_MULTIDRIVE | 699 | #ifndef HAVE_MULTIDRIVE |
@@ -887,19 +887,19 @@ sd_transfer_error_nodma: | |||
887 | return ret; | 887 | return ret; |
888 | } | 888 | } |
889 | 889 | ||
890 | int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count, | 890 | int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count, |
891 | void* buf) | 891 | void* buf) |
892 | { | 892 | { |
893 | int ret; | 893 | int ret; |
894 | 894 | ||
895 | mutex_lock(&sd_mtx); | 895 | mutex_lock(&sd_mtx); |
896 | ret = sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false); | 896 | ret = sd_transfer_sectors(IF_MD(drive,) start, count, buf, false); |
897 | mutex_unlock(&sd_mtx); | 897 | mutex_unlock(&sd_mtx); |
898 | 898 | ||
899 | return ret; | 899 | return ret; |
900 | } | 900 | } |
901 | 901 | ||
902 | int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, | 902 | int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count, |
903 | const void* buf) | 903 | const void* buf) |
904 | { | 904 | { |
905 | #ifdef VERIFY_WRITE | 905 | #ifdef VERIFY_WRITE |
@@ -911,7 +911,7 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, | |||
911 | 911 | ||
912 | mutex_lock(&sd_mtx); | 912 | mutex_lock(&sd_mtx); |
913 | 913 | ||
914 | ret = sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true); | 914 | ret = sd_transfer_sectors(IF_MD(drive,) start, count, (void*)buf, true); |
915 | 915 | ||
916 | #ifdef VERIFY_WRITE | 916 | #ifdef VERIFY_WRITE |
917 | if (ret) { | 917 | if (ret) { |
@@ -928,10 +928,10 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, | |||
928 | if(transfer > UNALIGNED_NUM_SECTORS) | 928 | if(transfer > UNALIGNED_NUM_SECTORS) |
929 | transfer = UNALIGNED_NUM_SECTORS; | 929 | transfer = UNALIGNED_NUM_SECTORS; |
930 | 930 | ||
931 | sd_transfer_sectors(IF_MD2(drive,) start, transfer, aligned_buffer, false); | 931 | sd_transfer_sectors(IF_MD(drive,) start, transfer, aligned_buffer, false); |
932 | if (memcmp(buf, aligned_buffer, transfer * 512) != 0) { | 932 | if (memcmp(buf, aligned_buffer, transfer * 512) != 0) { |
933 | /* try the write again in the hope to repair the damage */ | 933 | /* try the write again in the hope to repair the damage */ |
934 | sd_transfer_sectors(IF_MD2(drive,) saved_start, saved_count, saved_buf, true); | 934 | sd_transfer_sectors(IF_MD(drive,) saved_start, saved_count, saved_buf, true); |
935 | panicf("sd: verify failed: sec=%ld n=%d!", start, transfer); | 935 | panicf("sd: verify failed: sec=%ld n=%d!", start, transfer); |
936 | } | 936 | } |
937 | 937 | ||