Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccec7f62 authored by Russell King's avatar Russell King
Browse files

imx-drm: imx-drm-core: kill off mutex



This mutex doesn't protect anything anymore; get rid of it.

Acked-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
Reviewed-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 06c6b82b
Loading
Loading
Loading
Loading
+3 −23
Original line number Original line Diff line number Diff line
@@ -40,14 +40,12 @@ struct imx_drm_device {
	struct drm_device			*drm;
	struct drm_device			*drm;
	struct device				*dev;
	struct device				*dev;
	struct imx_drm_crtc			*crtc[MAX_CRTC];
	struct imx_drm_crtc			*crtc[MAX_CRTC];
	struct mutex				mutex;
	int					pipes;
	int					pipes;
	struct drm_fbdev_cma			*fbhelper;
	struct drm_fbdev_cma			*fbhelper;
};
};


struct imx_drm_crtc {
struct imx_drm_crtc {
	struct drm_crtc				*crtc;
	struct drm_crtc				*crtc;
	struct imx_drm_device			*imxdrm;
	int					pipe;
	int					pipe;
	struct imx_drm_crtc_helper_funcs	imx_drm_helper_funcs;
	struct imx_drm_crtc_helper_funcs	imx_drm_helper_funcs;
	struct crtc_cookie			cookie;
	struct crtc_cookie			cookie;
@@ -270,8 +268,6 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)


	drm_mode_config_init(drm);
	drm_mode_config_init(drm);


	mutex_lock(&imxdrm->mutex);

	drm_kms_helper_poll_init(drm);
	drm_kms_helper_poll_init(drm);


	ret = drm_vblank_init(drm, MAX_CRTC);
	ret = drm_vblank_init(drm, MAX_CRTC);
@@ -287,12 +283,10 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)


	platform_set_drvdata(drm->platformdev, drm);
	platform_set_drvdata(drm->platformdev, drm);


	mutex_unlock(&imxdrm->mutex);

	/* Now try and bind all our sub-components */
	/* Now try and bind all our sub-components */
	ret = component_bind_all(drm->dev, drm);
	ret = component_bind_all(drm->dev, drm);
	if (ret)
	if (ret)
		goto err_relock;
		goto err_vblank;


	/*
	/*
	 * All components are now added, we can publish the connector sysfs
	 * All components are now added, we can publish the connector sysfs
@@ -332,13 +326,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)


err_unbind:
err_unbind:
	component_unbind_all(drm->dev, drm);
	component_unbind_all(drm->dev, drm);
err_relock:
err_vblank:
	mutex_lock(&imxdrm->mutex);
	drm_vblank_cleanup(drm);
	drm_vblank_cleanup(drm);
err_kms:
err_kms:
	drm_kms_helper_poll_fini(drm);
	drm_kms_helper_poll_fini(drm);
	drm_mode_config_cleanup(drm);
	drm_mode_config_cleanup(drm);
	mutex_unlock(&imxdrm->mutex);


	return ret;
	return ret;
}
}
@@ -358,8 +350,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
	struct imx_drm_crtc *imx_drm_crtc;
	struct imx_drm_crtc *imx_drm_crtc;
	int ret;
	int ret;


	mutex_lock(&imxdrm->mutex);

	/*
	/*
	 * The vblank arrays are dimensioned by MAX_CRTC - we can't
	 * The vblank arrays are dimensioned by MAX_CRTC - we can't
	 * pass IDs greater than this to those functions.
	 * pass IDs greater than this to those functions.
@@ -386,7 +376,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
	imx_drm_crtc->cookie.id = id;
	imx_drm_crtc->cookie.id = id;
	imx_drm_crtc->mux_id = imx_drm_crtc->pipe;
	imx_drm_crtc->mux_id = imx_drm_crtc->pipe;
	imx_drm_crtc->crtc = crtc;
	imx_drm_crtc->crtc = crtc;
	imx_drm_crtc->imxdrm = imxdrm;


	imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc;
	imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc;


@@ -402,8 +391,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
	drm_crtc_init(drm, crtc,
	drm_crtc_init(drm, crtc,
			imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
			imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);


	mutex_unlock(&imxdrm->mutex);

	return 0;
	return 0;


err_register:
err_register:
@@ -411,7 +398,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
	kfree(imx_drm_crtc);
	kfree(imx_drm_crtc);
err_alloc:
err_alloc:
err_busy:
err_busy:
	mutex_unlock(&imxdrm->mutex);
	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
@@ -421,16 +407,12 @@ EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
 */
 */
int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
{
{
	struct imx_drm_device *imxdrm = imx_drm_crtc->imxdrm;
	struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;

	mutex_lock(&imxdrm->mutex);


	drm_crtc_cleanup(imx_drm_crtc->crtc);
	drm_crtc_cleanup(imx_drm_crtc->crtc);


	imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
	imxdrm->crtc[imx_drm_crtc->pipe] = NULL;


	mutex_unlock(&imxdrm->mutex);

	kfree(imx_drm_crtc);
	kfree(imx_drm_crtc);


	return 0;
	return 0;
@@ -657,8 +639,6 @@ static int __init imx_drm_init(void)
	if (!imx_drm_device)
	if (!imx_drm_device)
		return -ENOMEM;
		return -ENOMEM;


	mutex_init(&imx_drm_device->mutex);

	ret = platform_driver_register(&imx_drm_pdrv);
	ret = platform_driver_register(&imx_drm_pdrv);
	if (ret)
	if (ret)
		goto err_pdrv;
		goto err_pdrv;