From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B51AC3A5A3 for ; Tue, 27 Aug 2019 16:32:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F003214DA for ; Tue, 27 Aug 2019 16:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566923568; bh=PiMK7h0Mx5b5PVG0IQIwupkKORbuS0OjdVqBlNFEzJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ClZi8zHZ8RMov7xw5ZUE38GxdCRL3oIHb6F75Gk95GnNbS6tbWoVjHEvSgFD7NfXu AGS0Tp8YJ2EkaVRFl9w3D4yawctlIkMIyz+uuqJ68Fv4B15vMRjfw8pm1VqcLYK37X MuSbmyObyAAeAUfpqIARBFF5ei2XG3h+xR9HAXF4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbfH0Qcr (ORCPT ); Tue, 27 Aug 2019 12:32:47 -0400 Received: from foss.arm.com ([217.140.110.172]:47654 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730394AbfH0Qcj (ORCPT ); Tue, 27 Aug 2019 12:32:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64C9A337; Tue, 27 Aug 2019 09:32:39 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2BD413F59C; Tue, 27 Aug 2019 09:32:38 -0700 (PDT) From: Will Deacon To: linux-kernel@vger.kernel.org Cc: Will Deacon , Kees Cook , Ingo Molnar , Elena Reshetova , Peter Zijlstra , Ard Biesheuvel , Hanjun Guo , Jan Glauber Subject: [PATCH v2 6/6] lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions Date: Tue, 27 Aug 2019 17:32:04 +0100 Message-Id: <20190827163204.29903-7-will@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190827163204.29903-1-will@kernel.org> References: <20190827163204.29903-1-will@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The definitions of REFCOUNT_MAX and REFCOUNT_SATURATED are the same, regardless of CONFIG_REFCOUNT_FULL, so consolidate them into a single pair of definitions. Cc: Kees Cook Cc: Ingo Molnar Cc: Elena Reshetova Cc: Peter Zijlstra Cc: Ard Biesheuvel Signed-off-by: Will Deacon --- include/linux/refcount.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/refcount.h b/include/linux/refcount.h index 7f9aa6511142..1f7e364cfb6d 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -22,6 +22,8 @@ typedef struct refcount_struct { } refcount_t; #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } +#define REFCOUNT_MAX INT_MAX +#define REFCOUNT_SATURATED (INT_MIN / 2) /** * refcount_set - set a refcount's value @@ -47,9 +49,6 @@ static inline unsigned int refcount_read(const refcount_t *r) #ifdef CONFIG_REFCOUNT_FULL #include -#define REFCOUNT_MAX INT_MAX -#define REFCOUNT_SATURATED (INT_MIN / 2) - /* * Variant of atomic_t specialized for reference counts. * @@ -261,10 +260,6 @@ static inline void refcount_dec(refcount_t *r) } } #else /* CONFIG_REFCOUNT_FULL */ - -#define REFCOUNT_MAX INT_MAX -#define REFCOUNT_SATURATED (INT_MIN / 2) - # ifdef CONFIG_ARCH_HAS_REFCOUNT # include # else -- 2.11.0