mirror of https://gitee.com/openkylin/linux.git
mmc: block: move packed command struct init
By moving the mmc_packed_init() and mmc_packed_clean() into the only file in the kernel where they are used, we save two exported functions and can staticize those to the block.c file. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
7db3028e00
commit
e01071dd2b
|
@ -1433,6 +1433,49 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
|
||||||
return MMC_BLK_SUCCESS;
|
return MMC_BLK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mmc_packed_init(struct mmc_queue *mq, struct mmc_card *card)
|
||||||
|
{
|
||||||
|
struct mmc_queue_req *mqrq_cur = &mq->mqrq[0];
|
||||||
|
struct mmc_queue_req *mqrq_prev = &mq->mqrq[1];
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
|
||||||
|
mqrq_cur->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL);
|
||||||
|
if (!mqrq_cur->packed) {
|
||||||
|
pr_warn("%s: unable to allocate packed cmd for mqrq_cur\n",
|
||||||
|
mmc_card_name(card));
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
mqrq_prev->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL);
|
||||||
|
if (!mqrq_prev->packed) {
|
||||||
|
pr_warn("%s: unable to allocate packed cmd for mqrq_prev\n",
|
||||||
|
mmc_card_name(card));
|
||||||
|
kfree(mqrq_cur->packed);
|
||||||
|
mqrq_cur->packed = NULL;
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&mqrq_cur->packed->list);
|
||||||
|
INIT_LIST_HEAD(&mqrq_prev->packed->list);
|
||||||
|
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mmc_packed_clean(struct mmc_queue *mq)
|
||||||
|
{
|
||||||
|
struct mmc_queue_req *mqrq_cur = &mq->mqrq[0];
|
||||||
|
struct mmc_queue_req *mqrq_prev = &mq->mqrq[1];
|
||||||
|
|
||||||
|
kfree(mqrq_cur->packed);
|
||||||
|
mqrq_cur->packed = NULL;
|
||||||
|
kfree(mqrq_prev->packed);
|
||||||
|
mqrq_prev->packed = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static enum mmc_blk_status mmc_blk_packed_err_check(struct mmc_card *card,
|
static enum mmc_blk_status mmc_blk_packed_err_check(struct mmc_card *card,
|
||||||
struct mmc_async_req *areq)
|
struct mmc_async_req *areq)
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,49 +362,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mmc_cleanup_queue);
|
EXPORT_SYMBOL(mmc_cleanup_queue);
|
||||||
|
|
||||||
int mmc_packed_init(struct mmc_queue *mq, struct mmc_card *card)
|
|
||||||
{
|
|
||||||
struct mmc_queue_req *mqrq_cur = &mq->mqrq[0];
|
|
||||||
struct mmc_queue_req *mqrq_prev = &mq->mqrq[1];
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
|
|
||||||
mqrq_cur->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL);
|
|
||||||
if (!mqrq_cur->packed) {
|
|
||||||
pr_warn("%s: unable to allocate packed cmd for mqrq_cur\n",
|
|
||||||
mmc_card_name(card));
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
mqrq_prev->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL);
|
|
||||||
if (!mqrq_prev->packed) {
|
|
||||||
pr_warn("%s: unable to allocate packed cmd for mqrq_prev\n",
|
|
||||||
mmc_card_name(card));
|
|
||||||
kfree(mqrq_cur->packed);
|
|
||||||
mqrq_cur->packed = NULL;
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&mqrq_cur->packed->list);
|
|
||||||
INIT_LIST_HEAD(&mqrq_prev->packed->list);
|
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mmc_packed_clean(struct mmc_queue *mq)
|
|
||||||
{
|
|
||||||
struct mmc_queue_req *mqrq_cur = &mq->mqrq[0];
|
|
||||||
struct mmc_queue_req *mqrq_prev = &mq->mqrq[1];
|
|
||||||
|
|
||||||
kfree(mqrq_cur->packed);
|
|
||||||
mqrq_cur->packed = NULL;
|
|
||||||
kfree(mqrq_prev->packed);
|
|
||||||
mqrq_prev->packed = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mmc_queue_suspend - suspend a MMC request queue
|
* mmc_queue_suspend - suspend a MMC request queue
|
||||||
* @mq: MMC queue to suspend
|
* @mq: MMC queue to suspend
|
||||||
|
|
|
@ -76,9 +76,6 @@ extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
|
||||||
extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
|
extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
|
||||||
extern void mmc_queue_bounce_post(struct mmc_queue_req *);
|
extern void mmc_queue_bounce_post(struct mmc_queue_req *);
|
||||||
|
|
||||||
extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
|
|
||||||
extern void mmc_packed_clean(struct mmc_queue *);
|
|
||||||
|
|
||||||
extern int mmc_access_rpmb(struct mmc_queue *);
|
extern int mmc_access_rpmb(struct mmc_queue *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue