mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
mmc: mediatek: use data instead of mrq parameter from msdc_{un}prepare_data()
[ Upstream commit 151071351bb6f3d1861e99a22c4cebadf81911a0 ] We already have 'mrq->data' before calling these two functions, no need to find it again via 'mrq->data' internally. Also remove local data variable accordingly. Signed-off-by: Yue Hu <huyue2@yulong.com> Link: https://lore.kernel.org/r/20210517100900.1620-1-zbestahu@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Stable-dep-of: f5de469990f1 ("mtk-sd: Prevent memory corruption from DMA map failure") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a3cd5ae7be
commit
0f495797f5
1 changed files with 8 additions and 12 deletions
|
|
@ -676,10 +676,8 @@ static inline void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma,
|
|||
writel(lower_32_bits(dma->gpd_addr), host->base + MSDC_DMA_SA);
|
||||
}
|
||||
|
||||
static void msdc_prepare_data(struct msdc_host *host, struct mmc_request *mrq)
|
||||
static void msdc_prepare_data(struct msdc_host *host, struct mmc_data *data)
|
||||
{
|
||||
struct mmc_data *data = mrq->data;
|
||||
|
||||
if (!(data->host_cookie & MSDC_PREPARE_FLAG)) {
|
||||
data->sg_count = dma_map_sg(host->dev, data->sg, data->sg_len,
|
||||
mmc_get_dma_dir(data));
|
||||
|
|
@ -688,10 +686,8 @@ static void msdc_prepare_data(struct msdc_host *host, struct mmc_request *mrq)
|
|||
}
|
||||
}
|
||||
|
||||
static void msdc_unprepare_data(struct msdc_host *host, struct mmc_request *mrq)
|
||||
static void msdc_unprepare_data(struct msdc_host *host, struct mmc_data *data)
|
||||
{
|
||||
struct mmc_data *data = mrq->data;
|
||||
|
||||
if (data->host_cookie & MSDC_ASYNC_FLAG)
|
||||
return;
|
||||
|
||||
|
|
@ -1034,7 +1030,7 @@ static void msdc_request_done(struct msdc_host *host, struct mmc_request *mrq)
|
|||
|
||||
msdc_track_cmd_data(host, mrq->cmd, mrq->data);
|
||||
if (mrq->data)
|
||||
msdc_unprepare_data(host, mrq);
|
||||
msdc_unprepare_data(host, mrq->data);
|
||||
if (host->error)
|
||||
msdc_reset_hw(host);
|
||||
mmc_request_done(host->mmc, mrq);
|
||||
|
|
@ -1203,7 +1199,7 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq)
|
|||
host->mrq = mrq;
|
||||
|
||||
if (mrq->data)
|
||||
msdc_prepare_data(host, mrq);
|
||||
msdc_prepare_data(host, mrq->data);
|
||||
|
||||
/* if SBC is required, we have HW option and SW option.
|
||||
* if HW option is enabled, and SBC does not have "special" flags,
|
||||
|
|
@ -1224,7 +1220,7 @@ static void msdc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq)
|
|||
if (!data)
|
||||
return;
|
||||
|
||||
msdc_prepare_data(host, mrq);
|
||||
msdc_prepare_data(host, data);
|
||||
data->host_cookie |= MSDC_ASYNC_FLAG;
|
||||
}
|
||||
|
||||
|
|
@ -1232,14 +1228,14 @@ static void msdc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
|
|||
int err)
|
||||
{
|
||||
struct msdc_host *host = mmc_priv(mmc);
|
||||
struct mmc_data *data;
|
||||
struct mmc_data *data = mrq->data;
|
||||
|
||||
data = mrq->data;
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
if (data->host_cookie) {
|
||||
data->host_cookie &= ~MSDC_ASYNC_FLAG;
|
||||
msdc_unprepare_data(host, mrq);
|
||||
msdc_unprepare_data(host, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue