aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-08 09:41:13 -0400
committerDave Airlie <airlied@redhat.com>2013-08-19 00:24:15 -0400
commitb5dc0d108cd3c0b50ddcb6f6c54be1bea4c39e01 (patch)
tree7af49254fdf3dc15ffbeb76eebab48871e23e760 /drivers/staging
parent24f400326793341b005546d6ef82770f8d30d092 (diff)
drm/imx: kill firstopen callback
This thing seems to do some kind of delayed setup. Really, real kms drivers shouldn't do that at all. Either stuff needs to be dynamically hotplugged or the driver setup sequence needs to be fixed. This patch here just moves the setup at the very end of the driver load callback, with the locking adjusted accordingly. v2: Also move the corresponding put from ->lastclose to ->unload. Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/imx-drm/imx-drm-core.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 29607c25b261..e826086ec308 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -69,28 +69,20 @@ struct imx_drm_connector {
69 struct module *owner; 69 struct module *owner;
70}; 70};
71 71
72static int imx_drm_driver_firstopen(struct drm_device *drm)
73{
74 if (!imx_drm_device_get())
75 return -EINVAL;
76
77 return 0;
78}
79
80static void imx_drm_driver_lastclose(struct drm_device *drm) 72static void imx_drm_driver_lastclose(struct drm_device *drm)
81{ 73{
82 struct imx_drm_device *imxdrm = drm->dev_private; 74 struct imx_drm_device *imxdrm = drm->dev_private;
83 75
84 if (imxdrm->fbhelper) 76 if (imxdrm->fbhelper)
85 drm_fbdev_cma_restore_mode(imxdrm->fbhelper); 77 drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
86
87 imx_drm_device_put();
88} 78}
89 79
90static int imx_drm_driver_unload(struct drm_device *drm) 80static int imx_drm_driver_unload(struct drm_device *drm)
91{ 81{
92 struct imx_drm_device *imxdrm = drm->dev_private; 82 struct imx_drm_device *imxdrm = drm->dev_private;
93 83
84 imx_drm_device_put();
85
94 drm_mode_config_cleanup(imxdrm->drm); 86 drm_mode_config_cleanup(imxdrm->drm);
95 drm_kms_helper_poll_fini(imxdrm->drm); 87 drm_kms_helper_poll_fini(imxdrm->drm);
96 88
@@ -225,8 +217,6 @@ struct drm_device *imx_drm_device_get(void)
225 struct imx_drm_connector *con; 217 struct imx_drm_connector *con;
226 struct imx_drm_crtc *crtc; 218 struct imx_drm_crtc *crtc;
227 219
228 mutex_lock(&imxdrm->mutex);
229
230 list_for_each_entry(enc, &imxdrm->encoder_list, list) { 220 list_for_each_entry(enc, &imxdrm->encoder_list, list) {
231 if (!try_module_get(enc->owner)) { 221 if (!try_module_get(enc->owner)) {
232 dev_err(imxdrm->dev, "could not get module %s\n", 222 dev_err(imxdrm->dev, "could not get module %s\n",
@@ -253,8 +243,6 @@ struct drm_device *imx_drm_device_get(void)
253 243
254 imxdrm->references++; 244 imxdrm->references++;
255 245
256 mutex_unlock(&imxdrm->mutex);
257
258 return imxdrm->drm; 246 return imxdrm->drm;
259 247
260unwind_crtc: 248unwind_crtc:
@@ -446,6 +434,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
446 */ 434 */
447 imxdrm->drm->vblank_disable_allowed = 1; 435 imxdrm->drm->vblank_disable_allowed = 1;
448 436
437 if (!imx_drm_device_get())
438 ret = -EINVAL;
439
449 ret = 0; 440 ret = 0;
450 441
451err_init: 442err_init:
@@ -790,7 +781,6 @@ static struct drm_driver imx_drm_driver = {
790 .driver_features = DRIVER_MODESET | DRIVER_GEM, 781 .driver_features = DRIVER_MODESET | DRIVER_GEM,
791 .load = imx_drm_driver_load, 782 .load = imx_drm_driver_load,
792 .unload = imx_drm_driver_unload, 783 .unload = imx_drm_driver_unload,
793 .firstopen = imx_drm_driver_firstopen,
794 .lastclose = imx_drm_driver_lastclose, 784 .lastclose = imx_drm_driver_lastclose,
795 .gem_free_object = drm_gem_cma_free_object, 785 .gem_free_object = drm_gem_cma_free_object,
796 .gem_vm_ops = &drm_gem_cma_vm_ops, 786 .gem_vm_ops = &drm_gem_cma_vm_ops,