lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1442501878-9037-2-git-send-email-eric@anholt.net>
Date:	Thu, 17 Sep 2015 10:57:56 -0400
From:	Eric Anholt <eric@...olt.net>
To:	dri-devel@...ts.freedesktop.org
Cc:	linux-kernel@...r.kernel.org, David Airlie <airlied@...ux.ie>,
	Inki Dae <inki.dae@...sung.com>,
	Joonyoung Shim <jy0922.shim@...sung.com>,
	Seung-Woo Kim <sw0312.kim@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	linux-arm-msm@...r.kernel.org, Rob Clark <robdclark@...il.com>,
	Eric Anholt <eric@...olt.net>
Subject: [PATCH v2 2/4] drm/msm: Use drm_platform_register/unregister_drivers().

This matches how exynos handles the registration of its component
drivers.

Signed-off-by: Eric Anholt <eric@...olt.net>
---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 12 +-----------
 drivers/gpu/drm/msm/dsi/dsi.c              | 16 +---------------
 drivers/gpu/drm/msm/dsi/dsi.h              |  2 --
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c      | 12 +-----------
 drivers/gpu/drm/msm/edp/edp.c              | 14 +-------------
 drivers/gpu/drm/msm/hdmi/hdmi.c            | 12 +-----------
 drivers/gpu/drm/msm/msm_drv.c              | 26 ++++++++++++++++++--------
 drivers/gpu/drm/msm/msm_drv.h              | 16 ++++------------
 drivers/gpu/drm/msm/msm_gpu.h              |  3 +--
 9 files changed, 28 insertions(+), 85 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 1ea2df5..8b0eb95 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -286,7 +286,7 @@ static const struct of_device_id dt_match[] = {
 	{}
 };
 
-static struct platform_driver adreno_driver = {
+struct platform_driver adreno_driver = {
 	.probe = adreno_probe,
 	.remove = adreno_remove,
 	.driver = {
@@ -294,13 +294,3 @@ static struct platform_driver adreno_driver = {
 		.of_match_table = dt_match,
 	},
 };
-
-void __init adreno_register(void)
-{
-	platform_driver_register(&adreno_driver);
-}
-
-void __exit adreno_unregister(void)
-{
-	platform_driver_unregister(&adreno_driver);
-}
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 6edcd6f..41cfbd5 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -163,7 +163,7 @@ static const struct of_device_id dt_match[] = {
 	{}
 };
 
-static struct platform_driver dsi_driver = {
+struct platform_driver msm_dsi_driver = {
 	.probe = dsi_dev_probe,
 	.remove = dsi_dev_remove,
 	.driver = {
@@ -172,20 +172,6 @@ static struct platform_driver dsi_driver = {
 	},
 };
 
-void __init msm_dsi_register(void)
-{
-	DBG("");
-	msm_dsi_phy_driver_register();
-	platform_driver_register(&dsi_driver);
-}
-
-void __exit msm_dsi_unregister(void)
-{
-	DBG("");
-	msm_dsi_phy_driver_unregister();
-	platform_driver_unregister(&dsi_driver);
-}
-
 int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		struct drm_encoder *encoders[MSM_DSI_ENCODER_NUM])
 {
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 5f5a373..08fff5c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -164,8 +164,6 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi);
 
 /* dsi phy */
 struct msm_dsi_phy;
-void msm_dsi_phy_driver_register(void);
-void msm_dsi_phy_driver_unregister(void);
 int msm_dsi_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,
 	const unsigned long bit_rate, const unsigned long esc_rate);
 void msm_dsi_phy_disable(struct msm_dsi_phy *phy);
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 401ff58..f918b56 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -375,7 +375,7 @@ static int dsi_phy_driver_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct platform_driver dsi_phy_platform_driver = {
+struct platform_driver msm_dsi_phy_driver = {
 	.probe      = dsi_phy_driver_probe,
 	.remove     = dsi_phy_driver_remove,
 	.driver     = {
@@ -384,16 +384,6 @@ static struct platform_driver dsi_phy_platform_driver = {
 	},
 };
 
-void __init msm_dsi_phy_driver_register(void)
-{
-	platform_driver_register(&dsi_phy_platform_driver);
-}
-
-void __exit msm_dsi_phy_driver_unregister(void)
-{
-	platform_driver_unregister(&dsi_phy_platform_driver);
-}
-
 int msm_dsi_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,
 	const unsigned long bit_rate, const unsigned long esc_rate)
 {
diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
index 0940e84..0bf75b0 100644
--- a/drivers/gpu/drm/msm/edp/edp.c
+++ b/drivers/gpu/drm/msm/edp/edp.c
@@ -122,7 +122,7 @@ static const struct of_device_id dt_match[] = {
 	{}
 };
 
-static struct platform_driver edp_driver = {
+struct platform_driver msm_edp_driver = {
 	.probe = edp_dev_probe,
 	.remove = edp_dev_remove,
 	.driver = {
@@ -131,18 +131,6 @@ static struct platform_driver edp_driver = {
 	},
 };
 
-void __init msm_edp_register(void)
-{
-	DBG("");
-	platform_driver_register(&edp_driver);
-}
-
-void __exit msm_edp_unregister(void)
-{
-	DBG("");
-	platform_driver_unregister(&edp_driver);
-}
-
 /* Second part of initialization, the drm/kms level modeset_init */
 int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
 				struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 101b324..b44b3f1 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -518,7 +518,7 @@ static int hdmi_dev_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct platform_driver hdmi_driver = {
+struct platform_driver msm_hdmi_driver = {
 	.probe = hdmi_dev_probe,
 	.remove = hdmi_dev_remove,
 	.driver = {
@@ -526,13 +526,3 @@ static struct platform_driver hdmi_driver = {
 		.of_match_table = dt_match,
 	},
 };
-
-void __init hdmi_register(void)
-{
-	platform_driver_register(&hdmi_driver);
-}
-
-void __exit hdmi_unregister(void)
-{
-	platform_driver_unregister(&hdmi_driver);
-}
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 0339c5d..a9b0573 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -1159,13 +1159,25 @@ static struct platform_driver msm_platform_driver = {
 	.id_table   = msm_id,
 };
 
+static struct platform_driver *const component_drivers[] = {
+#if IS_ENABLED(CONFIG_DRM_MSM_DSI)
+	&msm_dsi_phy_driver,
+	&msm_dsi_driver,
+#endif
+	&msm_hdmi_driver,
+	&adreno_driver,
+};
+
 static int __init msm_drm_register(void)
 {
+	int ret;
+
 	DBG("init");
-	msm_dsi_register();
-	msm_edp_register();
-	hdmi_register();
-	adreno_register();
+	ret = drm_platform_register_drivers(component_drivers,
+					    ARRAY_SIZE(component_drivers));
+	if (ret)
+		return ret;
+
 	return platform_driver_register(&msm_platform_driver);
 }
 
@@ -1173,10 +1185,8 @@ static void __exit msm_drm_unregister(void)
 {
 	DBG("fini");
 	platform_driver_unregister(&msm_platform_driver);
-	hdmi_unregister();
-	adreno_unregister();
-	msm_edp_unregister();
-	msm_dsi_unregister();
+	drm_platform_unregister_drivers(component_drivers,
+					ARRAY_SIZE(component_drivers));
 }
 
 module_init(msm_drm_register);
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 3be7a56..88e542b 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -249,12 +249,10 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev);
 struct hdmi;
 int hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev,
 		struct drm_encoder *encoder);
-void __init hdmi_register(void);
-void __exit hdmi_unregister(void);
+extern struct platform_driver msm_hdmi_driver;
 
 struct msm_edp;
-void __init msm_edp_register(void);
-void __exit msm_edp_unregister(void);
+extern struct platform_driver msm_edp_driver;
 int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
 		struct drm_encoder *encoder);
 
@@ -265,17 +263,11 @@ enum msm_dsi_encoder_id {
 	MSM_DSI_ENCODER_NUM = 2
 };
 #ifdef CONFIG_DRM_MSM_DSI
-void __init msm_dsi_register(void);
-void __exit msm_dsi_unregister(void);
+extern struct platform_driver msm_dsi_driver;
+extern struct platform_driver msm_dsi_phy_driver;
 int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		struct drm_encoder *encoders[MSM_DSI_ENCODER_NUM]);
 #else
-static inline void __init msm_dsi_register(void)
-{
-}
-static inline void __exit msm_dsi_unregister(void)
-{
-}
 static inline int msm_dsi_modeset_init(struct msm_dsi *msm_dsi,
 		struct drm_device *dev,
 		struct drm_encoder *encoders[MSM_DSI_ENCODER_NUM])
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 2bbe85a..2cd6a68 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -169,7 +169,6 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 void msm_gpu_cleanup(struct msm_gpu *gpu);
 
 struct msm_gpu *adreno_load_gpu(struct drm_device *dev);
-void __init adreno_register(void);
-void __exit adreno_unregister(void);
+extern struct platform_driver adreno_driver;
 
 #endif /* __MSM_GPU_H__ */
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ