From patchwork Wed Jul 6 17:42:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12908417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529CAC433EF for ; Wed, 6 Jul 2022 17:43:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D267A6B0074; Wed, 6 Jul 2022 13:43:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD60C6B0075; Wed, 6 Jul 2022 13:43:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A66316B0078; Wed, 6 Jul 2022 13:43:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8E5A36B0074 for ; Wed, 6 Jul 2022 13:43:00 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6A031609B9 for ; Wed, 6 Jul 2022 17:43:00 +0000 (UTC) X-FDA: 79657395720.10.5363092 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 055201A0026 for ; Wed, 6 Jul 2022 17:42:59 +0000 (UTC) Received: by mail-qt1-f172.google.com with SMTP id i11so19283204qtr.4 for ; Wed, 06 Jul 2022 10:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5abwFJX0caBzFF+Js6bgQ/JBYtg6GWcVuildYBtbAwo=; b=ltTH5T197YMI/ecIYBQHAB6Y/dPuvYwIG359XO4VA8V/0qN9c5mgWaKRYQ2MmSmZDV 58xsW1LxjuQl3Zu+GUXlmHc0hwzEGylmN1ynMjYw23trwjNr0R6Ph+Busm4f3W+cNSEm PhUJiWuI4pwB1U3ssx15sznLuRDjMV/+1NXx0NbIYAOdU6VwF3ITUBUgB1/uwRpZxsXs RDm0uv0WUTrd8oN2MHI7gLYhS2N1ZsxZut/8zhvpBEyAuudMTMO0PAFOx/I0llYGy9mU myMU2e5SAShjorTLAsH2FnYClZRAXzWH4zYPub5rDUVy/DB80AjmgoOsPMGhMs5kmeZB rT8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5abwFJX0caBzFF+Js6bgQ/JBYtg6GWcVuildYBtbAwo=; b=b39vCG2UIJzV4AH7Lt6rdA2jUv2F3gXTRuuUUygjMIlHMQSQBrrGnQtw8Bzq7JIdGl Y1i75q0pTEep3QzCuGtM+8dKc2grBGqEsTvf56SrQYSJT8vLkC+gn2Ca+5CuIV5uoZBf 8zheWA8CQxLePpA0bHyL9JIiEBoZ8n3ap2p58esMF0E8tPXHpGMgANAxrGjXpxtL1iAy 4y0DohWdtYl6oNK4of6Xeai5BuCWLxs6uHS/QxKhBzc/BIHl5SSNWdVuEl5Ckl7CBacp bMxb+JFI8Gm2zcI3ABwMyBRR+irgvogGuIedjYMpApZiMjx+snqbpkQxrnpY3LEiI9N/ /SFA== X-Gm-Message-State: AJIora9tuM7+OL75pBvtKSydKoDlisu1BXIWoIyxl6M2qb7Vd2R9ihMX /NfwVwZfeEYnfVubhXzbdKg= X-Google-Smtp-Source: AGRyM1uiW459RTrDDsQ0Rz+OFcqJZKsphMfYnHKnl+HUE2gKmt6T0bnFwtG84dHyfM3e2aXVWguMFw== X-Received: by 2002:ac8:5f51:0:b0:31d:2909:bf56 with SMTP id y17-20020ac85f51000000b0031d2909bf56mr32919215qta.73.1657129379169; Wed, 06 Jul 2022 10:42:59 -0700 (PDT) Received: from localhost (c-69-254-185-160.hsd1.fl.comcast.net. [69.254.185.160]) by smtp.gmail.com with ESMTPSA id w11-20020a05622a190b00b003162a22f8f4sm21195911qtc.49.2022.07.06.10.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 10:42:58 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Andrew Morton , Andy Shevchenko , David Howells , Ingo Molnar , Geert Uytterhoeven , Jonathan Corbet , "Kirill A . Shutemov" , Matthew Wilcox , NeilBrown , Rasmus Villemoes , Russell King , Vlastimil Babka , William Kucharski , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Cc: Yury Norov Subject: [PATCH 02/10] lib/bitmap: change return types to bool where appropriate Date: Wed, 6 Jul 2022 10:42:45 -0700 Message-Id: <20220706174253.4175492-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706174253.4175492-1-yury.norov@gmail.com> References: <20220706174253.4175492-1-yury.norov@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657129380; a=rsa-sha256; cv=none; b=sg1oZRnV6RaEGcKyd+J50bSQDD1lAs3TfLjeeqM+tY9qI+Xm1gGyHjC0e7jfYxyfNWeyOf e5L2QLsFKkDsQaxtyAOR2AgGaockSCebSzCH4XzhJL2vgr26YzHjlDLOZf/B8l7jw0wnyN E6+9ty53Wop3rX4u2qNwreSXnhen3so= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ltTH5T19; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.172 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657129380; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5abwFJX0caBzFF+Js6bgQ/JBYtg6GWcVuildYBtbAwo=; b=JJjdeWBoZnZeZF3Y/iKKXt9cOyt7TZ5BWLXJQWI5NHO7UOGB6sy0URk1aPFJQZ9lZbESDp DzK21ESsLi1wJ4Ebp0NM0h1mudfOu5L3ObrK5CcaqdaREDU2V7fpEdC+4F1jvYpi/yJ3xa TBSWkjfU9LamXibkluW1OwgM3r1V6Cw= X-Rspamd-Server: rspam04 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ltTH5T19; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.172 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-Stat-Signature: uqurc9xwcqrqr1qebqmsbfd9jf6fiw1j X-Rspamd-Queue-Id: 055201A0026 X-HE-Tag: 1657129379-425979 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Some bitmap functions return boolean results in int variables. Fix it by changing return types to bool. Signed-off-by: Yury Norov --- include/linux/bitmap.h | 8 ++++---- lib/bitmap.c | 4 ++-- tools/include/linux/bitmap.h | 8 ++++---- tools/lib/bitmap.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 2e6cd5681040..85aace699b2b 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -148,13 +148,13 @@ void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, unsigned int shift, unsigned int nbits); void bitmap_cut(unsigned long *dst, const unsigned long *src, unsigned int first, unsigned int cut, unsigned int nbits); -int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int nbits); void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int nbits); void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int nbits); -int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int nbits); void __bitmap_replace(unsigned long *dst, const unsigned long *old, const unsigned long *new, @@ -303,7 +303,7 @@ void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits); bitmap_copy_clear_tail((unsigned long *)(buf), (const unsigned long *)(bitmap), (nbits)) #endif -static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, +static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, unsigned int nbits) { if (small_const_nbits(nbits)) @@ -329,7 +329,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, __bitmap_xor(dst, src1, src2, nbits); } -static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, +static inline bool bitmap_andnot(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, unsigned int nbits) { if (small_const_nbits(nbits)) diff --git a/lib/bitmap.c b/lib/bitmap.c index b18e31ea6e66..098fd9db2363 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -237,7 +237,7 @@ void bitmap_cut(unsigned long *dst, const unsigned long *src, } EXPORT_SYMBOL(bitmap_cut); -int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits) { unsigned int k; @@ -275,7 +275,7 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, } EXPORT_SYMBOL(__bitmap_xor); -int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits) { unsigned int k; diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h index afdf93bebaaf..2ae7ab8ed7d1 100644 --- a/tools/include/linux/bitmap.h +++ b/tools/include/linux/bitmap.h @@ -14,7 +14,7 @@ int __bitmap_weight(const unsigned long *bitmap, int bits); void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); -int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits); bool __bitmap_equal(const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits); @@ -45,7 +45,7 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits); } -static inline int bitmap_empty(const unsigned long *src, unsigned nbits) +static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits) { if (small_const_nbits(nbits)) return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); @@ -53,7 +53,7 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) return find_first_bit(src, nbits) == nbits; } -static inline int bitmap_full(const unsigned long *src, unsigned int nbits) +static inline bool bitmap_full(const unsigned long *src, unsigned int nbits) { if (small_const_nbits(nbits)) return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); @@ -146,7 +146,7 @@ size_t bitmap_scnprintf(unsigned long *bitmap, unsigned int nbits, * @src2: operand 2 * @nbits: size of bitmap */ -static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, +static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, unsigned int nbits) { if (small_const_nbits(nbits)) diff --git a/tools/lib/bitmap.c b/tools/lib/bitmap.c index 354f8cdc0880..2e351d63fdba 100644 --- a/tools/lib/bitmap.c +++ b/tools/lib/bitmap.c @@ -57,7 +57,7 @@ size_t bitmap_scnprintf(unsigned long *bitmap, unsigned int nbits, return ret; } -int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, +bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits) { unsigned int k;