From patchwork Mon Feb 22 21:08:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102713 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1479183lbl; Mon, 22 Feb 2016 13:14:58 -0800 (PST) X-Received: by 10.98.89.215 with SMTP id k84mr41358627pfj.66.1456175698704; Mon, 22 Feb 2016 13:14:58 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id v68si42023081pfi.16.2016.02.22.13.14.58; Mon, 22 Feb 2016 13:14:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71D1A6E2D5; Mon, 22 Feb 2016 21:14:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 776986E2D5 for ; Mon, 22 Feb 2016 21:14:55 +0000 (UTC) Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LfSYr-1a9ZMu3HIn-00p3Qr; Mon, 22 Feb 2016 22:14:49 +0100 From: Arnd Bergmann To: Rob Clark Subject: [PATCH 8/8] drm: msm: separate out module driver registration Date: Mon, 22 Feb 2016 22:08:42 +0100 Message-Id: <1456175331-714117-9-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456175331-714117-1-git-send-email-arnd@arndb.de> References: <1456175331-714117-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:68M7QHQplpRF/ZmNyzjR35foYY3rPDpo0iiqFLNUb3jui//WRTa kFIgeb2ook4Yf9Sk1ndYagKvnNI78FinwssGQtvFYg4jXKOmRrcW3284dCPYWXZyHbEU7J2 ECqu070+MyVNlJeU9CThuYNW61uSwt3PNo/FofxWoE20H0md01ko+0MAlo9HbOyzNS8MpJU 1kkYSkVJ0p5DWM1oKoaKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:bs7I8V0Ra4w=:Qf2Bgdc+tHaePAHaCrVOLp Yf9ZP2G+Q35WPguQYMtNJQJxUvq4N/Po9EXbuqPH176APQnEXONtQ4SgupjMTO6gUbLvId9+r q60frtnhLuJKOG56ha8ng0VnvYcvB8YquXy7glVtG4uN1RTt9aJaZ/3gQVOoX3Y0z7vTW7Ss5 G12kityc/Vp6mYQZeqJ1YIkYDFD90k0nD+DUYcIb96L2I+49gDowVs31HXifPp4dmTNIiJv9y 12DZ72Vhj21qJNLDSn3jySjtJn4oeDy8jbRu/9J/Enqnj3j28kkdXqq51BdjYkaXZ3tXSRdMJ f4mKAJ9TO0mpaaXXf1OIVyu8p/CIyMbjbZ3iKCAv58nFgGpzdwBJ3/svsjWFmgUfMfmzb7jQM wUaHBZhrug5Z01wzY2N4ZYotv7pqGoBTtpgdpyIaeJ+Fq7RMNX3tj/kYb/FA5+dcX0FcF0q/9 j8/Ameug+IrS7ha1NzdtXfBHbl+NeEZ3C20qvKu0k3Q7ZL6SHz7B7nNHZ6cP1ETrfEqeHCKY+ 4ZK99k/HFk+AHlqssdezppCjBbhcMxo+BkMP/0HKkscy22kR+3tcg7kFtN3QMQ5B16UfPAk8d GoPMQAslScBHdVNe6tiP9MHAuvF0espMuF+9gRWuOmwEOkCQ1sjjmHYr8HiAGENM6GH0YCmZm RfoYuZULQltIjQpchA5l3qTz51dzodZ97vMcvYip9HZcEHag0tWu3kj36Cy5RRQn188k= Cc: dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The msm driver currently has a single module_init() function but consists of multiple modules that each register a platform driver. This changes the msm_drm_register() function to not call the other functions but instead rely on module load order and/or link order to ensure that the other modules were probed earlier. The patch is not tested but should not change behavior. Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/msm/dsi/dsi.c | 17 ++++++++++++----- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 2 +- drivers/gpu/drm/msm/edp/edp.c | 15 +-------------- drivers/gpu/drm/msm/hdmi/hdmi.c | 16 +++++++++++----- drivers/gpu/drm/msm/hdmi/hdmi.h | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_phy.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 6 ------ drivers/gpu/drm/msm/msm_drv.h | 28 ---------------------------- 8 files changed, 27 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 8523a7cdc419..db260814dfff 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -172,21 +172,28 @@ static struct platform_driver dsi_driver = { }, }; -void __init msm_dsi_register(void) +static int __init msm_dsi_register(void) { + int ret; + DBG(""); msm_dsi_phy_driver_register(); - platform_driver_register(&dsi_driver); + ret = platform_driver_register(&dsi_driver); + + if (ret) + msm_dsi_phy_driver_unregister(); + + return ret; } -EXPORT_SYMBOL_GPL(msm_dsi_register); +module_init(msm_dsi_register); -void __exit msm_dsi_unregister(void) +static void __exit msm_dsi_unregister(void) { DBG(""); msm_dsi_phy_driver_unregister(); platform_driver_unregister(&dsi_driver); } -EXPORT_SYMBOL_GPL(msm_dsi_unregister); +module_exit(msm_dsi_unregister); 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/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 91a95fb04a4a..ab7106c150da 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -393,7 +393,7 @@ void __init msm_dsi_phy_driver_register(void) platform_driver_register(&dsi_phy_platform_driver); } -void __exit msm_dsi_phy_driver_unregister(void) +void msm_dsi_phy_driver_unregister(void) { platform_driver_unregister(&dsi_phy_platform_driver); } diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c index 48645d0d649a..fb952bb4e0e0 100644 --- a/drivers/gpu/drm/msm/edp/edp.c +++ b/drivers/gpu/drm/msm/edp/edp.c @@ -131,20 +131,7 @@ static struct platform_driver edp_driver = { .of_match_table = dt_match, }, }; - -void __init msm_edp_register(void) -{ - DBG(""); - platform_driver_register(&edp_driver); -} -EXPORT_SYMBOL_GPL(msm_edp_register); - -void __exit msm_edp_unregister(void) -{ - DBG(""); - platform_driver_unregister(&edp_driver); -} -EXPORT_SYMBOL_GPL(msm_edp_unregister); +module_platform_driver(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, diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 8e01d942d1c9..20c77d933556 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -518,16 +518,22 @@ static struct platform_driver msm_hdmi_driver = { }, }; -void __init msm_hdmi_register(void) +static int __init msm_hdmi_register(void) { + int ret; + msm_hdmi_phy_driver_register(); - platform_driver_register(&msm_hdmi_driver); + ret = platform_driver_register(&msm_hdmi_driver); + if (ret) + msm_hdmi_phy_driver_unregister(); + + return ret; } -EXPORT_SYMBOL_GPL(msm_hdmi_register); +module_init(msm_hdmi_register); -void __exit msm_hdmi_unregister(void) +static void __exit msm_hdmi_unregister(void) { platform_driver_unregister(&msm_hdmi_driver); msm_hdmi_phy_driver_unregister(); } -EXPORT_SYMBOL_GPL(msm_hdmi_unregister); +module_exit(msm_hdmi_unregister); diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index b04a64664673..23702d0057e4 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -190,7 +190,7 @@ void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy); void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock); void msm_hdmi_phy_powerdown(struct hdmi_phy *phy); void __init msm_hdmi_phy_driver_register(void); -void __exit msm_hdmi_phy_driver_unregister(void); +void msm_hdmi_phy_driver_unregister(void); #ifdef CONFIG_COMMON_CLK int msm_hdmi_pll_8960_init(struct platform_device *pdev); diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy.c index 5530631e2d49..05ca860add6d 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy.c @@ -222,7 +222,7 @@ void __init msm_hdmi_phy_driver_register(void) platform_driver_register(&msm_hdmi_phy_platform_driver); } -void __exit msm_hdmi_phy_driver_unregister(void) +void msm_hdmi_phy_driver_unregister(void) { platform_driver_unregister(&msm_hdmi_phy_platform_driver); } diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 5430ea7d2375..3d04cd922cf0 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -954,9 +954,6 @@ static struct platform_driver msm_platform_driver = { static int __init msm_drm_register(void) { DBG("init"); - msm_dsi_register(); - msm_edp_register(); - msm_hdmi_register(); adreno_register(); return platform_driver_register(&msm_platform_driver); } @@ -965,10 +962,7 @@ static void __exit msm_drm_unregister(void) { DBG("fini"); platform_driver_unregister(&msm_platform_driver); - msm_hdmi_unregister(); adreno_unregister(); - msm_edp_unregister(); - msm_dsi_unregister(); } module_init(msm_drm_register); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 905c17e373e7..abb15334bfa3 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -247,39 +247,19 @@ struct hdmi; #if IS_ENABLED(CONFIG_DRM_MSM_HDMI) int msm_hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, struct drm_encoder *encoder); -void __init msm_hdmi_register(void); -void __exit msm_hdmi_unregister(void); #else static inline int msm_hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, struct drm_encoder *encoder) { return -EINVAL; } - -static inline void __init msm_hdmi_register(void) -{ -} - -static inline void __exit msm_hdmi_unregister(void) -{ -} #endif struct msm_edp; #if IS_ENABLED(CONFIG_DRM_MSM_EDP) -void __init msm_edp_register(void); -void __exit msm_edp_unregister(void); int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, struct drm_encoder *encoder); #else -static inline void __init msm_edp_register(void) -{ -} - -static inline void __exit msm_edp_unregister(void) -{ -} - static inline int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, struct drm_encoder *encoder) @@ -295,17 +275,9 @@ enum msm_dsi_encoder_id { MSM_DSI_ENCODER_NUM = 2 }; #if IS_ENABLED(CONFIG_DRM_MSM_DSI) -void __init msm_dsi_register(void); -void __exit msm_dsi_unregister(void); 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])