Re: [PATCH v2 06/60] drm/omap: dss: Move platform_device_register from core.c to dss.c probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, May 26, 2018 at 08:24:24PM +0300, Laurent Pinchart wrote:
> From: Jyri Sarha <jsarha@xxxxxx>
> 
> Register the omapdrm device when we know that dss device probe going
> to succeed. This avoids DSS6 and DSS2 omapdrm device registration from
> colliding with each other.
> 
> Signed-off-by: Jyri Sarha <jsarha@xxxxxx>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx>

-- Sebastian

> Changes since v0:
> 
> - Store the OMAP DRM platform device pointer in struct dss_device
> - Register the OMAP DRM platform device at the very end of dss_bind()
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------
>  drivers/gpu/drm/omapdrm/dss/dss.c  | 13 +++++++++++++
>  drivers/gpu/drm/omapdrm/dss/dss.h  |  2 ++
>  3 files changed, 17 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
> index acef7ece5783..6c9f667f9982 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
>  #endif
>  };
>  
> -static struct platform_device *omap_drm_device;
> -
>  static int __init omap_dss_init(void)
>  {
> -	int r;
> -
> -	r = platform_register_drivers(omap_dss_drivers,
> -				      ARRAY_SIZE(omap_dss_drivers));
> -	if (r)
> -		goto err_reg;
> -
> -	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
> -	if (IS_ERR(omap_drm_device)) {
> -		r = PTR_ERR(omap_drm_device);
> -		goto err_reg;
> -	}
> -
> -	return 0;
> -
> -err_reg:
> -	platform_unregister_drivers(omap_dss_drivers,
> -				    ARRAY_SIZE(omap_dss_drivers));
> -
> -	return r;
> +	return platform_register_drivers(omap_dss_drivers,
> +					 ARRAY_SIZE(omap_dss_drivers));
>  }
>  
>  static void __exit omap_dss_exit(void)
>  {
> -	platform_device_unregister(omap_drm_device);
> -
>  	platform_unregister_drivers(omap_dss_drivers,
>  				    ARRAY_SIZE(omap_dss_drivers));
>  }
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index d27d7f85bcd1..abd45b08f3a1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1315,6 +1315,7 @@ static const struct soc_device_attribute dss_soc_devices[] = {
>  static int dss_bind(struct device *dev)
>  {
>  	struct dss_device *dss = dev_get_drvdata(dev);
> +	struct platform_device *drm_pdev;
>  	int r;
>  
>  	r = component_bind_all(dev, NULL);
> @@ -1325,11 +1326,23 @@ static int dss_bind(struct device *dev)
>  
>  	omapdss_set_dss(dss);
>  
> +	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
> +	if (IS_ERR(drm_pdev)) {
> +		component_unbind_all(dev, NULL);
> +		return PTR_ERR(drm_pdev);
> +	}
> +
> +	dss->drm_pdev = drm_pdev;
> +
>  	return 0;
>  }
>  
>  static void dss_unbind(struct device *dev)
>  {
> +	struct dss_device *dss = dev_get_drvdata(dev);
> +
> +	platform_device_unregister(dss->drm_pdev);
> +
>  	omapdss_set_dss(NULL);
>  
>  	component_unbind_all(dev, NULL);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 847c78ade024..4f1eb7f5b922 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -235,6 +235,8 @@ struct dss_device {
>  	struct regmap	*syscon_pll_ctrl;
>  	u32		syscon_pll_ctrl_offset;
>  
> +	struct platform_device *drm_pdev;
> +
>  	struct clk	*parent_clk;
>  	struct clk	*dss_clk;
>  	unsigned long	dss_clk_rate;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Attachment: signature.asc
Description: PGP signature

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

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux