Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1409280ybi; Fri, 2 Aug 2019 15:13:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXXNcD8nuQyRe62EkDaa7x0Ta4hQEEhwmq5qo7drihLPrYoRFAmFAYOgEzPzg5yC6pBHE1 X-Received: by 2002:a65:6709:: with SMTP id u9mr98148171pgf.58.1564784010044; Fri, 02 Aug 2019 15:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564784010; cv=none; d=google.com; s=arc-20160816; b=SdiE63ojTUFh2r0H7MRf6XmIgZXXujTxN8LSiyiS1CFAstE1+mG1/xsbCEmaeHjrjn Ss6OBqv1DNXKc7xRE2YBKsIqKsX40Be7ZWvA5x3intjVnSNSPbaEYK8RgoUtU6ZCJtlE KZVGI21x0UGC4IAn+eKNMJqxxKX/yEUUn2zP+DBV4cgHHktKOK4N1sAx9z8E1Giegmd0 XR3YMHSABDomVqs770DPUefWvo+cXFyQaf/kIzRfnJRUvx5DEv4KobV5sWB3HGQ+LHLJ 4CEQ1RTHmjH727nbS4IlpH65j3TAKMJtO3cOoI5u/NlR/OWEosJeUl+4FzJ+VfYknjMD 14oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=IiFdESaUeR8/Ptk86fBVa0zD7SnyT3cTX82bjeo6Ol0=; b=xYt8QA/B79LkxlAAc74DaEN01zylPQMxynL8ckcVr0Cz6itpiC7IjpBcUQFyJoa9SA qvScW/X1Kk7RJdyLkrmkpY93ygT89OSd7rl/dTGxs8nMKivxgubFO9IxR9qqn53KeW30 JoQ/jiFU85rSWJ9io6gFmOL1hqdciE2g9Rc/cyMSTD96kJGU62mlV6DlhJt/IRdiDR6P TBKyz3dctyiN8A57iDR8ZUAOHJ6N3rTbgskvZ6B2i/p0mRc2ZyJ8HbXRMAG7wRVRxqQ9 bBxVWhXxR5DYxdlV8cNJ1DvWRAYWpjFEJ+WCw/wdsKcbEfTkmDiq6rKURxB64QAt2UYH 7SWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jKXCa4ur; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cp2si37588851plb.437.2019.08.02.15.13.14; Fri, 02 Aug 2019 15:13:30 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jKXCa4ur; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392560AbfHBMLB (ORCPT + 99 others); Fri, 2 Aug 2019 08:11:01 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:47035 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbfHBMLB (ORCPT ); Fri, 2 Aug 2019 08:11:01 -0400 Received: by mail-pg1-f196.google.com with SMTP id k189so16938107pgk.13; Fri, 02 Aug 2019 05:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IiFdESaUeR8/Ptk86fBVa0zD7SnyT3cTX82bjeo6Ol0=; b=jKXCa4ur+CB/M7X8BamK5WVjN+s0l18BvPO7qhH7sXVsLDwKS0ckV0s2djfLM1aY3K 1JbczSLl+Q/W138nZ7aPIGeN+YxrYMIMRSK5uVoQEqjQQ5Pu0UCatj2WpUTLNcJkrB2z vkFEKb/5AaHcDFXjf+5V58Zdl2Bz/YnzvWV5cKN6BlEo1u6mGhgcWjkoIYawq97KFhfW i1y+ih1VZvzFm3gRZcvPD1o6sfUsowqMljk3oja63oaa7Q9hQSRLdiwsEjSwmD8CjRi5 fqY9KbRZQ04ONqhDOuLGTZYDbrBjQZg4rC3UuLjyiY5/tpFoE5QROTYFqi/WMgeLO55T KhJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IiFdESaUeR8/Ptk86fBVa0zD7SnyT3cTX82bjeo6Ol0=; b=Kh6rf5yH6P9x2PkJjrW41tU09XPAhw5o8pDVcR2MaJJdnrzbTNH2Qvq7cEYs0CfZZN wSAUuHvZwM9X2+qGmUojVe+Hmc9PePK5pXPmr4rjLZLt5z6mKkSRgi7vNjvq6IZhnjnX fV8K6Pa3z8WwZG2PwMdWVsbs3Qncu8woL7y2QeCgG+xtpkVoHO2WdYFKdnXnEiaapa7/ pqQsWclvArodxngcmPQ5Fcffwh7G2S04E/e5Z51V2VAqZo929bpTwQQxfJZ2H9dzqSyL MugvZq1+nBNpfZRFT827hPYtQQRnQD1ITCaviXgUGdOSrzfrRM3WUOXV5ntu0Ye/qeet kn1w== X-Gm-Message-State: APjAAAU7LMZCcJcCFu3a44RYT9SF4jhiLOh7QaJLpdXP8QB/nWa4JKX2 nXxln33fHndU4bz9Gkc+jwY= X-Received: by 2002:a62:35c6:: with SMTP id c189mr59427622pfa.96.1564747860845; Fri, 02 Aug 2019 05:11:00 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id 64sm76484656pfe.128.2019.08.02.05.10.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 05:11:00 -0700 (PDT) From: Chuhong Yuan Cc: Saeed Mahameed , Leon Romanovsky , "David S . Miller" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 2/3] net/mlx5: Use refcount_() APIs Date: Fri, 2 Aug 2019 20:10:55 +0800 Message-Id: <20190802121055.1429-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch depends on PATCH 1/3. After converting refcount to refcount_t, use refcount_() APIs to operate it. Signed-off-by: Chuhong Yuan --- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index b8ba74de9555..7b44d1e49604 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c @@ -53,7 +53,7 @@ mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) common = radix_tree_lookup(&table->tree, rsn); if (common) - atomic_inc(&common->refcount); + refcount_inc(&common->refcount); spin_unlock_irqrestore(&table->lock, flags); @@ -62,7 +62,7 @@ mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common) { - if (atomic_dec_and_test(&common->refcount)) + if (refcount_dec_and_test(&common->refcount)) complete(&common->free); } @@ -209,7 +209,7 @@ static int create_resource_common(struct mlx5_core_dev *dev, if (err) return err; - atomic_set(&qp->common.refcount, 1); + refcount_set(&qp->common.refcount, 1); init_completion(&qp->common.free); qp->pid = current->pid; -- 2.20.1