From mboxrd@z Thu Jan 1 00:00:00 1970 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 C8DF8CCA480 for ; Fri, 1 Jul 2022 12:54:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B6786B007E; Fri, 1 Jul 2022 08:54:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 367466B0080; Fri, 1 Jul 2022 08:54:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F8FB6B0081; Fri, 1 Jul 2022 08:54:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F168D6B007E for ; Fri, 1 Jul 2022 08:54:40 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B0A30215E5 for ; Fri, 1 Jul 2022 12:54:40 +0000 (UTC) X-FDA: 79638525120.20.D460031 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf28.hostedemail.com (Postfix) with ESMTP id 3163BC0035 for ; Fri, 1 Jul 2022 12:54:39 +0000 (UTC) Received: by mail-qk1-f172.google.com with SMTP id k20so1752356qkj.1 for ; Fri, 01 Jul 2022 05:54:39 -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=dALoUA4TxajQrqRALn6VbZI9jeqizcyFDqXo6cANVYg=; b=fLsxEHYqlZGYXvAnn65jdSw7P2u6uw3w6pwoF8d4eIU+BYP/+k+0yfKYWdeL9ocAVK T42XW4e174CunC/AhJUMA0kZMfvpVuU2qFbWFpGT8siUOx4oyaxTCefTmHXmCAq8wUUS nqZhALiNdWIX6AXvXrhkr1PDcQ6RS6rRmX9GKtVp5GNBJCPRoeYwbhqtl1IxhCsCb7FW 0Ohn/XpktZ0TaKIdsYX38JyoIuM5ibGA8267lVtHDhHZc+yN7cWyfZK2D2+PW0CkL+NW W9tyGeaPtGBs9doohBhPzmjFE/rjLvqftcA9dnlDovwVXSMOEmPt0ghXus+nW+tjpcl8 JCGQ== 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=dALoUA4TxajQrqRALn6VbZI9jeqizcyFDqXo6cANVYg=; b=nvj9aMDZ9R395HquF0t8HWMPV4EJKj3gGqJsVT9e0YxmBYM183cnCi6mCkvNcePk8M LxD9BgB+1ZFt+LrxO6E9g+cw0oQMdreaBAPTQmQgHXC7CI/G3HZ7tG7FkRmJm33xbWFN qErtJKVX+HUn/oi2yB9cnnIjAJB1+PDY/E40HcYAC2iNO/QHlk34YoYvJgQfqjAD29h2 MbULfT0Z07OHRxXwQTwwYvbQ+RiEHE2jHDEyT7yCM7qlL5D7bcN4y37hy/20DlkV+XOV ITDZyoq3PyMCNHtShfjkuTqfa79joNEhTXnGxN8D56NveLYcj1Sx4L5mhPJy1J/WTAgw uqgw== X-Gm-Message-State: AJIora8XgEOmOsO3GDvcDyB4lhuPAg0LGIl323+1cweNO6yjJ0i4uIEx t6ODMX3uh4WVMcN12hJogSA= X-Google-Smtp-Source: AGRyM1umJBMsQT8dcVWHPG2fYnWNUoEty93L5a2a9n7i9NhpB8s8LMJLTYWhNi8UYMZ7/bD5TFG5vg== X-Received: by 2002:a05:620a:1e3:b0:6af:504d:c1f2 with SMTP id x3-20020a05620a01e300b006af504dc1f2mr10470131qkn.34.1656680079339; Fri, 01 Jul 2022 05:54:39 -0700 (PDT) Received: from localhost ([2601:4c1:c100:1230:f902:9816:653f:2f66]) by smtp.gmail.com with ESMTPSA id he18-20020a05622a601200b00317c38c8606sm8999322qtb.20.2022.07.01.05.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 05:54:39 -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 5/8] lib/cpumask: change return types to unsigned where appropriate Date: Fri, 1 Jul 2022 05:54:27 -0700 Message-Id: <20220701125430.2907638-6-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 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656680080; 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=dALoUA4TxajQrqRALn6VbZI9jeqizcyFDqXo6cANVYg=; b=mgbykQFG3h8J0sg8o2WtIXVOomz6TvLLVEGdU+78z/7nX73p0cB0PzgvBkDFgL30Ob+xsW sLVQdrCYZhL+Q39ye1oQy7jKn/RrcBSeNwxLBX5menAsX7xn5oe7dwwpHSuV2z3Ne/NMWP g13OpbdM9RyzI8PZ9n5/OWnOVR6Y7K8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656680080; a=rsa-sha256; cv=none; b=VM7pFWst+bcQmhUqRA1nX+/keWRuH0XboACLBi6aS58kFxv+Y4yzXtsxG67j9zyiXm4IH5 z3hoFMFCefmyR5nnUyjXa4NsARGjB2tg1pUs6LC3BFJp/tsVQNGAoes6tpFeLxv+bI5KqA /qp3G9WZxa8Ai+qXtVZapNEVMoeOfjs= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fLsxEHYq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-Stat-Signature: syux7drmhzwxb3xjxbe8me5stwcyfekw X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fLsxEHYq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3163BC0035 X-HE-Tag: 1656680079-826675 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: Switch return types to unsigned int where return values cannot be negative. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 14 +++++++------- lib/cpumask.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index b54e27d9da6b..760022bcb925 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -176,12 +176,12 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node) return 0; } -static inline int cpumask_any_and_distribute(const struct cpumask *src1p, +static inline unsigned int cpumask_any_and_distribute(const struct cpumask *src1p, const struct cpumask *src2p) { return cpumask_first_and(src1p, src2p); } -static inline int cpumask_any_distribute(const struct cpumask *srcp) +static inline unsigned int cpumask_any_distribute(const struct cpumask *srcp) { return cpumask_first(srcp); } @@ -258,12 +258,12 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) return find_next_zero_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1); } -int __pure cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); -int __pure cpumask_any_but(const struct cpumask *mask, unsigned int cpu); +unsigned int __pure cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); +unsigned int __pure cpumask_any_but(const struct cpumask *mask, unsigned int cpu); unsigned int cpumask_local_spread(unsigned int i, int node); -int cpumask_any_and_distribute(const struct cpumask *src1p, +unsigned int cpumask_any_and_distribute(const struct cpumask *src1p, const struct cpumask *src2p); -int cpumask_any_distribute(const struct cpumask *srcp); +unsigned int cpumask_any_distribute(const struct cpumask *srcp); /** * for_each_cpu - iterate over every cpu in a mask @@ -289,7 +289,7 @@ int cpumask_any_distribute(const struct cpumask *srcp); (cpu) = cpumask_next_zero((cpu), (mask)), \ (cpu) < nr_cpu_ids;) -extern int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap); +unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap); /** * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location diff --git a/lib/cpumask.c b/lib/cpumask.c index a971a82d2f43..da68f6bbde44 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -31,7 +31,7 @@ EXPORT_SYMBOL(cpumask_next); * * Returns >= nr_cpu_ids if no further cpus set in both. */ -int cpumask_next_and(int n, const struct cpumask *src1p, +unsigned int cpumask_next_and(int n, const struct cpumask *src1p, const struct cpumask *src2p) { /* -1 is a legal arg here. */ @@ -50,7 +50,7 @@ EXPORT_SYMBOL(cpumask_next_and); * Often used to find any cpu but smp_processor_id() in a mask. * Returns >= nr_cpu_ids if no cpus set. */ -int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) +unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) { unsigned int i; @@ -74,9 +74,9 @@ EXPORT_SYMBOL(cpumask_any_but); * Note: the @wrap argument is required for the start condition when * we cannot assume @start is set in @mask. */ -int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap) +unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap) { - int next; + unsigned int next; again: next = cpumask_next(n, mask); @@ -205,7 +205,7 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask) */ unsigned int cpumask_local_spread(unsigned int i, int node) { - int cpu; + unsigned int cpu; /* Wrap: we always want a cpu. */ i %= num_online_cpus(); @@ -243,10 +243,10 @@ static DEFINE_PER_CPU(int, distribute_cpu_mask_prev); * * Returns >= nr_cpu_ids if the intersection is empty. */ -int cpumask_any_and_distribute(const struct cpumask *src1p, +unsigned int cpumask_any_and_distribute(const struct cpumask *src1p, const struct cpumask *src2p) { - int next, prev; + unsigned int next, prev; /* NOTE: our first selection will skip 0. */ prev = __this_cpu_read(distribute_cpu_mask_prev); @@ -262,9 +262,9 @@ int cpumask_any_and_distribute(const struct cpumask *src1p, } EXPORT_SYMBOL(cpumask_any_and_distribute); -int cpumask_any_distribute(const struct cpumask *srcp) +unsigned int cpumask_any_distribute(const struct cpumask *srcp) { - int next, prev; + unsigned int next, prev; /* NOTE: our first selection will skip 0. */ prev = __this_cpu_read(distribute_cpu_mask_prev); -- 2.34.1