From patchwork Thu Jan 2 21:29:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 3431941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 552559F2E9 for ; Fri, 3 Jan 2014 15:25:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E49020108 for ; Fri, 3 Jan 2014 15:25:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 07F452012B for ; Fri, 3 Jan 2014 15:25:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58F02FACBF; Fri, 3 Jan 2014 07:25:29 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pandora.arm.linux.org.uk (gw-1.arm.linux.org.uk [78.32.30.217]) by gabe.freedesktop.org (Postfix) with ESMTP id B07B5FB913 for ; Thu, 2 Jan 2014 13:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=jsQvnekwFjnfsmuesRakoWvnqvQJguryehxyFbqyfXg=; b=N9G9nHOBkFT68mD/kykFVBo2X1dmaGhKiRA/uXTFGwd3PCrsNXt5Xk3a13bgSjRXj0OWiXjUY5j05OXAb1FHFz9e/KKjdrsrbckZOElp6MALZjOTWmOSQ2uNLVNzc0ePDXpX3IMnuh8W3mKo/eIIwP+jeaJXnSWOjsfe0MVls3k=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:46460 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1VyppB-0004By-MF; Thu, 02 Jan 2014 21:29:05 +0000 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1VyppB-0007G7-6I; Thu, 02 Jan 2014 21:29:05 +0000 In-Reply-To: <20140102212528.GD7383@n2100.arm.linux.org.uk> References: <20140102212528.GD7383@n2100.arm.linux.org.uk> From: Russell King To: David Airlie , Greg Kroah-Hartman , Sascha Hauer , Shawn Guo Subject: [PATCH RFC 39/46] imx-drm: imx-drm-core: kill off mutex Message-Id: Date: Thu, 02 Jan 2014 21:29:05 +0000 X-Mailman-Approved-At: Fri, 03 Jan 2014 07:21:55 -0800 Cc: devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This mutex doesn't protect anything anymore; get rid of it. Signed-off-by: Russell King --- drivers/staging/imx-drm/imx-drm-core.c | 26 +++----------------------- 1 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 10cfea0e948a..0172739a00fe 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -40,14 +40,12 @@ struct imx_drm_device { struct drm_device *drm; struct device *dev; struct imx_drm_crtc *crtc[MAX_CRTC]; - struct mutex mutex; int pipes; struct drm_fbdev_cma *fbhelper; }; struct imx_drm_crtc { struct drm_crtc *crtc; - struct imx_drm_device *imxdrm; int pipe; struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; 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); - mutex_lock(&imxdrm->mutex); - drm_kms_helper_poll_init(drm); ret = drm_vblank_init(drm, MAX_CRTC); @@ -285,12 +281,10 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) */ drm->vblank_disable_allowed = true; - mutex_unlock(&imxdrm->mutex); - /* Now try and bind all our sub-components */ ret = component_bind_all(drm->dev, drm); if (ret) - goto err_relock; + goto err_vblank; /* * All components are now added, we can publish the connector sysfs @@ -330,13 +324,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) err_unbind: component_unbind_all(drm->dev, drm); -err_relock: - mutex_lock(&imxdrm->mutex); +err_vblank: drm_vblank_cleanup(drm); err_kms: drm_kms_helper_poll_fini(drm); drm_mode_config_cleanup(drm); - mutex_unlock(&imxdrm->mutex); return ret; } @@ -356,8 +348,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, struct imx_drm_crtc *imx_drm_crtc; int ret; - mutex_lock(&imxdrm->mutex); - /* * The vblank arrays are dimensioned by MAX_CRTC - we can't * pass IDs greater than this to those functions. @@ -384,7 +374,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, imx_drm_crtc->cookie.id = id; imx_drm_crtc->mux_id = imx_drm_crtc->pipe; imx_drm_crtc->crtc = crtc; - imx_drm_crtc->imxdrm = imxdrm; imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc; @@ -400,8 +389,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, drm_crtc_init(drm, crtc, imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs); - mutex_unlock(&imxdrm->mutex); - return 0; err_register: @@ -409,7 +396,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, kfree(imx_drm_crtc); err_alloc: err_busy: - mutex_unlock(&imxdrm->mutex); return ret; } EXPORT_SYMBOL_GPL(imx_drm_add_crtc); @@ -419,16 +405,12 @@ EXPORT_SYMBOL_GPL(imx_drm_add_crtc); */ int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc) { - struct imx_drm_device *imxdrm = imx_drm_crtc->imxdrm; - - mutex_lock(&imxdrm->mutex); + struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private; drm_crtc_cleanup(imx_drm_crtc->crtc); imxdrm->crtc[imx_drm_crtc->pipe] = NULL; - mutex_unlock(&imxdrm->mutex); - kfree(imx_drm_crtc); return 0; @@ -655,8 +637,6 @@ static int __init imx_drm_init(void) if (!imx_drm_device) return -ENOMEM; - mutex_init(&imx_drm_device->mutex); - ret = platform_driver_register(&imx_drm_pdrv); if (ret) goto err_pdrv;