aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-09-20 05:34:38 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-09-26 15:31:31 -0400
commit29eb7bd01e80df316ab9d1da1a4ee580fae89188 (patch)
treee665ba24917d0e009babbd5fe03fa25066f79513
parentc80f275fa1766cfdbc24c7a5d3d870df1fe730db (diff)
mmc: card: do away with indirection pointer
We have enough vtables in the kernel as it is, we don't need this one to create even more artificial separation of concerns. As is proved by the Makefile: obj-$(CONFIG_MMC_BLOCK) += mmc_block.o mmc_block-objs := block.o queue.o block.c and queue.c are baked into the same mmc_block.o object. So why would one of these objects access a function in the other object by dereferencing a pointer? Create a new block.h header file for the single shared function from block to queue and remove the function pointer and just call the queue request function. Apart from making the code more readable, this also makes link optimizations possible and probably speeds up the call as well. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/card/block.c3
-rw-r--r--drivers/mmc/card/block.h1
-rw-r--r--drivers/mmc/card/queue.c4
-rw-r--r--drivers/mmc/card/queue.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 03670aa5ac8e..c3335112e68c 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2144,7 +2144,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
2144 return 0; 2144 return 0;
2145} 2145}
2146 2146
2147static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) 2147int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
2148{ 2148{
2149 int ret; 2149 int ret;
2150 struct mmc_blk_data *md = mq->data; 2150 struct mmc_blk_data *md = mq->data;
@@ -2265,7 +2265,6 @@ again:
2265 if (ret) 2265 if (ret)
2266 goto err_putdisk; 2266 goto err_putdisk;
2267 2267
2268 md->queue.issue_fn = mmc_blk_issue_rq;
2269 md->queue.data = md; 2268 md->queue.data = md;
2270 2269
2271 md->disk->major = MMC_BLOCK_MAJOR; 2270 md->disk->major = MMC_BLOCK_MAJOR;
diff --git a/drivers/mmc/card/block.h b/drivers/mmc/card/block.h
new file mode 100644
index 000000000000..cdabb2ee74be
--- /dev/null
+++ b/drivers/mmc/card/block.h
@@ -0,0 +1 @@
int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 708057261b38..8037f73a109a 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -19,7 +19,9 @@
19 19
20#include <linux/mmc/card.h> 20#include <linux/mmc/card.h>
21#include <linux/mmc/host.h> 21#include <linux/mmc/host.h>
22
22#include "queue.h" 23#include "queue.h"
24#include "block.h"
23 25
24#define MMC_QUEUE_BOUNCESZ 65536 26#define MMC_QUEUE_BOUNCESZ 65536
25 27
@@ -68,7 +70,7 @@ static int mmc_queue_thread(void *d)
68 bool req_is_special = mmc_req_is_special(req); 70 bool req_is_special = mmc_req_is_special(req);
69 71
70 set_current_state(TASK_RUNNING); 72 set_current_state(TASK_RUNNING);
71 mq->issue_fn(mq, req); 73 mmc_blk_issue_rq(mq, req);
72 cond_resched(); 74 cond_resched();
73 if (mq->flags & MMC_QUEUE_NEW_REQUEST) { 75 if (mq->flags & MMC_QUEUE_NEW_REQUEST) {
74 mq->flags &= ~MMC_QUEUE_NEW_REQUEST; 76 mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index fee5e1271465..3c15a75bae86 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -57,8 +57,6 @@ struct mmc_queue {
57 unsigned int flags; 57 unsigned int flags;
58#define MMC_QUEUE_SUSPENDED (1 << 0) 58#define MMC_QUEUE_SUSPENDED (1 << 0)
59#define MMC_QUEUE_NEW_REQUEST (1 << 1) 59#define MMC_QUEUE_NEW_REQUEST (1 << 1)
60
61 int (*issue_fn)(struct mmc_queue *, struct request *);
62 void *data; 60 void *data;
63 struct request_queue *queue; 61 struct request_queue *queue;
64 struct mmc_queue_req mqrq[2]; 62 struct mmc_queue_req mqrq[2];