From patchwork Fri Jun 18 19:57:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12332773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87FC0C2B9F4 for ; Sat, 19 Jun 2021 07:44:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F9716102A for ; Sat, 19 Jun 2021 07:44:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F9716102A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43EA46EA84; Sat, 19 Jun 2021 07:44:36 +0000 (UTC) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05B606EA90; Fri, 18 Jun 2021 19:57:40 +0000 (UTC) Received: by mail-qt1-x831.google.com with SMTP id d9so8426833qtp.11; Fri, 18 Jun 2021 12:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/gSHy9XX5ac0SC74X1Qc4ytfVVZa0gXuutSCszNjEEA=; b=P3zKx9s1ebph/IX+4ttM6AepayvpE8rGn7SyAYCcjtXDqBYrYBWjeJ++n4MCreKnxF hLl6dFC7kI4ig/EveA1eamsWjPsu5M//0GU1mROdaQELL9lQ4Qq+7gpKwRWUEn6BT7Ja QNzv58Z26BLi4xcv0rZEdEhISqvsLlZL8GIho1WLINgavduXAXaf37PsHDw9Ka6kg4gc HVOdw05u/k9zaPHfop4JHuueoqquej0OLWuvmxgySSvCyWfC7DLTNzyvzdVmLh0ekPP3 CdcrMjqjv2Net5J58Dprgso4BfvZNgiN3N//jb7aTItfO6fAWupm3+THRCQ30wEkzYQp +aXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/gSHy9XX5ac0SC74X1Qc4ytfVVZa0gXuutSCszNjEEA=; b=TTCnkWY2EOYskNrSFnqboZA2JPAhYZ8xWWvTw5/wZUDwRs46ttVVrhynDIPPWIA6NP R+U8BFfBBBF4pfmYHtBERL+uUz1CM2V3s2M9B89oJ/LgObtK/+m4r8nz+ntvbzeih5GY 46+i3qDHVpJm/AW6CptEQ5aeLiO9xkSpIdIsyed5GvjKKExiVx9XbQASyUKXdbpcK52A OTe7elRT3GHIHrD+7nQHiO7AKtsDcZu/3dQdina5OH5w3F07FJO1Bm42Ijg/EYApF7s8 9mEHBoEKwbM/sSb1QatTOtpd91axUyHFe0Ht8ZL04wK8ZOKBZ8W4OWQ0uvu3LKzEa50z Kdpw== X-Gm-Message-State: AOAM533pgfwBrdlk5yikL1Z43KfnBAjsfqR82EpckEzcGDotCtrPKsGj YLPLad8jNMdRoNssZtOgjZI= X-Google-Smtp-Source: ABdhPJy0vQHcbSO0Lh+HkuZlTrl2tpjc8loroDs42HJwo2FSOVgKoongnr62EXADc6zdqh5JuTxsaw== X-Received: by 2002:ac8:6717:: with SMTP id e23mr11952711qtp.328.1624046259112; Fri, 18 Jun 2021 12:57:39 -0700 (PDT) Received: from localhost ([207.98.216.60]) by smtp.gmail.com with ESMTPSA id o13sm4604820qkg.33.2021.06.18.12.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 12:57:38 -0700 (PDT) From: Yury Norov To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Jean Delvare , Guenter Roeck , Andy Shevchenko , Rasmus Villemoes , Marc Zyngier , David Woodhouse , Andrew Morton , Wei Yang , Geert Uytterhoeven , Alexey Klimov , x86@kernel.org, linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org Subject: [PATCH 1/3] include/linux: move for_each_bit() macros from bitops.h to find.h Date: Fri, 18 Jun 2021 12:57:33 -0700 Message-Id: <20210618195735.55933-2-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210618195735.55933-1-yury.norov@gmail.com> References: <20210618195735.55933-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 19 Jun 2021 07:44:34 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yury Norov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" for_each_bit() macros depend on find_bit() machinery, and so the proper place for them is the find.h header. Signed-off-by: Yury Norov Reviewed-by: Andy Shevchenko --- include/linux/bitops.h | 34 ---------------------------------- include/linux/find.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 26bf15e6cd35..31ae1ae1a974 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -31,40 +31,6 @@ extern unsigned long __sw_hweight64(__u64 w); */ #include -#define for_each_set_bit(bit, addr, size) \ - for ((bit) = find_first_bit((addr), (size)); \ - (bit) < (size); \ - (bit) = find_next_bit((addr), (size), (bit) + 1)) - -/* same as for_each_set_bit() but use bit as value to start with */ -#define for_each_set_bit_from(bit, addr, size) \ - for ((bit) = find_next_bit((addr), (size), (bit)); \ - (bit) < (size); \ - (bit) = find_next_bit((addr), (size), (bit) + 1)) - -#define for_each_clear_bit(bit, addr, size) \ - for ((bit) = find_first_zero_bit((addr), (size)); \ - (bit) < (size); \ - (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) - -/* same as for_each_clear_bit() but use bit as value to start with */ -#define for_each_clear_bit_from(bit, addr, size) \ - for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ - (bit) < (size); \ - (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) - -/** - * for_each_set_clump8 - iterate over bitmap for each 8-bit clump with set bits - * @start: bit offset to start search and to store the current iteration offset - * @clump: location to store copy of current 8-bit clump - * @bits: bitmap address to base the search on - * @size: bitmap size in number of bits - */ -#define for_each_set_clump8(start, clump, bits, size) \ - for ((start) = find_first_clump8(&(clump), (bits), (size)); \ - (start) < (size); \ - (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8)) - static inline int get_bitmask_order(unsigned int count) { int order; diff --git a/include/linux/find.h b/include/linux/find.h index 6048f8c97418..4500e8ab93e2 100644 --- a/include/linux/find.h +++ b/include/linux/find.h @@ -279,4 +279,38 @@ unsigned long find_next_bit_le(const void *addr, unsigned #error "Please fix " #endif +#define for_each_set_bit(bit, addr, size) \ + for ((bit) = find_first_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) + +/* same as for_each_set_bit() but use bit as value to start with */ +#define for_each_set_bit_from(bit, addr, size) \ + for ((bit) = find_next_bit((addr), (size), (bit)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) + +#define for_each_clear_bit(bit, addr, size) \ + for ((bit) = find_first_zero_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) + +/* same as for_each_clear_bit() but use bit as value to start with */ +#define for_each_clear_bit_from(bit, addr, size) \ + for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ + (bit) < (size); \ + (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) + +/** + * for_each_set_clump8 - iterate over bitmap for each 8-bit clump with set bits + * @start: bit offset to start search and to store the current iteration offset + * @clump: location to store copy of current 8-bit clump + * @bits: bitmap address to base the search on + * @size: bitmap size in number of bits + */ +#define for_each_set_clump8(start, clump, bits, size) \ + for ((start) = find_first_clump8(&(clump), (bits), (size)); \ + (start) < (size); \ + (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8)) + #endif /*__LINUX_FIND_H_ */