Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1451728yba; Tue, 2 Apr 2019 09:06:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCyjtt8g0Y/0M/HYm2PrKWUJKWP3ZunRWfojAMLhnr4V0KY8OGK8Z5lt0B9ivphDOqv4O5 X-Received: by 2002:a65:410a:: with SMTP id w10mr67141509pgp.206.1554221214672; Tue, 02 Apr 2019 09:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554221214; cv=none; d=google.com; s=arc-20160816; b=DfCyHbuJwEuay787MQggM1t+iKEhuWVB12/hrST3y9SYszkE7SlC6rDLS4pQONnOZT ErR0hhCvZlhfdBinIWvt4D1e0Tv4JQURSwRdbJmhiLLe53GhuQf8dqfO3Cusmwi6QTvq M6LHro5+fpCw+EOXVRkcv7aLBSjq36vhq5Ne9W1myWTvQD3hW6N++3bhHjEW8ShxCVwX qc1YVC01lPXnVKHjIithL4J7doONoehnnZfHhBwKJp0GqCcx1SF2wSlciOEdtPJCQP+6 iQnouBShFRxNI3tassn6PxGpOk51buxmiuedXj3zKSujhUFxQWVL5RF22m44C0/LY57F Ej/w== 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:from :dkim-signature; bh=h2L1eRy1rNQLM9ZFplJ2SLYVMdge6SLzcs0TPWKZQ+8=; b=WWvBfagnUjFaaItWtVw9wVN8cNM7c3Z4eJ6x1Ajej3XdjYv9MuO7t7t8ESP1yGGqU1 OVjE2IaVj+D3klKq4zd5pc1wdpMpz4V/whPvfYcgUB+Q1T3GDAmUTHxBqKKtmXODH/l0 qKYKeQHTqwzBQHwJW20cSE9IGjlRiY/IiNra5U02Boyu8rHTDkJtNrN4ss7h50uobhxO eakY4naJg0jh4L2FHlzWZ0kkH9/w4RX7ZxnSu83JE5K1N3bjEXi1AXYqRYf9n9+P2JX1 Wtw9iPmJsTztncmySssGNKwch+AZW6NTFB2/0eRrS/B2ol/j7UdJWKiWPJcfJvsjhurC bCxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lxi+VPkI; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si11966999plb.247.2019.04.02.09.06.39; Tue, 02 Apr 2019 09:06:54 -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=@kernel.org header.s=default header.b=Lxi+VPkI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730618AbfDBQDG (ORCPT + 99 others); Tue, 2 Apr 2019 12:03:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:42838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730178AbfDBQCz (ORCPT ); Tue, 2 Apr 2019 12:02:55 -0400 Received: from lenoir.home (lfbn-1-18527-45.w90-101.abo.wanadoo.fr [90.101.69.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E180E2084C; Tue, 2 Apr 2019 16:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554220975; bh=4N+VPm5f1/zQnNNJbcqUM3GEbcauyNmfi+aHALhvDLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lxi+VPkIeZS33NpQ/6gNa/R+Rvabm87WICBuhggWDFbYv+PzZ9YYclaBTfh29bX1K DzngTRTS4D5XNfBLhBTRfCNitYGtj5cJVkRTTVgPVff2km7cx42MPYwgAZZF3Z86jq ipUOZEe96GrIIk26j78CRbNPdxGyE5CZ8NbS/Ty0= From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Ingo Molnar , Peter Zijlstra Subject: [PATCH 2/4] locking/lockdep: Map remaining magic numbers to lock usage mask names Date: Tue, 2 Apr 2019 18:02:42 +0200 Message-Id: <20190402160244.32434-3-frederic@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402160244.32434-1-frederic@kernel.org> References: <20190402160244.32434-1-frederic@kernel.org> 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 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 Cc: Ingo Molnar Cc: Peter Zijlstra --- 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 *, -- 2.21.0