]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: litex_mmc: Use devm_mmc_alloc_host() helper
authorBinbin Zhou <zhoubinbin@loongson.cn>
Tue, 3 Jun 2025 12:26:11 +0000 (20:26 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 24 Jun 2025 10:43:22 +0000 (12:43 +0200)
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>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Acked-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/8eea32bf0fb1ac95497355ccd5ea732ce619238c.1748933789.git.zhoubinbin@loongson.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/litex_mmc.c

index b338ccfa8f3378affa3666853febec69b66ea56f..d2f19c2dc6738c8cc051e3dfc5ab81f3ec799aa1 100644 (file)
@@ -506,11 +506,6 @@ use_polling:
        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;