diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-22 19:30:28 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-01-05 12:24:40 -0700 |
commit | 0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d (patch) | |
tree | 1dbc5b936b98393e343cc99a40382b2734ac778e /drivers/mmc | |
parent | 12559f5bab3e43b603dccfa6c354ffd7da03249c (diff) | |
download | u-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.zip u-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.tar.gz u-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.tar.bz2 |
dm: Use access methods for dev/uclass private data
Most drivers use these access methods but a few do not. Update them.
In some cases the access is not permitted, so mark those with a FIXME tag
for the maintainer to check.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/arm_pl180_mmci.c | 6 | ||||
-rw-r--r-- | drivers/mmc/mxsmmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/octeontx_hsmmc.c | 17 |
3 files changed, 16 insertions, 9 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index fe406fe..b2d1b4f 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -421,7 +421,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev) struct arm_pl180_mmc_plat *pdata = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct mmc *mmc = &pdata->mmc; - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); struct mmc_config *cfg = &pdata->cfg; struct clk clk; u32 bus_width; @@ -508,7 +508,7 @@ static int dm_host_set_ios(struct udevice *dev) static int dm_mmc_getcd(struct udevice *dev) { - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); int value = 1; if (dm_gpio_is_valid(&host->cd_gpio)) @@ -525,7 +525,7 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = { static int arm_pl180_mmc_of_to_plat(struct udevice *dev) { - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); fdt_addr_t addr; addr = dev_read_addr(dev); diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 143818d..b3fb559 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -668,7 +668,7 @@ static const struct dm_mmc_ops mxsmmc_ops = { #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) static int mxsmmc_of_to_plat(struct udevice *bus) { - struct mxsmmc_plat *plat = bus->plat; + struct mxsmmc_plat *plat = dev_get_plat(bus); u32 prop[2]; int ret; diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c index 5552342..57d107a 100644 --- a/drivers/mmc/octeontx_hsmmc.c +++ b/drivers/mmc/octeontx_hsmmc.c @@ -30,6 +30,7 @@ #include <asm/arch/clock.h> #include <asm/arch/csrs/csrs-mio_emm.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <power/regulator.h> @@ -3841,7 +3842,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev) } slot = &host->slots[bus_id]; - dev->priv = slot; + dev_set_priv(dev, slot); slot->host = host; slot->bus_id = bus_id; slot->dev = dev; @@ -3852,16 +3853,21 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev) snprintf(name, sizeof(name), "octeontx-mmc%d", bus_id); err = device_set_name(dev, name); - if (!dev->uclass_priv) { + /* FIXME: This code should not be needed */ + if (!dev_get_uclass_priv(dev)) { debug("%s(%s): Allocating uclass priv\n", __func__, dev->name); upriv = calloc(1, sizeof(struct mmc_uclass_priv)); if (!upriv) return -ENOMEM; - dev->uclass_priv = upriv; - dev->uclass->priv = upriv; + + /* + * FIXME: This is not allowed + * dev_set_uclass_priv(dev, upriv); + * uclass_set_priv(dev->uclass, upriv); + */ } else { - upriv = dev->uclass_priv; + upriv = dev_get_uclass_priv(dev); } upriv->mmc = &slot->mmc; @@ -3878,6 +3884,7 @@ static const struct udevice_id octeontx_hsmmc_host_ids[] = { U_BOOT_DRIVER(octeontx_hsmmc_host) = { .name = "octeontx_hsmmc_host", + /* FIXME: Why is this not UCLASS_MMC? */ .id = UCLASS_MISC, .of_match = of_match_ptr(octeontx_hsmmc_host_ids), .probe = octeontx_mmc_host_probe, |