Skip to content

Commit

Permalink
mmc: core: Clarify code for sending CSD
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
  • Loading branch information
storulf committed Jun 20, 2017
1 parent c92e68d commit 0796e43
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/mmc/core/mmc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -316,6 +312,15 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd)
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;
Expand Down

0 comments on commit 0796e43

Please sign in to comment.