From: hkallweit1@gmail.com (Heiner Kallweit)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 2/6] mmc: meson-gx: replace cmd->data in meson_mmc_start_cmd
Date: Wed, 22 Mar 2017 22:33:44 +0100 [thread overview]
Message-ID: <8c9c00f8-fd74-c9ae-552e-f518ae7844ce@gmail.com> (raw)
In-Reply-To: <8bf58a83-d8d7-615c-c89b-87a62a3c9c40@gmail.com>
Replace cmd->data with a local variable to simplify code a little.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 04a55577..1b20ec1a 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();
}
--
2.12.0
next prev parent reply other threads:[~2017-03-22 21:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 21:16 [PATCH 0/6] mmc: meson-gx: further smaller refactorings Heiner Kallweit
2017-03-22 21:18 ` [PATCH 1/6] mmc: meson-gx: remove unneeded configuration bit resets Heiner Kallweit
2017-03-22 21:33 ` Heiner Kallweit [this message]
2017-03-22 21:33 ` [PATCH 3/6] mmc: meson-gx: improve variable usage in meson_mmc_start_cmd Heiner Kallweit
2017-03-22 21:33 ` [PATCH 4/6] mmc: meson-gx: improve response reading Heiner Kallweit
2017-03-22 21:33 ` [PATCH 5/6] mmc: meson-gx: improve setting data->bytes_xfered Heiner Kallweit
2017-03-22 21:34 ` [PATCH 6/6] mmc: meson-gx: simplify setting timeout configuration parameters Heiner Kallweit
2017-03-24 7:21 ` [PATCH 0/6] mmc: meson-gx: further smaller refactorings Ulf Hansson
2017-03-24 18:58 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c9c00f8-fd74-c9ae-552e-f518ae7844ce@gmail.com \
--to=hkallweit1@gmail.com \
--cc=linus-amlogic@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®