diff mbox series

[U-Boot,v2,1/5] mmc: arm_pl180_mmci: update arm_pl180_mmci_init() prototype

Message ID 1508749054-28369-2-git-send-email-patrice.chotard@st.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Extend ARM_PL180_MMCI | expand

Commit Message

Patrice CHOTARD Oct. 23, 2017, 8:57 a.m. UTC
From: Patrice Chotard <patrice.chotard@st.com>

Update arm_pl180_mmci_init() prototype by adding struct mmc**
param. This is needed before converting this driver to driver model
in order to use arm_pl180_mmci_init() in driver model and in none
driver model implementation

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 board/armltd/vexpress/vexpress_common.c |  3 ++-
 drivers/mmc/arm_pl180_mmci.c            | 10 +++++-----
 drivers/mmc/arm_pl180_mmci.h            |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

Comments

Tom Rini Nov. 17, 2017, 3:44 p.m. UTC | #1
On Mon, Oct 23, 2017 at 10:57:30AM +0200, patrice.chotard@st.com wrote:

> From: Patrice Chotard <patrice.chotard@st.com>
> 
> Update arm_pl180_mmci_init() prototype by adding struct mmc**
> param. This is needed before converting this driver to driver model
> in order to use arm_pl180_mmci_init() in driver model and in none
> driver model implementation
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c
index 89ab8f7..37b8d7f 100644
--- a/board/armltd/vexpress/vexpress_common.c
+++ b/board/armltd/vexpress/vexpress_common.c
@@ -76,6 +76,7 @@  int cpu_mmc_init(bd_t *bis)
 	(void) bis;
 #ifdef CONFIG_ARM_PL180_MMCI
 	struct pl180_mmc_host *host;
+	struct mmc *mmc;
 
 	host = malloc(sizeof(struct pl180_mmc_host));
 	if (!host)
@@ -91,7 +92,7 @@  int cpu_mmc_init(bd_t *bis)
 	host->clock_in = ARM_MCLK;
 	host->clock_min = ARM_MCLK / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
 	host->clock_max = CONFIG_ARM_PL180_MMCI_CLOCK_FREQ;
-	rc = arm_pl180_mmci_init(host);
+	rc = arm_pl180_mmci_init(host, &mmc);
 #endif
 	return rc;
 }
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index ddf8383..7898b0d 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -348,9 +348,8 @@  static const struct mmc_ops arm_pl180_mmci_ops = {
  * Set initial clock and power for mmc slot.
  * Initialize mmc struct and register with mmc framework.
  */
-int arm_pl180_mmci_init(struct pl180_mmc_host *host)
+int arm_pl180_mmci_init(struct pl180_mmc_host *host, struct mmc **mmc)
 {
-	struct mmc *mmc;
 	u32 sdi_u32;
 
 	writel(host->pwr_init, &host->base->power);
@@ -373,11 +372,12 @@  int arm_pl180_mmci_init(struct pl180_mmc_host *host)
 	else
 		host->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
 
-	mmc = mmc_create(&host->cfg, host);
-	if (mmc == NULL)
+	*mmc = mmc_create(&host->cfg, host);
+	if (!*mmc)
 		return -1;
 
-	debug("registered mmc interface number is:%d\n", mmc->block_dev.devnum);
+	debug("registered mmc interface number is:%d\n",
+	      (*mmc)->block_dev.devnum);
 
 	return 0;
 }
diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h
index f23bd39..6e232f7 100644
--- a/drivers/mmc/arm_pl180_mmci.h
+++ b/drivers/mmc/arm_pl180_mmci.h
@@ -190,6 +190,6 @@  struct pl180_mmc_host {
 	struct mmc_config cfg;
 };
 
-int arm_pl180_mmci_init(struct pl180_mmc_host *);
+int arm_pl180_mmci_init(struct pl180_mmc_host *host, struct mmc **mmc);
 
 #endif