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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 949F1C2B9F4 for ; Sat, 19 Jun 2021 10:50:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64D386113E for ; Sat, 19 Jun 2021 10:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbhFSKwU (ORCPT ); Sat, 19 Jun 2021 06:52:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:53248 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbhFSKwT (ORCPT ); Sat, 19 Jun 2021 06:52:19 -0400 IronPort-SDR: 4vrjSwFiE45UJoS+V324bGl1jppXjSuTjyWVIFSZGHhxvXWPv7X+xJXpjb2/5IozMmEtnRCoe9 hTQu092OUAig== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="206612084" X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="206612084" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:50:07 -0700 IronPort-SDR: o8DFUIQ+V+2TuG58ZEr4r3C8CkDGqWu2uw95vEN7oxLjJ8oaxloSWHsXFVzcWwtJJIbqrt7cig dDphpiQ2jjXw== X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="622629219" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:50:02 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1luYY2-003nwB-1Z; Sat, 19 Jun 2021 13:49:58 +0300 Date: Sat, 19 Jun 2021 13:49:58 +0300 From: Andy Shevchenko To: Yury Norov Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Jean Delvare , Guenter Roeck , 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: Re: [PATCH 3/3] Replace for_each_*_bit_from() with for_each_*_bit() where appropriate Message-ID: References: <20210618195735.55933-1-yury.norov@gmail.com> <20210618195735.55933-4-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618195735.55933-4-yury.norov@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Fri, Jun 18, 2021 at 12:57:35PM -0700, Yury Norov wrote: > A couple of kernel functions call for_each_*_bit_from() with start > bit equal to 0. Replace them with for_each_*_bit(). > > No functional changes, but might improve on readability. ... > --- a/drivers/hwmon/ltc2992.c > +++ b/drivers/hwmon/ltc2992.c > @@ -248,8 +248,7 @@ static int ltc2992_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask > > gpio_status = reg; > > - gpio_nr = 0; > - for_each_set_bit_from(gpio_nr, mask, LTC2992_GPIO_NR) { > + for_each_set_bit(gpio_nr, mask, LTC2992_GPIO_NR) { > if (test_bit(LTC2992_GPIO_BIT(gpio_nr), &gpio_status)) > set_bit(gpio_nr, bits); > } I would replace the entire loop by bitmap_replace() call. Something like bitmap_replace(bits, bits, &gpio_status, mask, LTC2992_GPIO_NR); (Good to split sometimes :-) -- With Best Regards, Andy Shevchenko 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 1FEE3C48BE5 for ; Sat, 19 Jun 2021 10:50:11 +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 D02F76113E for ; Sat, 19 Jun 2021 10:50:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D02F76113E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.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 48DF06EAC3; Sat, 19 Jun 2021 10:50:10 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACF786EABE; Sat, 19 Jun 2021 10:50:08 +0000 (UTC) IronPort-SDR: YaS+D4BoOYzqlPZ+j3HQwvGOHiXB/sGu4CryzsiK0AHI0kQvmLZO323vEz+Hy4s8rXgf3zi5fB MCJ4t63IySQQ== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="292293348" X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="292293348" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:50:08 -0700 IronPort-SDR: o8DFUIQ+V+2TuG58ZEr4r3C8CkDGqWu2uw95vEN7oxLjJ8oaxloSWHsXFVzcWwtJJIbqrt7cig dDphpiQ2jjXw== X-IronPort-AV: E=Sophos;i="5.83,285,1616482800"; d="scan'208";a="622629219" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2021 03:50:02 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1luYY2-003nwB-1Z; Sat, 19 Jun 2021 13:49:58 +0300 Date: Sat, 19 Jun 2021 13:49:58 +0300 From: Andy Shevchenko To: Yury Norov Subject: Re: [PATCH 3/3] Replace for_each_*_bit_from() with for_each_*_bit() where appropriate Message-ID: References: <20210618195735.55933-1-yury.norov@gmail.com> <20210618195735.55933-4-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618195735.55933-4-yury.norov@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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: Wei Yang , Geert Uytterhoeven , David Airlie , Rasmus Villemoes , dri-devel@lists.freedesktop.org, "H. Peter Anvin" , Marc Zyngier , x86@kernel.org, Ingo Molnar , Russell King , Guenter Roeck , Jean Delvare , Alexey Klimov , etnaviv@lists.freedesktop.org, Borislav Petkov , Thomas Gleixner , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , David Woodhouse Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Jun 18, 2021 at 12:57:35PM -0700, Yury Norov wrote: > A couple of kernel functions call for_each_*_bit_from() with start > bit equal to 0. Replace them with for_each_*_bit(). > > No functional changes, but might improve on readability. ... > --- a/drivers/hwmon/ltc2992.c > +++ b/drivers/hwmon/ltc2992.c > @@ -248,8 +248,7 @@ static int ltc2992_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask > > gpio_status = reg; > > - gpio_nr = 0; > - for_each_set_bit_from(gpio_nr, mask, LTC2992_GPIO_NR) { > + for_each_set_bit(gpio_nr, mask, LTC2992_GPIO_NR) { > if (test_bit(LTC2992_GPIO_BIT(gpio_nr), &gpio_status)) > set_bit(gpio_nr, bits); > } I would replace the entire loop by bitmap_replace() call. Something like bitmap_replace(bits, bits, &gpio_status, mask, LTC2992_GPIO_NR); (Good to split sometimes :-) -- With Best Regards, Andy Shevchenko