summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2024-08-22 07:54:59 -0600
committerTom Rini <trini@konsulko.com>2024-08-23 15:58:41 -0600
commitc5cb9e548981ee969fb3b4c75dd09b835463295f (patch)
tree1b052706860e20f05d16afdd4cc568ccdb719f5f
parent8a369de6ff1456efe60bc7ebefe3d323fece0a37 (diff)
spl: mmc: Adjust args of spl_mmc_find_device()
At present spl_mmc_load() is the only caller of this function, passing it a boot_device, an index into the available MMC devices. Pass the device number instead, since it is known by the caller and simplifies the code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
-rw-r--r--common/spl/spl_mmc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index bc6087e88cd..887ea760b84 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -58,7 +58,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
return 0;
}
-static int spl_mmc_get_device_index(u32 boot_device)
+static int spl_mmc_get_device_index(uint boot_device)
{
switch (boot_device) {
case BOOT_DEVICE_MMC1:
@@ -73,13 +73,9 @@ static int spl_mmc_get_device_index(u32 boot_device)
return -ENODEV;
}
-static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
+static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
{
- int ret, mmc_dev;
-
- mmc_dev = spl_mmc_get_device_index(boot_device);
- if (mmc_dev < 0)
- return mmc_dev;
+ int ret;
#if CONFIG_IS_ENABLED(DM_MMC)
ret = mmc_init_device(mmc_dev);
@@ -349,7 +345,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
/* Perform peripheral init only once for an mmc device */
mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
- ret = spl_mmc_find_device(&mmc, bootdev->boot_device);
+ ret = spl_mmc_find_device(&mmc, mmc_dev);
if (ret)
return ret;