[PATCH v14 2/8] drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.

Daniel Vetter daniel at ffwll.ch
Wed Apr 27 03:57:33 PDT 2016


On Wed, Apr 27, 2016 at 12:29:05PM +0200, Philipp Zabel wrote:
> Hi Daniel,
> 
> Am Dienstag, den 26.04.2016, 10:48 +0200 schrieb Daniel Vetter:
> [...]
> > > +static int mtk_drm_unload(struct drm_device *drm)
> > > +{
> > > +	mtk_drm_kms_deinit(drm);
> > > +	drm->dev_private = NULL;
> > > +
> > > +	return 0;
> > > +}
> > 
> > Like load, the unload hook is deprecated. And in drm-next we now have some
> > nice helpers to make not using an unload hook easier. Please refactor per
> > existing examples and get rid of your unload hook.
> 
> Thanks, does this change look about right:

yup, lgtm, ack.
-Daniel

> 
> --------8<--------
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -222,14 +222,6 @@ static void mtk_drm_kms_deinit(struct drm_device
> *drm)
>  	drm_mode_config_cleanup(drm);
>  }
>  
> -static int mtk_drm_unload(struct drm_device *drm)
> -{
> -	mtk_drm_kms_deinit(drm);
> -	drm->dev_private = NULL;
> -
> -	return 0;
> -}
> -
>  static const struct file_operations mtk_drm_fops = {
>  	.owner = THIS_MODULE,
>  	.open = drm_open,
> @@ -246,7 +238,6 @@ static const struct file_operations mtk_drm_fops = {
>  static struct drm_driver mtk_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
> -	.unload = mtk_drm_unload,
>  
>  	.get_vblank_counter = drm_vblank_count,
>  	.enable_vblank = mtk_drm_crtc_enable_vblank,
> @@ -455,8 +446,14 @@ err_node:
>  static int mtk_drm_remove(struct platform_device *pdev)
>  {
>  	struct mtk_drm_private *private = platform_get_drvdata(pdev);
> +	struct drm_device *drm = private->drm;
>  	int i;
>  
> +	drm_connector_unregister_all(drm);
> +	drm_dev_unregister(drm);
> +	mtk_drm_kms_deinit(drm);
> +	drm_dev_unref(drm);
> +
>  	component_master_del(&pdev->dev, &mtk_drm_ops);
>  	pm_runtime_disable(&pdev->dev);
>  	of_node_put(private->mutex_node);
> -------->8--------
> 
> > > +static const struct vm_operations_struct mtk_drm_gem_vm_ops = {
> > > +	.open = drm_gem_vm_open,
> > > +	.close = drm_gem_vm_close,
> > > +};
> > 
> > Drive-by review I just spotted: Please use drm_gem_cma_vm_ops instead of
> > rolling your own.
> 
> Good catch, will remove.
> 
> regards
> Philipp
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch



More information about the Linux-mediatek mailing list