diff mbox series

mmc: mxc: Convert the driver to DT-only

Message ID 20201123203004.18792-1-festevam@gmail.com
State New
Headers show
Series mmc: mxc: Convert the driver to DT-only | expand

Commit Message

Fabio Estevam Nov. 23, 2020, 8:30 p.m. UTC
Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code
by removing the unused non-DT support.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/mmc/host/mxcmmc.c | 33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)

Comments

Ulf Hansson Nov. 24, 2020, 2:25 p.m. UTC | #1
On Mon, 23 Nov 2020 at 21:32, Fabio Estevam <festevam@gmail.com> wrote:
>

> Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code

> by removing the unused non-DT support.

>

> Signed-off-by: Fabio Estevam <festevam@gmail.com>


Applied for next, thanks!

Kind regards
Uffe


> ---

>  drivers/mmc/host/mxcmmc.c | 33 ++++-----------------------------

>  1 file changed, 4 insertions(+), 29 deletions(-)

>

> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c

> index 12ee07285980..2fe6fcdbb1b3 100644

> --- a/drivers/mmc/host/mxcmmc.c

> +++ b/drivers/mmc/host/mxcmmc.c

> @@ -157,32 +157,16 @@ struct mxcmci_host {

>         enum mxcmci_type        devtype;

>  };

>

> -static const struct platform_device_id mxcmci_devtype[] = {

> -       {

> -               .name = "imx21-mmc",

> -               .driver_data = IMX21_MMC,

> -       }, {

> -               .name = "imx31-mmc",

> -               .driver_data = IMX31_MMC,

> -       }, {

> -               .name = "mpc512x-sdhc",

> -               .driver_data = MPC512X_MMC,

> -       }, {

> -               /* sentinel */

> -       }

> -};

> -MODULE_DEVICE_TABLE(platform, mxcmci_devtype);

> -

>  static const struct of_device_id mxcmci_of_match[] = {

>         {

>                 .compatible = "fsl,imx21-mmc",

> -               .data = &mxcmci_devtype[IMX21_MMC],

> +               .data = (void *) IMX21_MMC,

>         }, {

>                 .compatible = "fsl,imx31-mmc",

> -               .data = &mxcmci_devtype[IMX31_MMC],

> +               .data = (void *) IMX31_MMC,

>         }, {

>                 .compatible = "fsl,mpc5121-sdhc",

> -               .data = &mxcmci_devtype[MPC512X_MMC],

> +               .data = (void *) MPC512X_MMC,

>         }, {

>                 /* sentinel */

>         }

> @@ -1001,13 +985,10 @@ static int mxcmci_probe(struct platform_device *pdev)

>         int ret = 0, irq;

>         bool dat3_card_detect = false;

>         dma_cap_mask_t mask;

> -       const struct of_device_id *of_id;

>         struct imxmmc_platform_data *pdata = pdev->dev.platform_data;

>

>         pr_info("i.MX/MPC512x SDHC driver\n");

>

> -       of_id = of_match_device(mxcmci_of_match, &pdev->dev);

> -

>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

>         irq = platform_get_irq(pdev, 0);

>         if (irq < 0)

> @@ -1044,12 +1025,7 @@ static int mxcmci_probe(struct platform_device *pdev)

>         mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;

>         mmc->max_seg_size = mmc->max_req_size;

>

> -       if (of_id) {

> -               const struct platform_device_id *id_entry = of_id->data;

> -               host->devtype = id_entry->driver_data;

> -       } else {

> -               host->devtype = pdev->id_entry->driver_data;

> -       }

> +       host->devtype = (enum mxcmci_type)of_device_get_match_data(&pdev->dev);

>

>         /* adjust max_segs after devtype detection */

>         if (!is_mpc512x_mmc(host))

> @@ -1241,7 +1217,6 @@ static SIMPLE_DEV_PM_OPS(mxcmci_pm_ops, mxcmci_suspend, mxcmci_resume);

>  static struct platform_driver mxcmci_driver = {

>         .probe          = mxcmci_probe,

>         .remove         = mxcmci_remove,

> -       .id_table       = mxcmci_devtype,

>         .driver         = {

>                 .name           = DRIVER_NAME,

>                 .probe_type     = PROBE_PREFER_ASYNCHRONOUS,

> --

> 2.17.1

>
diff mbox series

Patch

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 12ee07285980..2fe6fcdbb1b3 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -157,32 +157,16 @@  struct mxcmci_host {
 	enum mxcmci_type	devtype;
 };
 
-static const struct platform_device_id mxcmci_devtype[] = {
-	{
-		.name = "imx21-mmc",
-		.driver_data = IMX21_MMC,
-	}, {
-		.name = "imx31-mmc",
-		.driver_data = IMX31_MMC,
-	}, {
-		.name = "mpc512x-sdhc",
-		.driver_data = MPC512X_MMC,
-	}, {
-		/* sentinel */
-	}
-};
-MODULE_DEVICE_TABLE(platform, mxcmci_devtype);
-
 static const struct of_device_id mxcmci_of_match[] = {
 	{
 		.compatible = "fsl,imx21-mmc",
-		.data = &mxcmci_devtype[IMX21_MMC],
+		.data = (void *) IMX21_MMC,
 	}, {
 		.compatible = "fsl,imx31-mmc",
-		.data = &mxcmci_devtype[IMX31_MMC],
+		.data = (void *) IMX31_MMC,
 	}, {
 		.compatible = "fsl,mpc5121-sdhc",
-		.data = &mxcmci_devtype[MPC512X_MMC],
+		.data = (void *) MPC512X_MMC,
 	}, {
 		/* sentinel */
 	}
@@ -1001,13 +985,10 @@  static int mxcmci_probe(struct platform_device *pdev)
 	int ret = 0, irq;
 	bool dat3_card_detect = false;
 	dma_cap_mask_t mask;
-	const struct of_device_id *of_id;
 	struct imxmmc_platform_data *pdata = pdev->dev.platform_data;
 
 	pr_info("i.MX/MPC512x SDHC driver\n");
 
-	of_id = of_match_device(mxcmci_of_match, &pdev->dev);
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -1044,12 +1025,7 @@  static int mxcmci_probe(struct platform_device *pdev)
 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
 	mmc->max_seg_size = mmc->max_req_size;
 
-	if (of_id) {
-		const struct platform_device_id *id_entry = of_id->data;
-		host->devtype = id_entry->driver_data;
-	} else {
-		host->devtype = pdev->id_entry->driver_data;
-	}
+	host->devtype = (enum mxcmci_type)of_device_get_match_data(&pdev->dev);
 
 	/* adjust max_segs after devtype detection */
 	if (!is_mpc512x_mmc(host))
@@ -1241,7 +1217,6 @@  static SIMPLE_DEV_PM_OPS(mxcmci_pm_ops, mxcmci_suspend, mxcmci_resume);
 static struct platform_driver mxcmci_driver = {
 	.probe		= mxcmci_probe,
 	.remove		= mxcmci_remove,
-	.id_table	= mxcmci_devtype,
 	.driver		= {
 		.name		= DRIVER_NAME,
 		.probe_type	= PROBE_PREFER_ASYNCHRONOUS,