mmc: test: clean up mmc_test_cleanup()
PATCH 1/1 mmc: test: clean up mmc_test_cleanup()
From: Yue Hu <[email protected]>
mmc_test_cleanup() has same body as __mmc_test_prepare() with write except the character to memset().
Signed-off-by Yue Hu <[email protected]>
--- drivers/mmc/core/mmc_test.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/mmc/core/mmc_test.c +5 -19
@@ -624,7 +624,7 @@ static unsigned int mmc_test_capacity(struct mmc_card *card)* Fill the first couple of sectors of the card with known data * so that bad reads/writes can be detected */ -static int __mmc_test_prepare (struct mmc_test_card *test,int write) +static int __mmc_test_prepare (struct mmc_test_card *test,int write,int val) {int ret, i;
@@ -633,7 +633,7 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)return ret;if (write) -memset (test->buffer,0xDF ,512 ); +memset (test->buffer, val,512 );else {for (i =0 ; i <512 ; i++) test->buffer[i] = i;
@@ -650,31 +650,17 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)static int mmc_test_prepare_write (struct mmc_test_card *test) { -return __mmc_test_prepare (test,1 ); +return __mmc_test_prepare (test,1 ,0xDF ); }static int mmc_test_prepare_read (struct mmc_test_card *test) { -return __mmc_test_prepare (test,0 ); +return __mmc_test_prepare (test,0 ,0 ); }static int mmc_test_cleanup (struct mmc_test_card *test) { -int ret, i; - - ret =mmc_test_set_blksize (test,512 ); -if (ret) -return ret; - -memset (test->buffer,0 ,512 ); - -for (i =0 ; i <BUFFER_SIZE /512 ; i++) { - ret =mmc_test_buffer_transfer (test, test->buffer, i,512 ,1 ); -if (ret) -return ret; - } - -return 0 ; +return __mmc_test_prepare (test,1 ,0 ); }/*******************************************************************/
Signature · 1 line
1.9.1
Quoted 7 lines · Yue Hu
From: Yue Hu <[email protected]>
mmc_test_cleanup()has same body as__mmc_test_prepare()with write except the character tomemset().Signed-off-by Yue Hu <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 64 lines
--- drivers/mmc/core/mmc_test.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-)drivers/mmc/core/mmc_test.c +5
-20@@ -624,7 +624,7 @@ static unsigned int mmc_test_capacity(struct mmc_card *card)* Fill the first couple of sectors of the card with known data * so that bad reads/writes can be detected */ -static int __mmc_test_prepare (struct mmc_test_card *test,int write) +static int __mmc_test_prepare (struct mmc_test_card *test,int write,int val) {int ret, i;@@ -633,7 +633,7 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)return ret;if (write) -memset (test->buffer,0xDF ,512 ); +memset (test->buffer, val,512 );else {for (i =0 ; i <512 ; i++) test->buffer[i] = i;@@ -650,31 +650,17 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)static int mmc_test_prepare_write (struct mmc_test_card *test) { -return __mmc_test_prepare (test,1 ); +return __mmc_test_prepare (test,1 ,0xDF ); }static int mmc_test_prepare_read (struct mmc_test_card *test) { -return __mmc_test_prepare (test,0 ); +return __mmc_test_prepare (test,0 ,0 ); }static int mmc_test_cleanup (struct mmc_test_card *test) { -int ret, i; - - ret =mmc_test_set_blksize (test,512 ); -if (ret) -return ret; - -memset (test->buffer,0 ,512 ); - -for (i =0 ; i <BUFFER_SIZE /512 ; i++) { - ret =mmc_test_buffer_transfer (test, test->buffer, i,512 ,1 ); -if (ret) -return ret; - } - -return 0 ; +return __mmc_test_prepare (test,1 ,0 ); }/*******************************************************************/ --1.9.1