Message ID | 692dc1743391fc4b3c107db5211107b5041ff100.1747877176.git.zhoubinbin@loongson.cn |
---|---|
State | Superseded |
Headers | show |
Series | mmc: Cleanup mmc_alloc_host() usage | expand |
On Thu, May 22, 2025 at 02:59:51PM +0800, Binbin Zhou wrote: > Use new function devm_mmc_alloc_host() to simplify the code. > > Cc: Karol Gugala <kgugala@antmicro.com> > Cc: Mateusz Holenko <mholenko@antmicro.com> > Cc: Gabriel Somlo <gsomlo@gmail.com> > Cc: Joel Stanley <joel@jms.id.au> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Acked-by: Gabriel Somlo <gsomlo@gmail.com> Thanks, --Gabriel > --- > drivers/mmc/host/litex_mmc.c | 12 +----------- > 1 file changed, 1 insertion(+), 11 deletions(-) > > diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c > index b338ccfa8f33..d2f19c2dc673 100644 > --- a/drivers/mmc/host/litex_mmc.c > +++ b/drivers/mmc/host/litex_mmc.c > @@ -506,11 +506,6 @@ static int litex_mmc_irq_init(struct platform_device *pdev, > return 0; > } > > -static void litex_mmc_free_host_wrapper(void *mmc) > -{ > - mmc_free_host(mmc); > -} > - > static int litex_mmc_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev) > * If for some reason we need to modify max_blk_count, we must also > * re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;` > */ > - mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), dev); > + mmc = devm_mmc_alloc_host(dev, sizeof(*host)); > if (!mmc) > return -ENOMEM; > > - ret = devm_add_action_or_reset(dev, litex_mmc_free_host_wrapper, mmc); > - if (ret) > - return dev_err_probe(dev, ret, > - "Can't register mmc_free_host action\n"); > - > host = mmc_priv(mmc); > host->mmc = mmc; > > -- > 2.47.1 >
diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c index b338ccfa8f33..d2f19c2dc673 100644 --- a/drivers/mmc/host/litex_mmc.c +++ b/drivers/mmc/host/litex_mmc.c @@ -506,11 +506,6 @@ static int litex_mmc_irq_init(struct platform_device *pdev, return 0; } -static void litex_mmc_free_host_wrapper(void *mmc) -{ - mmc_free_host(mmc); -} - static int litex_mmc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev) * If for some reason we need to modify max_blk_count, we must also * re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;` */ - mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), dev); + mmc = devm_mmc_alloc_host(dev, sizeof(*host)); if (!mmc) return -ENOMEM; - ret = devm_add_action_or_reset(dev, litex_mmc_free_host_wrapper, mmc); - if (ret) - return dev_err_probe(dev, ret, - "Can't register mmc_free_host action\n"); - host = mmc_priv(mmc); host->mmc = mmc;