From patchwork Fri Jul 1 12:54:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12903255 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 21687CCA480 for ; Fri, 1 Jul 2022 12:54:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 146636B0075; Fri, 1 Jul 2022 08:54:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CED36B0078; Fri, 1 Jul 2022 08:54:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEE1E6B007D; Fri, 1 Jul 2022 08:54:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D106F6B0075 for ; Fri, 1 Jul 2022 08:54:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A9775212F2 for ; Fri, 1 Jul 2022 12:54:37 +0000 (UTC) X-FDA: 79638524994.01.D6083C8 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf31.hostedemail.com (Postfix) with ESMTP id 3C97A20035 for ; Fri, 1 Jul 2022 12:54:37 +0000 (UTC) Received: by mail-qv1-f54.google.com with SMTP id u7so4034825qvm.4 for ; Fri, 01 Jul 2022 05:54:37 -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=vcZ9IMTaOqkxdyfCjqfZoc5pipVgnj1uZgmjXpXjxXo=; b=MIbxf/AkrtszEsa9jwgJ+FBpjjCJTNrkkTmzCctS6xyBkwm4Q2KzOuzkbfogs1W+Y8 XDcm4XeaDC9IgPImDcHWCvrwPj9rTY7Li8xzNp4FewM129x6Pe8vo1O50vqFJ/8nQqgJ JfxtRVty/NNzUWMtkRPLAysbJSnkeNSLTEwldAe0v2+/RoDPliZzIbGo5tz+HMg/os+U 9/UdT8ZWWGq6acs0grD8wcuIIn+JPgmfSuPW9yoku90hsq43TH1kzly72U/vRpXEKfjF CN2Afq2X/CZv6lFmBDhB8XZfnuyNeRs8TCXkq1xAPDuIlldq8qZ5BIKBQP17/0G9wnUw Kxew== 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=vcZ9IMTaOqkxdyfCjqfZoc5pipVgnj1uZgmjXpXjxXo=; b=QchcIdVrh1anMibrH6PDdMhQRkdjP6fOnY+kQU+hz6DpFOOh9jbocXIerIAsgxSuOp 5riUrD3nF0taXkqxCHPkR8a92KIPrzV9mZHrNigBpwLIWAN02y0nbRrayNgwExKTkuJX 4gNMsj4wXdFEZy0MBB5qmDLzTQfPB+aadm2CwDOd8sBhShnWZezBKx5mHSwQliZUJWip ItkoTcU4Awi104JHvtZC9Y2/YPI6bHUtIz2FG48/AnOT3jt6Sl8WXp/jhfeq8A1oVLey 26nbnZ06NXxVNIwjoVf1cX2VLtUu+mIZMdSufn7lIQNsZ1T7AheZsvAmlkDhHft7xddy 7bEQ== X-Gm-Message-State: AJIora/WfrDWsaQA312SR3rdo+cOJQ8hVoJlOVgdx4SNss+vxhKmgaDZ 3BcUq72WAOz/VsMl/KsV/B8= X-Google-Smtp-Source: AGRyM1tUpJPl6Ofj1q7B41Pz9FBj1f2+HMj07APgkUwGw7tsC0f7aZQK0JOtfdaIa2epzKhH51jp4w== X-Received: by 2002:ad4:5be8:0:b0:472:91e6:a36c with SMTP id k8-20020ad45be8000000b0047291e6a36cmr14554359qvc.106.1656680076445; Fri, 01 Jul 2022 05:54:36 -0700 (PDT) Received: from localhost ([2601:4c1:c100:1230:f902:9816:653f:2f66]) by smtp.gmail.com with ESMTPSA id a20-20020a05620a16d400b0069fe1dfbeffsm17518253qkn.92.2022.07.01.05.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 05:54:36 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Andrew Morton , Andy Shevchenko , David Howells , 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 2/8] lib/bitmap: change return types to bool where appropriate Date: Fri, 1 Jul 2022 05:54:24 -0700 Message-Id: <20220701125430.2907638-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220701125430.2907638-1-yury.norov@gmail.com> References: <20220701125430.2907638-1-yury.norov@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656680077; a=rsa-sha256; cv=none; b=HiRtG22hK0vko0euQ+FR7M0hN6jij46LQODGu0vE0hqxheXZprYpEzmGEAzvWiTdI753JJ 6MYuitbBUcN7tlucsviiXeJXYGno0P2lfcALr3MBjNVQndIG6YsEgCAQtK0Hb6xdwWavM9 JVQxmcYTD+TcJZtvcC94vsScu+AbICs= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="MIbxf/Ak"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf31.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.219.54 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=1656680077; 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=vcZ9IMTaOqkxdyfCjqfZoc5pipVgnj1uZgmjXpXjxXo=; b=WZhu4S8o1q2tkXv7aomOamk+ukYy5Sb+F5UfgFEapYXfnyg2U8xaz71MYkLrAg3HxeZqAg jizrcSDpdbFr7GrYmczQZljPN1v239vJ+Fktb/a6wga0ca9sfZ2b7po8YTQ/ScY8eG5ADH Z45GgsMnhAWxmpLUqXgvfu84lkXRN3A= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3C97A20035 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="MIbxf/Ak"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf31.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-Rspam-User: X-Stat-Signature: sfmafmyp7dddu41n434s9i766d7ucc7k X-HE-Tag: 1656680077-952224 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 c91638e507f2..e1a438bdda52 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, @@ -315,7 +315,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)) @@ -341,7 +341,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;