From patchwork Sun Oct 18 18:24:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 55209 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id D634822FFA for ; Sun, 18 Oct 2015 18:29:42 +0000 (UTC) Received: by wiyb4 with SMTP id b4sf16835249wiy.2 for ; Sun, 18 Oct 2015 11:29:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=JCoidNjNxa7/Cs1qcrgFbFv3No4V8s/+3ty9BOyV8jc=; b=HfoIKaF9sbYLNDGGOaGsqasjD9jYKs6TbR8MTua6I1Ehrs9VTZgTxUQfi5hucXet5n 8EAiGfXKGHEpkaJGUuI98+P6wYWFnNqnNPkqAHU2ZXVGOrpSo2EvK76u3CgufBbQEJp1 xnb8fdoW6bTkbo07FLPIMxiDIeSJzCFGZkEAu/okd9zhN2VhJ6x2F+OHbvjErYmcqYai +E50oeaPE+GSG8zqCi0ZAHvIVth+EzCULzM6NGr3RNm4pOWy1cJQnPN8z9XqXNz7ZpjR rDbHgfrY9Xozeq3tHwq1sA/cF63wcfgbGMRlUpTnSy+yQRexDd4d2v4eS59ExIrdSmsF HJHQ== X-Gm-Message-State: ALoCoQmYy56S6jd/gfhMGND6IGHW7SO8Svhv9g0gYd+s8Vx+0ifqLpdYqKnlSi8WpvTPh823UBFi X-Received: by 10.112.198.33 with SMTP id iz1mr5934426lbc.8.1445192982146; Sun, 18 Oct 2015 11:29:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.91.205 with SMTP id p196ls441097lfb.28.gmail; Sun, 18 Oct 2015 11:29:41 -0700 (PDT) X-Received: by 10.112.52.40 with SMTP id q8mr12670631lbo.100.1445192981972; Sun, 18 Oct 2015 11:29:41 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id pz6si20090517lbb.172.2015.10.18.11.29.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 11:29:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbpp2 with SMTP id pp2so99729712lbb.0 for ; Sun, 18 Oct 2015 11:29:41 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr12486444lbb.112.1445192981664; Sun, 18 Oct 2015 11:29:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1078871lbq; Sun, 18 Oct 2015 11:29:40 -0700 (PDT) X-Received: by 10.68.174.193 with SMTP id bu1mr29517143pbc.136.1445192980633; Sun, 18 Oct 2015 11:29:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si46483754pbt.148.2015.10.18.11.29.40; Sun, 18 Oct 2015 11:29:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753171AbbJRS3i (ORCPT + 28 others); Sun, 18 Oct 2015 14:29:38 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:35616 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752419AbbJRS0E (ORCPT ); Sun, 18 Oct 2015 14:26:04 -0400 Received: by pasz6 with SMTP id z6so6767310pas.2 for ; Sun, 18 Oct 2015 11:26:03 -0700 (PDT) X-Received: by 10.68.200.167 with SMTP id jt7mr29608943pbc.83.1445192763595; Sun, 18 Oct 2015 11:26:03 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id hq1sm20402076pbb.43.2015.10.18.11.26.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Oct 2015 11:26:03 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH V2 18/30] coresight: etb10: moving to local atomic operations Date: Sun, 18 Oct 2015 12:24:35 -0600 Message-Id: <1445192687-24112-19-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> References: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Moving to use local atomic operations to take advantage of the lockless implementation, something that will come handy when the ETB is accessed from the Perf subsystem. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 77d0f9c1118d..ecdbe0dd4d08 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -84,7 +84,7 @@ struct etb_drvdata { struct coresight_device *csdev; struct miscdevice miscdev; spinlock_t spinlock; - atomic_t in_use; + local_t in_use; u8 *buf; u32 buffer_depth; bool enable; @@ -281,7 +281,7 @@ static int etb_open(struct inode *inode, struct file *file) struct etb_drvdata *drvdata = container_of(file->private_data, struct etb_drvdata, miscdev); - if (atomic_cmpxchg(&drvdata->in_use, 0, 1)) + if (local_cmpxchg(&drvdata->in_use, 0, 1)) return -EBUSY; dev_dbg(drvdata->dev, "%s: successfully opened\n", __func__); @@ -317,7 +317,7 @@ static int etb_release(struct inode *inode, struct file *file) { struct etb_drvdata *drvdata = container_of(file->private_data, struct etb_drvdata, miscdev); - atomic_set(&drvdata->in_use, 0); + local_set(&drvdata->in_use, 0); dev_dbg(drvdata->dev, "%s: released\n", __func__); return 0;