From patchwork Thu Nov 19 16:46:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 7659171 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3FFA9FDE3 for ; Thu, 19 Nov 2015 16:47:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7931B20650 for ; Thu, 19 Nov 2015 16:47:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D646F2069E for ; Thu, 19 Nov 2015 16:47:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B3717A166; Thu, 19 Nov 2015 08:47:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id B72CF7A16A for ; Thu, 19 Nov 2015 08:47:07 -0800 (PST) Received: by wmvv187 with SMTP id v187so34939816wmv.1 for ; Thu, 19 Nov 2015 08:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xSX8AuoZOpLS4VZ3BdS5vLrRoB12yTuMARYAC1Kng0g=; b=gmpA0Xlr4WbndCTagKffFwyZVK8GLGYQCuzycOGMRrU22TEGFUxlpyKwB4LTbQPhTd x36Mhvm89luzed9tqChj/K93ucO9gofMiRCpTi7nLpW0vExdR40pUPusbYNeiggiaDt/ tFRHnsruuZiDIAm4b3ASv08xYphNtsQT/6/0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xSX8AuoZOpLS4VZ3BdS5vLrRoB12yTuMARYAC1Kng0g=; b=myEH+1YnRrhETTeWv7CsT17h4Ksi4zeh4iYZGRMV7hda/ke5S7/AOUWf1xS5DMmyq2 Fgz4rbXoOGiKURd+zmRXxvkXYT/pExGRriaDwXw7eEqb6tsmz+1d88qmnZW6xJheJijU svkm4Oe/pdyZaS7BlJYvusq1paNC8hLEgQFMM7Z8k/fF6wW2rCckl2pTrQQjeEmAg8xE I4NOP5UtPAegxvxM3bi5U7qpbmyNVZ1Od3E9qgSGaBK7eniqKgz8UQIPsOIAAxCvFI36 I2UaTeKjYAbVRMyNCeM8FAMsH2sR6Fa5EjR+VfEAYdSKyVaJMX7Csk3FVpOahzruLVmh vmdg== X-Gm-Message-State: ALoCoQlMZ87hXpFoFBQCc1BMwdlMj+zuPsrzQsfNAEa57T3ZqTwsWOEelnSW1TX97Vq0RDoy7UDb X-Received: by 10.28.19.20 with SMTP id 20mr3279155wmt.49.1447951626421; Thu, 19 Nov 2015 08:47:06 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id cv3sm8695001wjc.20.2015.11.19.08.47.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 08:47:05 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH RESEND 08/20] drm/gma500: Drop dev->struct_mutex from modeset code Date: Thu, 19 Nov 2015 17:46:37 +0100 Message-Id: <1447951610-12622-9-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1447951610-12622-1-git-send-email-daniel.vetter@ffwll.ch> References: <1447951610-12622-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 It's either init code or already protected by other means. Note that psb_gtt_pin/unpin has it's own lock, and that's really the only piece of driver private state - all the modeset state is protected with modeset locks already. The only important bit is to switch all gem_obj_unref calls to the _unlocked variant. Cc: Patrik Jakobsson Acked-by: Patrik Jakobsson Signed-off-by: Daniel Vetter --- drivers/gpu/drm/gma500/gma_display.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index 001b450b27b3..ff17af4cfc64 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -349,8 +349,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, /* If we didn't get a handle then turn the cursor off */ if (!handle) { temp = CURSOR_MODE_DISABLE; - mutex_lock(&dev->struct_mutex); - if (gma_power_begin(dev, false)) { REG_WRITE(control, temp); REG_WRITE(base, 0); @@ -362,11 +360,9 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem); psb_gtt_unpin(gt); - drm_gem_object_unreference(gma_crtc->cursor_obj); + drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj); gma_crtc->cursor_obj = NULL; } - - mutex_unlock(&dev->struct_mutex); return 0; } @@ -376,7 +372,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, return -EINVAL; } - mutex_lock(&dev->struct_mutex); obj = drm_gem_object_lookup(dev, file_priv, handle); if (!obj) { ret = -ENOENT; @@ -441,17 +436,15 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, if (gma_crtc->cursor_obj) { gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem); psb_gtt_unpin(gt); - drm_gem_object_unreference(gma_crtc->cursor_obj); + drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj); } gma_crtc->cursor_obj = obj; unlock: - mutex_unlock(&dev->struct_mutex); return ret; unref_cursor: - drm_gem_object_unreference(obj); - mutex_unlock(&dev->struct_mutex); + drm_gem_object_unreference_unlocked(obj); return ret; }