mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-27 17:41:34 +00:00
dm: mmc: Rewrite mmc_blk_probe()
This function is called when the MMC block device is being probed. There is a recursive call in this function since find_mmc_device() itself can cause the MMC device to be probed. Admittedly the MMC device should already be probed, since we would not be probing its child otherwise, but the current code is unnecessarily convoluted. Rewrite this to access the MMC structure directly. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
66656020ff
commit
854f9a71f5
1 changed files with 11 additions and 6 deletions
|
@ -260,13 +260,18 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
|
|||
|
||||
static int mmc_blk_probe(struct udevice *dev)
|
||||
{
|
||||
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
|
||||
int dev_num = block_dev->devnum;
|
||||
struct mmc *mmc = find_mmc_device(dev_num);
|
||||
struct udevice *mmc_dev = dev_get_parent(dev);
|
||||
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc_dev);
|
||||
struct mmc *mmc = upriv->mmc;
|
||||
int ret;
|
||||
|
||||
if (!mmc)
|
||||
return -ENODEV;
|
||||
return mmc_init(mmc);
|
||||
ret = mmc_init(mmc);
|
||||
if (ret) {
|
||||
debug("%s: mmc_init() failed (err=%d)\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct blk_ops mmc_blk_ops = {
|
||||
|
|
Loading…
Add table
Reference in a new issue