Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp252283pxa; Thu, 27 Aug 2020 00:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn5XpcCu7vH2lTuFnB7pk07/i5IG21PHG0NGlPG27CFSDFj2Hw4EAx4xUzCx9WcVBxbOVF X-Received: by 2002:a05:6402:3088:: with SMTP id de8mr18645768edb.88.1598514952807; Thu, 27 Aug 2020 00:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598514952; cv=none; d=google.com; s=arc-20160816; b=u+UaabL26wUyLZ7bnwgd/gHFNsimgKCIVBIQyVXakwfqFh08Xq/VZXxnzl/+QRLwna 4CbtNuL6wnQaY4D20DqmefKrSDhYAUlYNhAqapUpxwBTQP2tY561rQm0R/MfuQNRUpA+ 4YHM4MrWe25gdX4mqZvowMhZeWvf/NXZYpAe4NYWEtFKGm5YAvz4OJNL+ejkH2jEfiVU LpEwyWPiWk/5sPF9LbgpyvLg8AKJsW84SHk9kpcyIpgj+TDM174MoRXro+ZPJ8haIoFb mtVlmZ0tLHLGtb8eerQct6WxvnJT3/H0Nc/6PLuS5l3I3+dY4nb9CR3yMNJPcFmhn5nU ne9g== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=JMaCkBRf2g+ayYANtGgYVsSQhnMYQyNvj1YOJgXDtvk=; b=OkYQZ0hbXpZJZevxaSM5tIluz0DgbaW+2BgMM9ydfkNPMqYzt/1DJzTzwYuRfsqfCJ R8oFYDNQOJypIVS3m9YDMQasD7WYFZYD/lzI6mnM5/nsYRahzIZBBnZ2x2las1DUiNtt lH8JqKzugUVblb3jcZtunAcdQ6L1mAbyYaMp2BrGNXuDnXHie65nWTxtdO3PtroT1Wug Lj5JHTDNttRcmvOigvCYOomi3wkn1SaP5qhTCuaPznmqXbIieO2kLLO9SNJUu36nfWdy aRZPjF449/uAXWAPorjZmU8cmOFMR0qrvp6S7JKhSamhOeUXNbeHiutqQDlhmqBDA0zQ 9U7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=Oq2qxSjw; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=wB72Ahob; 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=fail (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 gs14si872197ejb.615.2020.08.27.00.55.30; Thu, 27 Aug 2020 00:55:52 -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=fail header.i=@linutronix.de header.s=2020 header.b=Oq2qxSjw; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=wB72Ahob; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728470AbgH0Hye (ORCPT + 99 others); Thu, 27 Aug 2020 03:54:34 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:36582 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728369AbgH0HyW (ORCPT ); Thu, 27 Aug 2020 03:54:22 -0400 Date: Thu, 27 Aug 2020 07:54:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598514859; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JMaCkBRf2g+ayYANtGgYVsSQhnMYQyNvj1YOJgXDtvk=; b=Oq2qxSjwq4m4R7jtFJbb4nQxoUDkXP2KO2CS6htTMgeysdVwYreQE9z/IrdILm9WD+/LMh K9p70mU6gsqCGIaVmSCkU49QIxkFmgV1y+7FoEPA3REg4bLHLqqRIxmZlxL4Ytfz0SIBzV 2hGCxqY/7cSvJEQQtm5RFaoaytvC2jAcGBwAeM9o5vBvDOdY1g9TsNvuFNu7DurljA221H s5XnAPMNNbbvPR/5P2GuPd+rxcDWEMaicJ1RI6E6JGQvh0vH9WiJhNPaR5Za8rzlfwon8F KwcJHCA0CRyB/gEno6k8RXEyG64q5Zkdeum7S7QgFSnexgJ8tIz3vhkTAPG/xw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598514859; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JMaCkBRf2g+ayYANtGgYVsSQhnMYQyNvj1YOJgXDtvk=; b=wB72AhobnsIRaVbXBP9eg+7bKXf3F9NMisibiDFtM5eNsw4TWbTakLqVRL9YVA472f9ZTR IUBlFWmyDdp8gSAw== From: "tip-bot2 for Boqun Feng" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] lockdep: Make __bfs(.match) return bool Cc: Peter Zijlstra , Boqun Feng , x86 , LKML In-Reply-To: <20200807074238.1632519-9-boqun.feng@gmail.com> References: <20200807074238.1632519-9-boqun.feng@gmail.com> MIME-Version: 1.0 Message-ID: <159851485926.20229.14104571007024271963.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 61775ed243433ff0556c4f76905929fe01e92922 Gitweb: https://git.kernel.org/tip/61775ed243433ff0556c4f76905929fe01e92922 Author: Boqun Feng AuthorDate: Fri, 07 Aug 2020 15:42:27 +08:00 Committer: Peter Zijlstra CommitterDate: Wed, 26 Aug 2020 12:42:05 +02:00 lockdep: Make __bfs(.match) return bool The "match" parameter of __bfs() is used for checking whether we hit a match in the search, therefore it should return a boolean value rather than an integer for better readability. This patch then changes the return type of the function parameter and the match functions to bool. Suggested-by: Peter Zijlstra Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200807074238.1632519-9-boqun.feng@gmail.com --- kernel/locking/lockdep.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 5abc227..78cd74d 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1620,7 +1620,7 @@ static inline void bfs_init_rootb(struct lock_list *lock, */ static enum bfs_result __bfs(struct lock_list *source_entry, void *data, - int (*match)(struct lock_list *entry, void *data), + bool (*match)(struct lock_list *entry, void *data), struct lock_list **target_entry, int offset) { @@ -1711,7 +1711,7 @@ exit: static inline enum bfs_result __bfs_forwards(struct lock_list *src_entry, void *data, - int (*match)(struct lock_list *entry, void *data), + bool (*match)(struct lock_list *entry, void *data), struct lock_list **target_entry) { return __bfs(src_entry, data, match, target_entry, @@ -1722,7 +1722,7 @@ __bfs_forwards(struct lock_list *src_entry, static inline enum bfs_result __bfs_backwards(struct lock_list *src_entry, void *data, - int (*match)(struct lock_list *entry, void *data), + bool (*match)(struct lock_list *entry, void *data), struct lock_list **target_entry) { return __bfs(src_entry, data, match, target_entry, @@ -1833,7 +1833,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth, print_circular_bug_entry(entry, depth); } -static inline int class_equal(struct lock_list *entry, void *data) +static inline bool class_equal(struct lock_list *entry, void *data) { return entry->class == data; } @@ -1888,10 +1888,10 @@ static noinline void print_bfs_bug(int ret) WARN(1, "lockdep bfs error:%d\n", ret); } -static int noop_count(struct lock_list *entry, void *data) +static bool noop_count(struct lock_list *entry, void *data) { (*(unsigned long *)data)++; - return 0; + return false; } static unsigned long __lockdep_count_forward_deps(struct lock_list *this) @@ -2032,11 +2032,11 @@ check_redundant(struct held_lock *src, struct held_lock *target) #ifdef CONFIG_TRACE_IRQFLAGS -static inline int usage_accumulate(struct lock_list *entry, void *mask) +static inline bool usage_accumulate(struct lock_list *entry, void *mask) { *(unsigned long *)mask |= entry->class->usage_mask; - return 0; + return false; } /* @@ -2045,9 +2045,9 @@ static inline int usage_accumulate(struct lock_list *entry, void *mask) * without creating any illegal irq-safe -> irq-unsafe lock dependency. */ -static inline int usage_match(struct lock_list *entry, void *mask) +static inline bool usage_match(struct lock_list *entry, void *mask) { - return entry->class->usage_mask & *(unsigned long *)mask; + return !!(entry->class->usage_mask & *(unsigned long *)mask); } /*