diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2017-03-22 22:33:44 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-04-24 21:41:45 +0200 |
commit | 00412ddc4ae929419a64bc9766205aac0467e664 (patch) | |
tree | 6c0fe86200082a0b0fc4d43cd491a670b2c9f81d /drivers/mmc/host/meson-gx-mmc.c | |
parent | ec31e53c2aab68b93381b194f70626f082bbc9d0 (diff) | |
download | lwn-00412ddc4ae929419a64bc9766205aac0467e664.tar.gz lwn-00412ddc4ae929419a64bc9766205aac0467e664.zip |
mmc: meson-gx: replace cmd->data in meson_mmc_start_cmd
Replace cmd->data with a local variable to simplify code a little.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Diffstat (limited to 'drivers/mmc/host/meson-gx-mmc.c')
-rw-r--r-- | drivers/mmc/host/meson-gx-mmc.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 04a55577f1ab..1b20ec1a1a90 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -424,6 +424,7 @@ static void meson_mmc_request_done(struct mmc_host *mmc, static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) { struct meson_host *host = mmc_priv(mmc); + struct mmc_data *data = cmd->data; struct sd_emmc_desc *desc, desc_tmp; u32 cfg; u8 blk_len, cmd_cfg_timeout; @@ -456,41 +457,41 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) } /* data? */ - if (cmd->data) { + if (data) { desc->cmd_cfg |= CMD_CFG_DATA_IO; - if (cmd->data->blocks > 1) { + if (data->blocks > 1) { desc->cmd_cfg |= CMD_CFG_BLOCK_MODE; desc->cmd_cfg |= - (cmd->data->blocks & CMD_CFG_LENGTH_MASK) << + (data->blocks & CMD_CFG_LENGTH_MASK) << CMD_CFG_LENGTH_SHIFT; /* check if block-size matches, if not update */ cfg = readl(host->regs + SD_EMMC_CFG); blk_len = cfg & (CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); blk_len >>= CFG_BLK_LEN_SHIFT; - if (blk_len != ilog2(cmd->data->blksz)) { + if (blk_len != ilog2(data->blksz)) { dev_dbg(host->dev, "%s: update blk_len %d -> %d\n", __func__, blk_len, - ilog2(cmd->data->blksz)); - blk_len = ilog2(cmd->data->blksz); + ilog2(data->blksz)); + blk_len = ilog2(data->blksz); cfg &= ~(CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); cfg |= blk_len << CFG_BLK_LEN_SHIFT; writel(cfg, host->regs + SD_EMMC_CFG); } } else { desc->cmd_cfg |= - (cmd->data->blksz & CMD_CFG_LENGTH_MASK) << + (data->blksz & CMD_CFG_LENGTH_MASK) << CMD_CFG_LENGTH_SHIFT; } - cmd->data->bytes_xfered = 0; - xfer_bytes = cmd->data->blksz * cmd->data->blocks; - if (cmd->data->flags & MMC_DATA_WRITE) { + data->bytes_xfered = 0; + xfer_bytes = data->blksz * data->blocks; + if (data->flags & MMC_DATA_WRITE) { desc->cmd_cfg |= CMD_CFG_DATA_WR; WARN_ON(xfer_bytes > host->bounce_buf_size); - sg_copy_to_buffer(cmd->data->sg, cmd->data->sg_len, + sg_copy_to_buffer(data->sg, data->sg_len, host->bounce_buf, xfer_bytes); - cmd->data->bytes_xfered = xfer_bytes; + data->bytes_xfered = xfer_bytes; dma_wmb(); } |