Merge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

Fix conncector registration with tda998x.

* 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm:
  drm/i2c: tda998x: mali-dp: hdlcd: refactor connector registration
This commit is contained in:
Dave Airlie 2016-11-17 08:55:26 +10:00
commit 25bfe018c1
3 changed files with 22 additions and 23 deletions

View File

@ -335,14 +335,10 @@ static int hdlcd_drm_bind(struct device *dev)
if (ret) if (ret)
goto err_free; goto err_free;
ret = drm_dev_register(drm, 0);
if (ret)
goto err_unload;
ret = component_bind_all(dev, drm); ret = component_bind_all(dev, drm);
if (ret) { if (ret) {
DRM_ERROR("Failed to bind all components\n"); DRM_ERROR("Failed to bind all components\n");
goto err_unregister; goto err_unload;
} }
ret = pm_runtime_set_active(dev); ret = pm_runtime_set_active(dev);
@ -369,8 +365,17 @@ static int hdlcd_drm_bind(struct device *dev)
goto err_fbdev; goto err_fbdev;
} }
ret = drm_dev_register(drm, 0);
if (ret)
goto err_register;
return 0; return 0;
err_register:
if (hdlcd->fbdev) {
drm_fbdev_cma_fini(hdlcd->fbdev);
hdlcd->fbdev = NULL;
}
err_fbdev: err_fbdev:
drm_kms_helper_poll_fini(drm); drm_kms_helper_poll_fini(drm);
drm_mode_config_cleanup(drm); drm_mode_config_cleanup(drm);
@ -379,8 +384,6 @@ static int hdlcd_drm_bind(struct device *dev)
pm_runtime_disable(drm->dev); pm_runtime_disable(drm->dev);
err_pm_active: err_pm_active:
component_unbind_all(dev, drm); component_unbind_all(dev, drm);
err_unregister:
drm_dev_unregister(drm);
err_unload: err_unload:
drm_irq_uninstall(drm); drm_irq_uninstall(drm);
of_reserved_mem_device_release(drm->dev); of_reserved_mem_device_release(drm->dev);
@ -396,6 +399,7 @@ static void hdlcd_drm_unbind(struct device *dev)
struct drm_device *drm = dev_get_drvdata(dev); struct drm_device *drm = dev_get_drvdata(dev);
struct hdlcd_drm_private *hdlcd = drm->dev_private; struct hdlcd_drm_private *hdlcd = drm->dev_private;
drm_dev_unregister(drm);
if (hdlcd->fbdev) { if (hdlcd->fbdev) {
drm_fbdev_cma_fini(hdlcd->fbdev); drm_fbdev_cma_fini(hdlcd->fbdev);
hdlcd->fbdev = NULL; hdlcd->fbdev = NULL;
@ -409,7 +413,6 @@ static void hdlcd_drm_unbind(struct device *dev)
pm_runtime_disable(drm->dev); pm_runtime_disable(drm->dev);
of_reserved_mem_device_release(drm->dev); of_reserved_mem_device_release(drm->dev);
drm_mode_config_cleanup(drm); drm_mode_config_cleanup(drm);
drm_dev_unregister(drm);
drm_dev_unref(drm); drm_dev_unref(drm);
drm->dev_private = NULL; drm->dev_private = NULL;
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);

View File

@ -359,10 +359,6 @@ static int malidp_bind(struct device *dev)
if (ret < 0) if (ret < 0)
goto init_fail; goto init_fail;
ret = drm_dev_register(drm, 0);
if (ret)
goto register_fail;
/* Set the CRTC's port so that the encoder component can find it */ /* Set the CRTC's port so that the encoder component can find it */
ep = of_graph_get_next_endpoint(dev->of_node, NULL); ep = of_graph_get_next_endpoint(dev->of_node, NULL);
if (!ep) { if (!ep) {
@ -401,8 +397,18 @@ static int malidp_bind(struct device *dev)
} }
drm_kms_helper_poll_init(drm); drm_kms_helper_poll_init(drm);
ret = drm_dev_register(drm, 0);
if (ret)
goto register_fail;
return 0; return 0;
register_fail:
if (malidp->fbdev) {
drm_fbdev_cma_fini(malidp->fbdev);
malidp->fbdev = NULL;
}
fbdev_fail: fbdev_fail:
drm_vblank_cleanup(drm); drm_vblank_cleanup(drm);
vblank_fail: vblank_fail:
@ -415,8 +421,6 @@ static int malidp_bind(struct device *dev)
of_node_put(malidp->crtc.port); of_node_put(malidp->crtc.port);
malidp->crtc.port = NULL; malidp->crtc.port = NULL;
port_fail: port_fail:
drm_dev_unregister(drm);
register_fail:
malidp_fini(drm); malidp_fini(drm);
init_fail: init_fail:
drm->dev_private = NULL; drm->dev_private = NULL;
@ -438,6 +442,7 @@ static void malidp_unbind(struct device *dev)
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm->dev_private;
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
drm_dev_unregister(drm);
if (malidp->fbdev) { if (malidp->fbdev) {
drm_fbdev_cma_fini(malidp->fbdev); drm_fbdev_cma_fini(malidp->fbdev);
malidp->fbdev = NULL; malidp->fbdev = NULL;
@ -449,7 +454,6 @@ static void malidp_unbind(struct device *dev)
component_unbind_all(dev, drm); component_unbind_all(dev, drm);
of_node_put(malidp->crtc.port); of_node_put(malidp->crtc.port);
malidp->crtc.port = NULL; malidp->crtc.port = NULL;
drm_dev_unregister(drm);
malidp_fini(drm); malidp_fini(drm);
drm->dev_private = NULL; drm->dev_private = NULL;
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);

View File

@ -1585,7 +1585,6 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = {
static void tda998x_connector_destroy(struct drm_connector *connector) static void tda998x_connector_destroy(struct drm_connector *connector)
{ {
drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
} }
@ -1657,16 +1656,10 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
if (ret) if (ret)
goto err_connector; goto err_connector;
ret = drm_connector_register(&priv->connector);
if (ret)
goto err_sysfs;
drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder); drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder);
return 0; return 0;
err_sysfs:
drm_connector_cleanup(&priv->connector);
err_connector: err_connector:
drm_encoder_cleanup(&priv->encoder); drm_encoder_cleanup(&priv->encoder);
err_encoder: err_encoder:
@ -1679,7 +1672,6 @@ static void tda998x_unbind(struct device *dev, struct device *master,
{ {
struct tda998x_priv *priv = dev_get_drvdata(dev); struct tda998x_priv *priv = dev_get_drvdata(dev);
drm_connector_unregister(&priv->connector);
drm_connector_cleanup(&priv->connector); drm_connector_cleanup(&priv->connector);
drm_encoder_cleanup(&priv->encoder); drm_encoder_cleanup(&priv->encoder);
tda998x_destroy(priv); tda998x_destroy(priv);