Commit b5dc0d10 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 24f40032
...@@ -69,28 +69,20 @@ struct imx_drm_connector { ...@@ -69,28 +69,20 @@ struct imx_drm_connector {
struct module *owner; struct module *owner;
}; };
static int imx_drm_driver_firstopen(struct drm_device *drm)
{
if (!imx_drm_device_get())
return -EINVAL;
return 0;
}
static void imx_drm_driver_lastclose(struct drm_device *drm) static void imx_drm_driver_lastclose(struct drm_device *drm)
{ {
struct imx_drm_device *imxdrm = drm->dev_private; struct imx_drm_device *imxdrm = drm->dev_private;
if (imxdrm->fbhelper) if (imxdrm->fbhelper)
drm_fbdev_cma_restore_mode(imxdrm->fbhelper); drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
imx_drm_device_put();
} }
static int imx_drm_driver_unload(struct drm_device *drm) static int imx_drm_driver_unload(struct drm_device *drm)
{ {
struct imx_drm_device *imxdrm = drm->dev_private; struct imx_drm_device *imxdrm = drm->dev_private;
imx_drm_device_put();
drm_mode_config_cleanup(imxdrm->drm); drm_mode_config_cleanup(imxdrm->drm);
drm_kms_helper_poll_fini(imxdrm->drm); drm_kms_helper_poll_fini(imxdrm->drm);
...@@ -225,8 +217,6 @@ struct drm_device *imx_drm_device_get(void) ...@@ -225,8 +217,6 @@ struct drm_device *imx_drm_device_get(void)
struct imx_drm_connector *con; struct imx_drm_connector *con;
struct imx_drm_crtc *crtc; struct imx_drm_crtc *crtc;
mutex_lock(&imxdrm->mutex);
list_for_each_entry(enc, &imxdrm->encoder_list, list) { list_for_each_entry(enc, &imxdrm->encoder_list, list) {
if (!try_module_get(enc->owner)) { if (!try_module_get(enc->owner)) {
dev_err(imxdrm->dev, "could not get module %s\n", dev_err(imxdrm->dev, "could not get module %s\n",
...@@ -253,8 +243,6 @@ struct drm_device *imx_drm_device_get(void) ...@@ -253,8 +243,6 @@ struct drm_device *imx_drm_device_get(void)
imxdrm->references++; imxdrm->references++;
mutex_unlock(&imxdrm->mutex);
return imxdrm->drm; return imxdrm->drm;
unwind_crtc: unwind_crtc:
...@@ -446,6 +434,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) ...@@ -446,6 +434,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
*/ */
imxdrm->drm->vblank_disable_allowed = 1; imxdrm->drm->vblank_disable_allowed = 1;
if (!imx_drm_device_get())
ret = -EINVAL;
ret = 0; ret = 0;
err_init: err_init:
...@@ -790,7 +781,6 @@ static struct drm_driver imx_drm_driver = { ...@@ -790,7 +781,6 @@ static struct drm_driver imx_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM, .driver_features = DRIVER_MODESET | DRIVER_GEM,
.load = imx_drm_driver_load, .load = imx_drm_driver_load,
.unload = imx_drm_driver_unload, .unload = imx_drm_driver_unload,
.firstopen = imx_drm_driver_firstopen,
.lastclose = imx_drm_driver_lastclose, .lastclose = imx_drm_driver_lastclose,
.gem_free_object = drm_gem_cma_free_object, .gem_free_object = drm_gem_cma_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops, .gem_vm_ops = &drm_gem_cma_vm_ops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment