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 CBD2FC32750 for ; Fri, 2 Aug 2019 10:10:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A68DC2067D for ; Fri, 2 Aug 2019 10:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564740622; bh=LCuPEMl9BCWf5KOrhlKC+bDgTwak8Y59wmvru5YI/a4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fZ3MMpSq7w7wITo/GAqkIa9OLtH2nm74Ad4QHl0LL8C9eQo+prU7JbUP2lUDzI1xB Z80ASvslrEM2V09wONGSZANoXlRC09iC8VBdZkbdVcqmXPqHgGYHbOOiRNicHF27yL 35I0FfqS9Dv4FTSyd3OVOiCiDmvCV4FqvaDRTWYA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392255AbfHBKKV (ORCPT ); Fri, 2 Aug 2019 06:10:21 -0400 Received: from foss.arm.com ([217.140.110.172]:48918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392227AbfHBKKP (ORCPT ); Fri, 2 Aug 2019 06:10:15 -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 36B9C16A3; Fri, 2 Aug 2019 03:10:15 -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 F1B373F71F; Fri, 2 Aug 2019 03:10:13 -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 6/6] lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions Date: Fri, 2 Aug 2019 11:10:00 +0100 Message-Id: <20190802101000.12958-7-will@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190802101000.12958-1-will@kernel.org> References: <20190802101000.12958-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 eea17f39c4df..814131d492e9 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