From patchwork Tue Apr 7 09:32:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 6168291 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E4F2BF4A6 for ; Tue, 7 Apr 2015 09:32:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FEDC2024D for ; Tue, 7 Apr 2015 09:32:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 740702024C for ; Tue, 7 Apr 2015 09:32:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF9F36E442; Tue, 7 Apr 2015 02:32:05 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 252E86E442 for ; Tue, 7 Apr 2015 02:32:05 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 07 Apr 2015 02:32:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,537,1422950400"; d="scan'208";a="552020581" Received: from rheuts-mobl.ger.corp.intel.com (HELO mlankhor-mobl1.ger.corp.intel.com) ([10.252.21.151]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2015 02:32:03 -0700 Message-ID: <5523A412.2000805@linux.intel.com> Date: Tue, 07 Apr 2015 11:32:02 +0200 From: Maarten Lankhorst User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Intel Graphics Development Subject: [Intel-gfx] [PATCH] drm/i915: use kref_put_mutex in i915_gem_request_unreference__unlocked X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, TVD_SPACE_RATIO, T_RP_MATCHES_RCVD, 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 Signed-off-by: Maarten Lankhorst diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b13c5526a73b..7aaf8eddf19c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2146,14 +2146,14 @@ i915_gem_request_unreference(struct drm_i915_gem_request *req) static inline void i915_gem_request_unreference__unlocked(struct drm_i915_gem_request *req) { - if (req && !atomic_add_unless(&req->ref.refcount, -1, 1)) { - struct drm_device *dev = req->ring->dev; + struct drm_device *dev; + + if (!req) + return; - mutex_lock(&dev->struct_mutex); - if (likely(atomic_dec_and_test(&req->ref.refcount))) - i915_gem_request_free(&req->ref); + dev = req->ring->dev; + if (kref_put_mutex(&req->ref, i915_gem_request_free, &dev->struct_mutex)) mutex_unlock(&dev->struct_mutex); - } } static inline void i915_gem_request_assign(struct drm_i915_gem_request **pdst,