All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Kevin Hilman <khilman@linaro.org>,
	linux-samsung-soc@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 1/1] drm/exynos: Move platform drivers registration to module init
Date: Thu, 20 Nov 2014 23:07:20 +0900	[thread overview]
Message-ID: <546DF598.6030701@samsung.com> (raw)
In-Reply-To: <1416318821-7925-1-git-send-email-javier.martinez@collabora.co.uk>

Hi Javier,

On 2014년 11월 18일 22:53, Javier Martinez Canillas wrote:
> The Exynos DRM driver register its sub-devices platform drivers in
> the probe function but after commit 43c0767 ("of/platform: Move
> platform devices under /sys/devices/platform"), this is causing
> a deadlock in __driver_attach(). Fix this by moving the platform
> drivers registration to exynos_drm_init().

Could you re-base this patch on top of exynos-drm-next? I tried to
separate sub drivers into independent drivers but it seems that we need
more times. So I will merge your patch.

Thanks,
Inki Dae

> 
> Suggested-by: Andrzej Hajda <a.hajda@samsung.com>
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> ---
> 
> This issue was reported by both Krzysztof Kozlowski [0] and Kevin Hilman [1].
> 
> Inki Dae said that he will fix it property by separating the Exynos DRM
> driver in different sub-modules but I post this patch as RFC anyways so
> others can test if this fixes their boot issue.
> 
> [0]: https://lkml.org/lkml/2014/11/6/125
> [1]: http://www.spinics.net/lists/linux-samsung-soc/msg39050.html
> 
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 163 ++++++++++++++++----------------
>  1 file changed, 79 insertions(+), 84 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index e277d4f..5386fea 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -559,15 +559,58 @@ static const struct component_master_ops exynos_drm_ops = {
>  static int exynos_drm_platform_probe(struct platform_device *pdev)
>  {
>  	struct component_match *match;
> -	int ret;
>  
>  	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>  	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
>  
> +	match = exynos_drm_match_add(&pdev->dev);
> +	if (IS_ERR(match))
> +		return PTR_ERR(match);
> +
> +	return component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
> +					       match);
> +}
> +
> +static int exynos_drm_platform_remove(struct platform_device *pdev)
> +{
> +	component_master_del(&pdev->dev, &exynos_drm_ops);
> +	return 0;
> +}
> +
> +static struct platform_driver exynos_drm_platform_driver = {
> +	.probe	= exynos_drm_platform_probe,
> +	.remove	= exynos_drm_platform_remove,
> +	.driver	= {
> +		.name	= "exynos-drm",
> +		.pm	= &exynos_drm_pm_ops,
> +	},
> +};
> +
> +static int exynos_drm_init(void)
> +{
> +	int ret;
> +
> +	/*
> +	 * Register device object only in case of Exynos SoC.
> +	 *
> +	 * Below codes resolves temporarily infinite loop issue incurred
> +	 * by Exynos drm driver when using multi-platform kernel.
> +	 * So these codes will be replaced with more generic way later.
> +	 */
> +	if (!of_machine_is_compatible("samsung,exynos3") &&
> +			!of_machine_is_compatible("samsung,exynos4") &&
> +			!of_machine_is_compatible("samsung,exynos5"))
> +		return -ENODEV;
> +
> +	exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
> +								NULL, 0);
> +	if (IS_ERR(exynos_drm_pdev))
> +		return PTR_ERR(exynos_drm_pdev);
> +
>  #ifdef CONFIG_DRM_EXYNOS_FIMD
>  	ret = platform_driver_register(&fimd_driver);
>  	if (ret < 0)
> -		return ret;
> +		goto err_unregister_pdev;
>  #endif
>  
>  #ifdef CONFIG_DRM_EXYNOS_DP
> @@ -591,21 +634,10 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
>  		goto err_unregister_mixer_drv;
>  #endif
>  
> -	match = exynos_drm_match_add(&pdev->dev);
> -	if (IS_ERR(match)) {
> -		ret = PTR_ERR(match);
> -		goto err_unregister_hdmi_drv;
> -	}
> -
> -	ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
> -						match);
> -	if (ret < 0)
> -		goto err_unregister_hdmi_drv;
> -
>  #ifdef CONFIG_DRM_EXYNOS_G2D
>  	ret = platform_driver_register(&g2d_driver);
>  	if (ret < 0)
> -		goto err_del_component_master;
> +		goto err_unregister_hdmi_drv;
>  #endif
>  
>  #ifdef CONFIG_DRM_EXYNOS_FIMC
> @@ -636,9 +668,27 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
>  		goto err_unregister_ipp_drv;
>  #endif
>  
> -	return ret;
> +#ifdef CONFIG_DRM_EXYNOS_VIDI
> +	ret = exynos_drm_probe_vidi();
> +	if (ret < 0)
> +		goto err_unregister_ipp_dev;
> +#endif
> +
> +	ret = platform_driver_register(&exynos_drm_platform_driver);
> +	if (ret)
> +		goto err_remove_vidi;
> +
> +	return 0;
> +
> +err_remove_vidi:
> +#ifdef CONFIG_DRM_EXYNOS_VIDI
> +	exynos_drm_remove_vidi();
> +err_unregister_pd:
> +#endif
>  
>  #ifdef CONFIG_DRM_EXYNOS_IPP
> +err_unregister_ipp_dev:
> +	exynos_platform_device_ipp_unregister();
>  err_unregister_ipp_drv:
>  	platform_driver_unregister(&ipp_driver);
>  err_unregister_gsc_drv:
> @@ -661,11 +711,9 @@ err_unregister_g2d_drv:
>  
>  #ifdef CONFIG_DRM_EXYNOS_G2D
>  	platform_driver_unregister(&g2d_driver);
> -err_del_component_master:
> +err_unregister_hdmi_drv:
>  #endif
> -	component_master_del(&pdev->dev, &exynos_drm_ops);
>  
> -err_unregister_hdmi_drv:
>  #ifdef CONFIG_DRM_EXYNOS_HDMI
>  	platform_driver_unregister(&hdmi_driver);
>  err_unregister_mixer_drv:
> @@ -686,11 +734,21 @@ err_unregister_fimd_drv:
>  #ifdef CONFIG_DRM_EXYNOS_FIMD
>  	platform_driver_unregister(&fimd_driver);
>  #endif
> +
> +err_unregister_pdev:
> +	platform_device_unregister(exynos_drm_pdev);
> +
>  	return ret;
>  }
>  
> -static int exynos_drm_platform_remove(struct platform_device *pdev)
> +static void exynos_drm_exit(void)
>  {
> +	platform_driver_unregister(&exynos_drm_platform_driver);
> +
> +#ifdef CONFIG_DRM_EXYNOS_VIDI
> +	exynos_drm_remove_vidi();
> +#endif
> +
>  #ifdef CONFIG_DRM_EXYNOS_IPP
>  	exynos_platform_device_ipp_unregister();
>  	platform_driver_unregister(&ipp_driver);
> @@ -721,75 +779,12 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)
>  	platform_driver_unregister(&fimd_driver);
>  #endif
>  
> -#ifdef CONFIG_DRM_EXYNOS_DSI
> -	platform_driver_unregister(&dsi_driver);
> -#endif
> -
>  #ifdef CONFIG_DRM_EXYNOS_DP
>  	platform_driver_unregister(&dp_driver);
>  #endif
> -	component_master_del(&pdev->dev, &exynos_drm_ops);
> -	return 0;
> -}
>  
> -static struct platform_driver exynos_drm_platform_driver = {
> -	.probe	= exynos_drm_platform_probe,
> -	.remove	= exynos_drm_platform_remove,
> -	.driver	= {
> -		.name	= "exynos-drm",
> -		.pm	= &exynos_drm_pm_ops,
> -	},
> -};
> -
> -static int exynos_drm_init(void)
> -{
> -	int ret;
> -
> -	/*
> -	 * Register device object only in case of Exynos SoC.
> -	 *
> -	 * Below codes resolves temporarily infinite loop issue incurred
> -	 * by Exynos drm driver when using multi-platform kernel.
> -	 * So these codes will be replaced with more generic way later.
> -	 */
> -	if (!of_machine_is_compatible("samsung,exynos3") &&
> -			!of_machine_is_compatible("samsung,exynos4") &&
> -			!of_machine_is_compatible("samsung,exynos5"))
> -		return -ENODEV;
> -
> -	exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
> -								NULL, 0);
> -	if (IS_ERR(exynos_drm_pdev))
> -		return PTR_ERR(exynos_drm_pdev);
> -
> -#ifdef CONFIG_DRM_EXYNOS_VIDI
> -	ret = exynos_drm_probe_vidi();
> -	if (ret < 0)
> -		goto err_unregister_pd;
> -#endif
> -
> -	ret = platform_driver_register(&exynos_drm_platform_driver);
> -	if (ret)
> -		goto err_remove_vidi;
> -
> -	return 0;
> -
> -err_remove_vidi:
> -#ifdef CONFIG_DRM_EXYNOS_VIDI
> -	exynos_drm_remove_vidi();
> -
> -err_unregister_pd:
> -#endif
> -	platform_device_unregister(exynos_drm_pdev);
> -
> -	return ret;
> -}
> -
> -static void exynos_drm_exit(void)
> -{
> -	platform_driver_unregister(&exynos_drm_platform_driver);
> -#ifdef CONFIG_DRM_EXYNOS_VIDI
> -	exynos_drm_remove_vidi();
> +#ifdef CONFIG_DRM_EXYNOS_DSI
> +	platform_driver_unregister(&dsi_driver);
>  #endif
>  	platform_device_unregister(exynos_drm_pdev);
>  }
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-11-20 14:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 13:53 [RFC PATCH 1/1] drm/exynos: Move platform drivers registration to module init Javier Martinez Canillas
2014-11-18 18:41 ` Kevin Hilman
2014-11-18 20:28   ` Gustavo Padovan
2014-11-18 22:46     ` Kevin Hilman
2014-11-19 10:09       ` Javier Martinez Canillas
2014-11-19 16:52   ` Javier Martinez Canillas
2014-11-19 19:52     ` Kevin Hilman
2014-11-19 22:29       ` Kevin Hilman
2014-11-20  7:06     ` Vivek Gautam
2014-11-20  7:51       ` Vivek Gautam
2014-11-20  8:45         ` Javier Martinez Canillas
2014-11-20  9:52           ` Vivek Gautam
2014-11-20 14:24             ` Pankaj Dubey
2014-11-20 15:57             ` Paolo Pisati
2014-11-20 16:44               ` Javier Martinez Canillas
2014-11-20 16:41       ` Kevin Hilman
2014-11-20 17:47         ` Javier Martinez Canillas
2014-11-20 18:22           ` Kevin Hilman
2014-11-20 23:49             ` Paolo Pisati
2014-11-21 11:33               ` Andreas Färber
2014-11-21 17:32                 ` Ajay kumar
2014-11-21 20:57                   ` Javier Martinez Canillas
2014-11-24 10:05                     ` Javier Martinez Canillas
2014-11-24 10:36                       ` Vivek Gautam
2014-11-24 15:05                       ` Andreas Färber
2014-11-25  5:35                         ` Ajay kumar
2014-11-21 13:03             ` Peach Pi/Pit boot failures in linux-next (was Re: [RFC PATCH 1/1] drm/exynos: Move platform drivers registration to module init) Javier Martinez Canillas
2014-11-21 16:38               ` Kevin Hilman
2014-11-21 20:49                 ` Javier Martinez Canillas
2014-11-22 10:21                   ` Krzysztof Kozlowski
2014-11-24  9:38                     ` Javier Martinez Canillas
2014-11-24  9:42                       ` Javier Martinez Canillas
2014-11-24 10:13                       ` Krzysztof Kozlowski
2014-11-24 11:07                         ` Javier Martinez Canillas
2014-11-24 11:12                           ` Krzysztof Kozlowski
2014-11-24 13:16                             ` Javier Martinez Canillas
2014-11-24 13:28                               ` Vivek Gautam
2014-11-24 13:53                               ` Krzysztof Kozlowski
2014-11-24  9:51                   ` Krzysztof Kozlowski
2014-11-20 14:07 ` Inki Dae [this message]
2014-11-20 14:28   ` [RFC PATCH 1/1] drm/exynos: Move platform drivers registration to module init Javier Martinez Canillas
2014-11-20 15:06     ` Inki Dae
2014-11-20 15:26       ` Javier Martinez Canillas
2014-11-20 17:01         ` Inki Dae
2014-11-21 11:19           ` Javier Martinez Canillas

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=546DF598.6030701@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@linaro.org \
    --cc=linux-samsung-soc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.