Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp465811yba; Thu, 18 Apr 2019 04:29:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuc5aRENVGKNJFwnm0Jbkt4gavgzm8oFiQEBIOsQsBuge3ArSUXtegwingC5E7P48mTfI3 X-Received: by 2002:aa7:85cc:: with SMTP id z12mr95099109pfn.142.1555586991091; Thu, 18 Apr 2019 04:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555586991; cv=none; d=google.com; s=arc-20160816; b=E7dpjKSnxRYFlq9nN2i3d27vvtoCP0msRDoQTm6nhm7TJRMv2wFcgY/xsyUDcHqdEZ +hD3fdMyOPh6Y0XT6MtWwwWrMZEcoZ6nyqbKkbA6GRTQyS2r4SPKcYMlm+JpW+DTcBN2 8o5dZ5jXvSeoERcQviVSRUPqRQCUQfCtCdxckIu0yMtGcGr32bXaf565FQV6KL3aEV6b /Yst0TJDVYl0EJdYsLcqIpHF5y04ugiB/x4ypd0VkoiWiEuQhle4k7QLnkEF5vY7qTbn FpagJWHQS65/5RXQQmNgMXY5WdlmPTkV7WslXyTLh8WigFDnQSw3fZQcrpJ66Kh5LLKv MTeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=NOozGcXbv3+/MTZGIu3Q9LNrVJvcgJefLyFJ6P5g8DI=; b=BmOtXtmWEXzBN2KLosQVSLG3QoYc3ph051Tzs4z84DgM/CTI3LG/f7vZe9vL95rueU YVJXeT8P4CWdO+IiZteHWUCdw5bcweLzACLthPvoA1k5k54lje3SJAO/RmSt3jR5Yyn1 I0EQHhcPJ7ZXRCKikdJHUl8rxgKzGUWklk2HRo0iMibYN4Wa+WSYseJDfIoQnW7Fhtw3 GXFPaBAPUGpDkIemW302/nqPg69lodiebtq9yfZF17xi2l/ZVDn5vt9hLEDkEa9M+06W qaD2OiMB8ywXjWtc6hJEofXul+kL2ukLEUSUS57SDDFV4sIm2Y0fX4fCVUso/wI/0bJw bieQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=Sq2zHTqp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q82si2240937pfc.104.2019.04.18.04.29.36; Thu, 18 Apr 2019 04:29:51 -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=pass header.i=@zytor.com header.s=2019041745 header.b=Sq2zHTqp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388843AbfDRL1H (ORCPT + 99 others); Thu, 18 Apr 2019 07:27:07 -0400 Received: from terminus.zytor.com ([198.137.202.136]:34321 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbfDRL1H (ORCPT ); Thu, 18 Apr 2019 07:27:07 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x3IBQpFC166760 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 18 Apr 2019 04:26:51 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x3IBQpFC166760 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019041745; t=1555586812; bh=NOozGcXbv3+/MTZGIu3Q9LNrVJvcgJefLyFJ6P5g8DI=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=Sq2zHTqpWCKxWZ1hYhGHPXQXAXBN9dMzaAJeazMw8Mi5hAcZ0lJ8q5oK5q7zpkho1 izggRJCh6XC+8NhIAtJ7akHL8BncFI/rbMoWLzD4O45X73BhosFCd1m+E10Nwu30VK hUJDwwGAdK4oTo3qB5GxfbYBBCF4KcnEzLpxIYWIw3j+KEC1308VAEsxyQ9LDEj2DF mnJV4W9iLGn3P+kOjH5J2r2Q/WFAFCaqzUmZA8RuO6qm2YJi8BxUg58qhtl23ytYam fHUl3kzg8quUrPNjTwsW9zqKJErGPettLOdTKnK29TQ1KGzVNrEXziVq+DcLsQVaN3 0z/w5GmURi/2A== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x3IBQpeR166756; Thu, 18 Apr 2019 04:26:51 -0700 Date: Thu, 18 Apr 2019 04:26:51 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Frederic Weisbecker Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, frederic@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, will.deacon@arm.com, akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, frederic@kernel.org, hpa@zytor.com, tglx@linutronix.de, will.deacon@arm.com, torvalds@linux-foundation.org, paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org In-Reply-To: <20190402160244.32434-3-frederic@kernel.org> References: <20190402160244.32434-3-frederic@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/lockdep: Map remaining magic numbers to lock usage mask names Git-Commit-ID: c902a1e8d9c9b47cd8faa16892710247cdda9b02 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_12_24,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c902a1e8d9c9b47cd8faa16892710247cdda9b02 Gitweb: https://git.kernel.org/tip/c902a1e8d9c9b47cd8faa16892710247cdda9b02 Author: Frederic Weisbecker AuthorDate: Tue, 2 Apr 2019 18:02:42 +0200 Committer: Ingo Molnar CommitDate: Thu, 18 Apr 2019 12:50:17 +0200 locking/lockdep: Map remaining magic numbers to lock usage mask names Clarify the code with mapping some more constant numbers that haven't been named after their corresponding LOCK_USAGE_* symbol. Signed-off-by: Frederic Weisbecker Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Link: https://lkml.kernel.org/r/20190402160244.32434-3-frederic@kernel.org Signed-off-by: Ingo Molnar --- kernel/locking/lockdep.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 9c5819ef4a28..2288aa2fa4c6 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -516,11 +516,11 @@ static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit) { char c = '.'; - if (class->usage_mask & lock_flag(bit + 2)) + if (class->usage_mask & lock_flag(bit + LOCK_USAGE_DIR_MASK)) c = '+'; if (class->usage_mask & lock_flag(bit)) { c = '-'; - if (class->usage_mask & lock_flag(bit + 2)) + if (class->usage_mask & lock_flag(bit + LOCK_USAGE_DIR_MASK)) c = '?'; } @@ -1971,7 +1971,10 @@ static const char *state_rnames[] = { static inline const char *state_name(enum lock_usage_bit bit) { - return (bit & LOCK_USAGE_READ_MASK) ? state_rnames[bit >> 2] : state_names[bit >> 2]; + if (bit & LOCK_USAGE_READ_MASK) + return state_rnames[bit >> LOCK_USAGE_DIR_MASK]; + else + return state_names[bit >> LOCK_USAGE_DIR_MASK]; } static int exclusive_bit(int new_bit) @@ -3017,7 +3020,7 @@ static int (*state_verbose_f[])(struct lock_class *class) = { static inline int state_verbose(enum lock_usage_bit bit, struct lock_class *class) { - return state_verbose_f[bit >> 2](class); + return state_verbose_f[bit >> LOCK_USAGE_DIR_MASK](class); } typedef int (*check_usage_f)(struct task_struct *, struct held_lock *,