summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2017-06-08 15:27:45 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2017-06-20 10:30:47 +0200
commit0796e439c5cc4ceeb84e08479c5ee1a4ebab5549 (patch)
tree896eac7efed2605dfe47a10aaf00c43d9f454344 /drivers/mmc
parentc92e68d8a6595fec3e1f778edb4760507aef18d2 (diff)
downloadlinux-0796e439c5cc4ceeb84e08479c5ee1a4ebab5549.tar.bz2
mmc: core: Clarify code for sending CSD
To make the code more consistent and to increase readability, add an mmc_spi_send_csd() function, which gets called from mmc_send_csd() in case of SPI mode. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/mmc_ops.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 46c80f829936..5f7c5920231a 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -291,15 +291,11 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
return 0;
}
-int mmc_send_csd(struct mmc_card *card, u32 *csd)
+static int mmc_spi_send_csd(struct mmc_card *card, u32 *csd)
{
int ret, i;
__be32 *csd_tmp;
- if (!mmc_host_is_spi(card->host))
- return mmc_send_cxd_native(card->host, card->rca << 16,
- csd, MMC_SEND_CSD);
-
csd_tmp = kzalloc(16, GFP_KERNEL);
if (!csd_tmp)
return -ENOMEM;
@@ -316,6 +312,15 @@ err:
return ret;
}
+int mmc_send_csd(struct mmc_card *card, u32 *csd)
+{
+ if (mmc_host_is_spi(card->host))
+ return mmc_spi_send_csd(card, csd);
+
+ return mmc_send_cxd_native(card->host, card->rca << 16, csd,
+ MMC_SEND_CSD);
+}
+
static int mmc_spi_send_cid(struct mmc_host *host, u32 *cid)
{
int ret, i;