Re: [PATCH 3/3] drm: sti: rework init sequence

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

 



On Mon, Jun 20, 2016 at 05:22:57PM +0200, Benjamin Gaignard wrote:
>  static int sti_bind(struct device *dev)
>  {
> -	return drm_platform_init(&sti_driver, to_platform_device(dev));
> +	struct drm_device *ddev;
> +	int ret;
> +
> +	ddev = drm_dev_alloc(&sti_driver, dev);
> +	if (!ddev)
> +		return -ENOMEM;
> +
> +	drm_dev_set_unique(ddev, dev_name(dev));
> +
> +	ddev->platformdev = to_platform_device(dev);
> +
> +	ret = sti_init(ddev);
> +	if (ret)
> +		goto err_drm_dev_unref;
> +
> +	ret = component_bind_all(ddev->dev, ddev);
> +	if (ret)
> +		goto err_cleanup;
> +
> +	ret = drm_dev_register(ddev, 0);
> +	if (ret)
> +		goto err_register;

Instead of coupling compositor_debug_init into the first CRTC, you can
call it explicitly now (since it is not CRTC related but dev).

> +	drm_mode_config_reset(ddev);
> +
> +	return 0;
> +
> +err_register:
> +	drm_mode_config_cleanup(ddev);
> +err_cleanup:
> +	sti_cleanup(ddev);
> +err_drm_dev_unref:
> +	drm_dev_unref(ddev);
> +	return ret;
>  }
>  
>  static void sti_unbind(struct device *dev)
>  {
> -	drm_put_dev(dev_get_drvdata(dev));
> +	struct drm_device *ddev = dev_get_drvdata(dev);
> +
> +	drm_connector_unregister_all(ddev);

^ redundant.

> +	drm_dev_unregister(ddev);
> +	sti_cleanup(ddev);
> +	drm_dev_unref(ddev);
>  }

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
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