diff options
-rw-r--r-- | drivers/staging/imx-drm/imx-drm-core.c | 20 |
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 | ||
72 | static 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 | |||
80 | static void imx_drm_driver_lastclose(struct drm_device *drm) | 72 | static 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 | ||
90 | static int imx_drm_driver_unload(struct drm_device *drm) | 80 | static 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 | ||
260 | unwind_crtc: | 248 | unwind_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 | ||
451 | err_init: | 442 | err_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, |