From 240fa5757e9c784679b391ba42ec58e70fe856d9 Mon Sep 17 00:00:00 2001
From: Konstantin Dorfman <kdorfman@codeaurora.org>
Date: Mon, 26 Nov 2012 11:50:35 +0200
Subject: [RFC/PATCH] mmc_test: fix non-blocking req test to support mmc core
wait_event mechanism
After introduce new wait_event synchronization mechanism at mmc/core/core.c level,
non-blocking request tests from mmc_test ut module are broken.
This patch fixes the tests by updating test environment to work
correctly on top of new wait_event mechanism.
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
@@ -764,7 +764,8 @@ static int mmc_test_check_broken_result(struct mmc_test_card *test,
static void mmc_test_nonblock_reset(struct mmc_request *mrq,
struct mmc_command *cmd,
struct mmc_command *stop,
- struct mmc_data *data)
+ struct mmc_data *data,
+ struct mmc_context_info *context_info)
{
memset(mrq, 0, sizeof(struct mmc_request));
memset(cmd, 0, sizeof(struct mmc_command));
@@ -774,6 +775,7 @@ static void mmc_test_nonblock_reset(struct mmc_request *mrq,
mrq->cmd = cmd;
mrq->data = data;
mrq->stop = stop;
+ mrq->context_info = context_info;
}
static int mmc_test_nonblock_transfer(struct mmc_test_card *test,
struct scatterlist *sg, unsigned sg_len,
@@ -790,6 +792,8 @@ static int mmc_test_nonblock_transfer(struct mmc_test_card *test,
struct mmc_command stop2;
struct mmc_data data2;
+ struct mmc_context_info context_info;
+
struct mmc_test_async_req test_areq[2];
struct mmc_async_req *done_areq;
struct mmc_async_req *cur_areq = &test_areq[0].areq;
@@ -800,14 +804,18 @@ static int mmc_test_nonblock_transfer(struct mmc_test_card *test,
test_areq[0].test = test;
test_areq[1].test = test;
- mmc_test_nonblock_reset(&mrq1, &cmd1, &stop1, &data1);
- mmc_test_nonblock_reset(&mrq2, &cmd2, &stop2, &data2);
+ memset(&context_info, 0, sizeof(struct mmc_context_info));
+
+ mmc_test_nonblock_reset(&mrq1, &cmd1, &stop1, &data1, &context_info);
+ mmc_test_nonblock_reset(&mrq2, &cmd2, &stop2, &data2, &context_info);
cur_areq->mrq = &mrq1;
cur_areq->err_check = mmc_test_check_result_async;
other_areq->mrq = &mrq2;
other_areq->err_check = mmc_test_check_result_async;
+ spin_lock_init(&context_info.lock);
+ init_waitqueue_head(&context_info.wait);
for (i = 0; i < count; i++) {
mmc_test_prepare_mrq(test, cur_areq->mrq, sg, sg_len, dev_addr,
blocks, blksz, write);
@@ -819,10 +827,10 @@ static int mmc_test_nonblock_transfer(struct mmc_test_card *test,
if (done_areq) {
if (done_areq->mrq == &mrq2)
mmc_test_nonblock_reset(&mrq2, &cmd2,
- &stop2, &data2);
+ &stop2, &data2, &context_info);
else
mmc_test_nonblock_reset(&mrq1, &cmd1,
- &stop1, &data1);
+ &stop1, &data1, &context_info);
}
done_areq = cur_areq;
cur_areq = other_areq;
--
1.7.6