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

Philipp Zabel p.zabel at pengutronix.de
Wed Apr 27 03:29:05 PDT 2016


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:

--------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




More information about the Linux-mediatek mailing list