From patchwork Wed Aug 26 11:52:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 510820 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3BF5F14028E for ; Wed, 26 Aug 2015 21:53:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=xO8hPcxr; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756835AbbHZLxE (ORCPT ); Wed, 26 Aug 2015 07:53:04 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:34204 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756288AbbHZLxC (ORCPT ); Wed, 26 Aug 2015 07:53:02 -0400 Received: by obbfr1 with SMTP id fr1so168482393obb.1; Wed, 26 Aug 2015 04:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=F2J/ZDYa49SpoZ8Nt7c8ZqAXMDuyrdmVIpec9F9bHlU=; b=xO8hPcxrY9mu33chb5HAdjseTGedUv1VISflqhxWoWbhlCnIHKGofpnz9189m8VryH F90O859fweXwuXVxReQ6y6dDWuCWEHso12gkaDPxTCz1IuTtOtqOW/57u9AcGdqty91P oS1QqXznnrWhx8H2VWlS8J6EmbFtjnygLelKRH7BReJaxhkZ8UOYpZIPoIx38UaEUlhE XEBYtymoUcRSFUKB/yQlgn7VzZzPj9vWAElJF6fPWAGwrxybpkxAySFmyJjI4BWCuQQ0 mngdPKqvuE4TDbxwkS23TwKuafHRJ2LWW3g94PtGqS7JnKjHX10P3LvHG+rmLS2exzqX vO2Q== X-Received: by 10.182.247.106 with SMTP id yd10mr7276884obc.6.1440589981710; Wed, 26 Aug 2015 04:53:01 -0700 (PDT) Received: from localhost (vm.fixme.name. [192.157.208.129]) by smtp.gmail.com with ESMTPSA id l128sm14223621oig.12.2015.08.26.04.52.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 04:53:00 -0700 (PDT) From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Jonathan Corbet , Shradha Shah , Kishon Vijay Abraham I , William Hubbs , Chris Brannon , Kirk Reiser , Samuel Thibault , Greg Kroah-Hartman , Aybuke Ozdemir , Davidlohr Bueso , linux-net-drivers@solarflare.com, linux-doc@vger.kernel.org, netdev@vger.kernel.org, speakup@linux-speakup.org, devel@driverdev.osuosl.org, Boqun Feng Subject: [PATCH] atomics,cmpxchg: Privatize the inclusion of asm/cmpxchg.h Date: Wed, 26 Aug 2015 19:52:46 +0800 Message-Id: <1440589966-26280-1-git-send-email-boqun.feng@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org After commit: atomics: add acquire/release/relaxed variants of some atomic operations Architectures may only provide {cmp,}xchg_relaxed definitions in asm/cmpxchg.h. Other variants, such as {cmp,}xchg, may be built in linux/atomic.h, which means simply including asm/cmpxchg.h may not get the definitions of all the{cmp,}xchg variants. Therefore, we should privatize the inclusions of asm/cmpxchg.h to keep it only included in arch/* and replace the inclusions outside with linux/atomic.h Acked-by: Will Deacon Signed-off-by: Boqun Feng --- Documentation/atomic_ops.txt | 4 ++++ drivers/net/ethernet/sfc/mcdi.c | 2 +- drivers/phy/phy-rcar-gen2.c | 3 +-- drivers/staging/speakup/selection.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index b19fc34..c9d1cac 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt @@ -542,6 +542,10 @@ The routines xchg() and cmpxchg() must provide the same exact memory-barrier semantics as the atomic and bit operations returning values. +Note: If someone wants to use xchg(), cmpxchg() and their variants, +linux/atomic.h should be included rather than asm/cmpxchg.h, unless +the code is in arch/* and can take care of itself. + Spinlocks and rwlocks have memory barrier expectations as well. The rule to follow is simple: diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 81640f8..968383e 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include "net_driver.h" #include "nic.h" #include "io.h" diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c index 39d9b29..117b495 100644 --- a/drivers/phy/phy-rcar-gen2.c +++ b/drivers/phy/phy-rcar-gen2.c @@ -17,8 +17,7 @@ #include #include #include - -#include +#include #define USBHS_LPSTS 0x02 #define USBHS_UGCTRL 0x80 diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c index a031570..81c0888 100644 --- a/drivers/staging/speakup/selection.c +++ b/drivers/staging/speakup/selection.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "speakup.h"