From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: mripard@kernel.org, wens@csie.org
Cc: airlied@gmail.com, daniel@ffwll.ch, samuel@sholland.org,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration
Date: Sun, 24 Sep 2023 21:26:02 +0200 [thread overview]
Message-ID: <20230924192604.3262187-6-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20230924192604.3262187-1-jernej.skrabec@gmail.com>
There is no reason to register two drivers in same place. Using macro
lowers amount of boilerplate code.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 27 +-------------------------
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 --
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 3 ++-
3 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
index 93831cdf1917..d93e8ff71aae 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
@@ -378,32 +378,7 @@ static struct platform_driver sun8i_dw_hdmi_pltfm_driver = {
.of_match_table = sun8i_dw_hdmi_dt_ids,
},
};
-
-static int __init sun8i_dw_hdmi_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&sun8i_dw_hdmi_pltfm_driver);
- if (ret)
- return ret;
-
- ret = platform_driver_register(&sun8i_hdmi_phy_driver);
- if (ret) {
- platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver);
- return ret;
- }
-
- return ret;
-}
-
-static void __exit sun8i_dw_hdmi_exit(void)
-{
- platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver);
- platform_driver_unregister(&sun8i_hdmi_phy_driver);
-}
-
-module_init(sun8i_dw_hdmi_init);
-module_exit(sun8i_dw_hdmi_exit);
+module_platform_driver(sun8i_dw_hdmi_pltfm_driver);
MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>");
MODULE_DESCRIPTION("Allwinner DW HDMI bridge");
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
index 18ffc1b4841f..21e010deeb48 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
@@ -194,8 +194,6 @@ struct sun8i_dw_hdmi {
struct reset_control *rst_ctrl;
};
-extern struct platform_driver sun8i_hdmi_phy_driver;
-
static inline struct sun8i_dw_hdmi *
encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder)
{
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 489ea94693ff..f917a979e4a4 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -729,10 +729,11 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
return 0;
}
-struct platform_driver sun8i_hdmi_phy_driver = {
+static struct platform_driver sun8i_hdmi_phy_driver = {
.probe = sun8i_hdmi_phy_probe,
.driver = {
.name = "sun8i-hdmi-phy",
.of_match_table = sun8i_hdmi_phy_of_table,
},
};
+module_platform_driver(sun8i_hdmi_phy_driver);
--
2.42.0
next prev parent reply other threads:[~2023-09-24 19:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 19:25 [PATCH 0/7] drm/sun4i: dw-hdmi: Fix initialization & refactor Jernej Skrabec
2023-09-24 19:25 ` [PATCH 1/7] drm/sun4i: dw-hdmi: Deinit PHY in fail path Jernej Skrabec
2023-09-25 7:43 ` Maxime Ripard
2023-09-24 19:25 ` [PATCH 2/7] drm/sun4i: dw-hdmi: Remove double encoder cleanup Jernej Skrabec
2023-09-25 7:44 ` Maxime Ripard
2023-09-24 19:26 ` [PATCH 3/7] drm/sun4i: dw-hdmi: Switch to bridge functions Jernej Skrabec
2023-09-25 7:57 ` Maxime Ripard
2023-09-25 15:29 ` Jernej Škrabec
2023-10-05 8:42 ` Maxime Ripard
2023-09-24 19:26 ` [PATCH 4/7] drm/sun4i: Don't show error for deferred probes Jernej Skrabec
2023-09-25 7:45 ` Maxime Ripard
2023-09-24 19:26 ` Jernej Skrabec [this message]
2023-09-25 2:35 ` [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration kernel test robot
2023-09-25 7:47 ` Maxime Ripard
2023-09-25 15:07 ` Jernej Škrabec
2023-10-05 8:43 ` Maxime Ripard
2023-10-13 19:50 ` Jernej Škrabec
2023-09-25 16:40 ` kernel test robot
2023-09-24 19:26 ` [PATCH 6/7] drm/sun4i: dw-hdmi: Make sun8i_hdmi_phy_get() more intuitive Jernej Skrabec
2023-09-24 19:26 ` [PATCH 7/7] drm/sun4i: dw-hdmi: check for phy device first Jernej Skrabec
2023-09-25 7:50 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230924192604.3262187-6-jernej.skrabec@gmail.com \
--to=jernej.skrabec@gmail.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox