Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp845575pxa; Thu, 27 Aug 2020 18:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS3P7QqkJi9g8FvvtUmgxzhFZjjKCS6/ev2RZc8ND1OWFR2bPei1LvkxSI71MPKpx+BZZI X-Received: by 2002:aa7:c611:: with SMTP id h17mr6128072edq.219.1598576885359; Thu, 27 Aug 2020 18:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598576885; cv=none; d=google.com; s=arc-20160816; b=ZEUNTFkDa4d7PZimsepV7MGbqJ7mYkmuT6TIlZ10G5BlEW/9+BfYJvIg37zbVrYKqx snclTJl1fho4eUgdCOdmPw6rSy7stYjU9C9/4FgYlfqu+tJazJ+jApFjRzvuLjI5YJsp NXbXX9NrHW9ARCKz85FQ4eUephE8x1AsDuejt1kNGk7mtYOV1f0BDSnwMeW4c3LhkiRa WM8XDH6YSwZlw/oLAkXajo2hwyB6fC9njwyEWo4W/PoiDjcxPyP7g9FRKEJR2LfPqncq RHBYQCW9e5T4wPtKXK/QN2R5mW2xPlwAOn1Aaa8McYY84gJyhlh0wagEAG/AuzTIT71Q NqZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=iNNXSlfXZDxUzeu1VN6dH2yYhBohpnCB4yaxuullQIQ=; b=wso2Rz+BvaYgloLGxlvulPFqDjG41mdlz1abBMeA7GapBeM/XhuBFgvxC8CZDMaVC4 h9nCWubuSlo3VJkJO7I6LAOv8mKkwafl5IhK35BgnnySXG8OM8SVYvgFoPgNN1GAgeyq jqInkjvx49ndo9j4csEQ7p5qmlhd7vjxugGNd+AqDB+p6h4LhQ+Skw/m3R4gHk9qsj8H 6wrCpqW1o7b0h1TC0hlbdrfPo/Q4Ab4kox+0piQrIozMMNGh0eaGzMoVa/dkyfYjR2T3 jALibRUa2uV7uwwSsgKIvKQLnCmyPM1CtD+HC7TB1Q5lGZ2g5gfvJfG4UmaFlbEjzyeQ n4Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vZkjjk8J; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si2398165edv.411.2020.08.27.18.07.42; Thu, 27 Aug 2020 18:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vZkjjk8J; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727843AbgH1BHB (ORCPT + 99 others); Thu, 27 Aug 2020 21:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH1BHA (ORCPT ); Thu, 27 Aug 2020 21:07:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47923C061264 for ; Thu, 27 Aug 2020 18:07:00 -0700 (PDT) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598576818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNNXSlfXZDxUzeu1VN6dH2yYhBohpnCB4yaxuullQIQ=; b=vZkjjk8JM9xIrW4/dn3cVQFw8P3/zvuoKEAlx+EguFj7HGcYp3gp4PUiBtTuZ+wCdRwZNe gaCxGBiaw/+BSeq064etwl+hCUf/yZ6EEYoLRUsDdTvo+880/AcguvnaGa5YJ99xCVI0rc 5/tOQBkPd1FqYmDBIcJ28vPZjiOPLxmhZREidSF9exix6AsrgWBgV42JoO01ZjdncUwPl1 cI2pfS6q14zL7sDAEe/JlQVi4WJCmVGKRkH8/GvWQEBCgzrmSxLCyAZjfRc1y3OatuaVjh XJfdbAQmwwJ+ksZzod9JgoJalgNsdFsJbgToNyKkWrW2aGQZTmujs6CzgBmM9A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598576818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNNXSlfXZDxUzeu1VN6dH2yYhBohpnCB4yaxuullQIQ=; b=aqZrJT3PWdLpg1FMScIRV7vjbnfmNUJ6f26kSVvDhTWe7hSUtXszGXr7LMsOBTHuYZJx4z BkPOP95psvmYTzDA== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Thomas Gleixner , "Sebastian A. Siewior" , "Paul E. McKenney" , Steven Rostedt , LKML , "Ahmed S. Darwish" Subject: [PATCH v1 2/5] seqlock: Use unique prefix for seqcount_t property accessors Date: Fri, 28 Aug 2020 03:07:07 +0200 Message-Id: <20200828010710.5407-3-a.darwish@linutronix.de> In-Reply-To: <20200828010710.5407-1-a.darwish@linutronix.de> References: <20200519214547.352050-1-a.darwish@linutronix.de> <20200828010710.5407-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At seqlock.h, the following set of functions: - __seqcount_ptr() - __seqcount_preemptible() - __seqcount_assert() act as plain seqcount_t "property" accessors. Meanwhile, the following group: - __seqcount_ptr() - __seqcount_lock_preemptible() - __seqcount_assert_lock_held() act as the equivalent set, but in the generic form, taking either seqcount_t or any of the seqcount_LOCKTYPE_t variants. This is quite confusing, especially the first member where it is called exactly the same in both groups. Differentiate the first group by using "__seqcount_t_" as prefix. This also conforms with the rest of seqlock.h naming conventions. While at it, also constify the property accessors first parameter where appropriate. References: 55f3560df975 ("seqlock: Extend seqcount API with associated locks") Signed-off-by: Ahmed S. Darwish --- include/linux/seqlock.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 598af597f74e..5470e9cd52ce 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -183,13 +183,13 @@ __seqcount_##locktype##_ptr(seqcount_##locktype##_t *s) \ } \ \ static __always_inline bool \ -__seqcount_##locktype##_preemptible(seqcount_##locktype##_t *s) \ +__seqcount_##locktype##_preemptible(const seqcount_##locktype##_t *s) \ { \ return preemptible; \ } \ \ static __always_inline void \ -__seqcount_##locktype##_assert(seqcount_##locktype##_t *s) \ +__seqcount_##locktype##_assert(const seqcount_##locktype##_t *s) \ { \ __SEQ_LOCK(lockdep_assert_held(lockmember)); \ } @@ -198,17 +198,17 @@ __seqcount_##locktype##_assert(seqcount_##locktype##_t *s) \ * __seqprop() for seqcount_t */ -static inline seqcount_t *__seqcount_ptr(seqcount_t *s) +static inline seqcount_t *__seqcount_t_ptr(seqcount_t *s) { return s; } -static inline bool __seqcount_preemptible(seqcount_t *s) +static inline bool __seqcount_t_preemptible(const seqcount_t *s) { return false; } -static inline void __seqcount_assert(seqcount_t *s) +static inline void __seqcount_t_assert(const seqcount_t *s) { lockdep_assert_preemption_disabled(); } @@ -236,12 +236,11 @@ SEQCOUNT_LOCKTYPE(ww_mutex, struct ww_mutex, true, &s->lock->base) #define SEQCNT_MUTEX_ZERO(name, lock) SEQCOUNT_LOCKTYPE_ZERO(name, lock) #define SEQCNT_WW_MUTEX_ZERO(name, lock) SEQCOUNT_LOCKTYPE_ZERO(name, lock) - #define __seqprop_case(s, locktype, prop) \ seqcount_##locktype##_t: __seqcount_##locktype##_##prop((void *)(s)) #define __seqprop(s, prop) _Generic(*(s), \ - seqcount_t: __seqcount_##prop((void *)(s)), \ + seqcount_t: __seqcount_t_##prop((void *)(s)), \ __seqprop_case((s), raw_spinlock, prop), \ __seqprop_case((s), spinlock, prop), \ __seqprop_case((s), rwlock, prop), \ -- 2.28.0