mmc: renesas-sdhi: Refactor probe function
Move the assignment of priv->quirks earlier in the function. This allows us to drop the quirks local variable and makes it easier to maintain clean error handling when we add RZ/G2L support in the next patch. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
This commit is contained in:
@@ -961,14 +961,14 @@ static void renesas_sdhi_filter_caps(struct udevice *dev)
|
||||
static int renesas_sdhi_probe(struct udevice *dev)
|
||||
{
|
||||
struct tmio_sd_priv *priv = dev_get_priv(dev);
|
||||
u32 quirks = dev_get_driver_data(dev);
|
||||
struct fdt_resource reg_res;
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
int ret;
|
||||
|
||||
priv->clk_get_rate = renesas_sdhi_clk_get_rate;
|
||||
|
||||
if (quirks == RENESAS_GEN2_QUIRKS) {
|
||||
priv->quirks = dev_get_driver_data(dev);
|
||||
if (priv->quirks == RENESAS_GEN2_QUIRKS) {
|
||||
ret = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev),
|
||||
"reg", 0, ®_res);
|
||||
if (ret < 0) {
|
||||
@@ -978,7 +978,7 @@ static int renesas_sdhi_probe(struct udevice *dev)
|
||||
}
|
||||
|
||||
if (fdt_resource_size(®_res) == 0x100)
|
||||
quirks |= TMIO_SD_CAP_16BIT;
|
||||
priv->quirks |= TMIO_SD_CAP_16BIT;
|
||||
}
|
||||
|
||||
ret = clk_get_by_index(dev, 0, &priv->clk);
|
||||
@@ -1012,8 +1012,7 @@ static int renesas_sdhi_probe(struct udevice *dev)
|
||||
goto err_clkh;
|
||||
}
|
||||
|
||||
priv->quirks = quirks;
|
||||
ret = tmio_sd_probe(dev, quirks);
|
||||
ret = tmio_sd_probe(dev, priv->quirks);
|
||||
if (ret)
|
||||
goto err_tmio_probe;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user