diff mbox series

[v6,15/42] drm/mediatek: mtk_hdmi: Convert to module_platform_driver macro

Message ID 20250211113409.1517534-16-angelogioacchino.delregno@collabora.com (mailing list archive)
State New
Headers show
Series Add support for MT8195/88 DPI, HDMIv2 and DDCv2 | expand

Commit Message

AngeloGioacchino Del Regno Feb. 11, 2025, 11:33 a.m. UTC
Now that all of the mtk_hdmi subdrivers are a platform driver on
their own it is possible to remove the custom init/exit functions
in this driver and just use the module_platform_driver() macro.

While at it, also compress struct of_device_id entries and remove
stray commas in mtk_hdmi_driver assignments.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 37 ++++++-----------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

Comments

CK Hu (胡俊光) Feb. 14, 2025, 3:03 a.m. UTC | #1
On Tue, 2025-02-11 at 12:33 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Now that all of the mtk_hdmi subdrivers are a platform driver on
> their own it is possible to remove the custom init/exit functions
> in this driver and just use the module_platform_driver() macro.
> 
> While at it, also compress struct of_device_id entries and remove
> stray commas in mtk_hdmi_driver assignments.
> 
> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 37 ++++++-----------------------
>  1 file changed, 7 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index e648fb5714e7..a5471abf16dd 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1780,15 +1780,10 @@ static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8167 = {
>  };
> 
>  static const struct of_device_id mtk_hdmi_of_ids[] = {
> -       { .compatible = "mediatek,mt2701-hdmi",
> -         .data = &mtk_hdmi_conf_mt2701,
> -       },
> -       { .compatible = "mediatek,mt8167-hdmi",
> -         .data = &mtk_hdmi_conf_mt8167,
> -       },
> -       { .compatible = "mediatek,mt8173-hdmi",
> -       },
> -       {}
> +       { .compatible = "mediatek,mt2701-hdmi", .data = &mtk_hdmi_conf_mt2701 },
> +       { .compatible = "mediatek,mt8167-hdmi", .data = &mtk_hdmi_conf_mt8167 },
> +       { .compatible = "mediatek,mt8173-hdmi" },
> +       { /* sentinel */ }

This is not related to the title, separate this to another patch.

>  };
>  MODULE_DEVICE_TABLE(of, mtk_hdmi_of_ids);
> 
> @@ -1798,28 +1793,10 @@ static struct platform_driver mtk_hdmi_driver = {
>         .driver = {
>                 .name = "mediatek-drm-hdmi",
>                 .of_match_table = mtk_hdmi_of_ids,
> -               .pm = &mtk_hdmi_pm_ops,
> -       },
> -};
> -
> -static struct platform_driver * const mtk_hdmi_drivers[] = {
> -       &mtk_hdmi_driver,
> +               .pm = &mtk_hdmi_pm_ops

This is not related to the title, separate this to another patch.

After above modification,

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> +       }
>  };
> -
> -static int __init mtk_hdmitx_init(void)
> -{
> -       return platform_register_drivers(mtk_hdmi_drivers,
> -                                        ARRAY_SIZE(mtk_hdmi_drivers));
> -}
> -
> -static void __exit mtk_hdmitx_exit(void)
> -{
> -       platform_unregister_drivers(mtk_hdmi_drivers,
> -                                   ARRAY_SIZE(mtk_hdmi_drivers));
> -}
> -
> -module_init(mtk_hdmitx_init);
> -module_exit(mtk_hdmitx_exit);
> +module_platform_driver(mtk_hdmi_driver);
> 
>  MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
>  MODULE_DESCRIPTION("MediaTek HDMI Driver");
> --
> 2.48.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index e648fb5714e7..a5471abf16dd 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1780,15 +1780,10 @@  static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8167 = {
 };
 
 static const struct of_device_id mtk_hdmi_of_ids[] = {
-	{ .compatible = "mediatek,mt2701-hdmi",
-	  .data = &mtk_hdmi_conf_mt2701,
-	},
-	{ .compatible = "mediatek,mt8167-hdmi",
-	  .data = &mtk_hdmi_conf_mt8167,
-	},
-	{ .compatible = "mediatek,mt8173-hdmi",
-	},
-	{}
+	{ .compatible = "mediatek,mt2701-hdmi", .data = &mtk_hdmi_conf_mt2701 },
+	{ .compatible = "mediatek,mt8167-hdmi", .data = &mtk_hdmi_conf_mt8167 },
+	{ .compatible = "mediatek,mt8173-hdmi" },
+	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mtk_hdmi_of_ids);
 
@@ -1798,28 +1793,10 @@  static struct platform_driver mtk_hdmi_driver = {
 	.driver = {
 		.name = "mediatek-drm-hdmi",
 		.of_match_table = mtk_hdmi_of_ids,
-		.pm = &mtk_hdmi_pm_ops,
-	},
-};
-
-static struct platform_driver * const mtk_hdmi_drivers[] = {
-	&mtk_hdmi_driver,
+		.pm = &mtk_hdmi_pm_ops
+	}
 };
-
-static int __init mtk_hdmitx_init(void)
-{
-	return platform_register_drivers(mtk_hdmi_drivers,
-					 ARRAY_SIZE(mtk_hdmi_drivers));
-}
-
-static void __exit mtk_hdmitx_exit(void)
-{
-	platform_unregister_drivers(mtk_hdmi_drivers,
-				    ARRAY_SIZE(mtk_hdmi_drivers));
-}
-
-module_init(mtk_hdmitx_init);
-module_exit(mtk_hdmitx_exit);
+module_platform_driver(mtk_hdmi_driver);
 
 MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
 MODULE_DESCRIPTION("MediaTek HDMI Driver");