Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6255243iob; Tue, 10 May 2022 14:06:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOLod3vn/4MuNnRtTxulZhPaV2CiUnXyJVUreD0guI5PUokYjkFhYDKBBYmCAK6I++8Wqx X-Received: by 2002:a17:907:6d94:b0:6f4:531d:742 with SMTP id sb20-20020a1709076d9400b006f4531d0742mr21373797ejc.202.1652216775842; Tue, 10 May 2022 14:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652216775; cv=none; d=google.com; s=arc-20160816; b=VNRi2k35XpEomAHXWDTMLvRrN5eeGamxygwYw8USCZtlwOB01oEbn6qt4lTqAEMaiQ cujefEzRXZrob+v2KVGY2w9mKP0OgpfH4auk9Lw7iWPc+7ceh23CT9dZXT0VS6kuLjrr ocuEYq/UzGjkgpzq6wnbO1KII+pXNN5FccFvOnBHsT5c3YJw+o+xbrbLqgGJd/h3plwg W3vwvyi7mlnWhaFgtk/z6g+at3wNgKO9JWCmYOuXyK0E/bXMuQvFsctT2+KOgj2Ym8TD AhRBZL/kAG9cv+pRkn0oGRJvA0MGxtjTfv4RXbLSyidWonY1+skpPMZO+aFQYzg6xTMH eAKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mWGzBUsWBBDH/P677svrWdBEwqX8mcCwwVWbeqZWyLM=; b=BLykPYQ/wj/vsjfUyNsBCnoS3bmNGcxx1ZlCfW7G2ZeHBb27ZeVtGhqchWMKJRlYXP RQOsv3ML1HL+us3juAmlVSQtGMa3VCK4L2h0Ei7lWkg+JMZNGSJDEcAtFnwLyNOcdpbM r51BRJO0Cm1xSwcY0r8c/yb7cI9fohh/tLUZ2iRTxtTvbEimMwwaC4+pV2WZzzXomQ61 2jham8StlhSY/91D6wIG/S8zsXSAguHJeoSlyxUY8I5WBZjEljy6T98ru447T0HUtoot h4DWCGMynyeRW80g1bRRwSmfMUXhkLpoJUMdrneZP3dAWpah2IDVBFVOOYG9aKlz7vMM ZwTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=mp+dUgzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402441200b00425f304e98fsi246789eda.495.2022.05.10.14.05.50; Tue, 10 May 2022 14:06:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=mp+dUgzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347432AbiEJQfp (ORCPT + 99 others); Tue, 10 May 2022 12:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347410AbiEJQfm (ORCPT ); Tue, 10 May 2022 12:35:42 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C144D61A for ; Tue, 10 May 2022 09:31:44 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id n126-20020a1c2784000000b0038e8af3e788so1780267wmn.1 for ; Tue, 10 May 2022 09:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mWGzBUsWBBDH/P677svrWdBEwqX8mcCwwVWbeqZWyLM=; b=mp+dUgzLD4/aCLY9HUnigMrWJJnPCtVY67VICGXnZi/Ibm1aI1RupWH/WFm4Lg3DJc RHYE3K/zWkzGzTb8icJxuI3AmVLYGdHmc2Tsz01br4rDumBHHB7NU4wwJJeuCTjpGBRn Nc9cKW2K1z+tZC/9zPq2EZMm1DmD0HqLGz/K4PM5Wuc0iP5RlnzGg/KtjsBo92nP3Mbk YTlR52T2RPBol7QG5IrBEmxdc2rk8APC9ILl8VPnqJRu+johonHlBafRa5R8NTv7bkDx Ev98I0OgfHTQ4J2Sl3E4B+P6BwRATwJhRcHISuWvL9xe2LloKFDByHLMbA9IloQNDRRp TM0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mWGzBUsWBBDH/P677svrWdBEwqX8mcCwwVWbeqZWyLM=; b=bFxi85mQc/EAyiXtmK2viPNZ3fizma/6pfM2i/cm31rMRbdLO+eWeitKVzlUKhH0r8 TY0YuyZqtxmQ0MPmM8pNf6cjEyMqYU2dIrzNP7zmc9lUeHHQ961LHm+3pUnP0RHCs77a T+gqj3HiWJPpt/elYjPOWgfeVlwl3SjZKDl65lS9/BmySSJR2Yc2ftsrvhnxVk8ghoLK AzVDr8tG4TfZFFSsQc5vzaUVLheuBhWVHorxlqYWvY9J5e1Cxq5gLUxWWaQgcGS61FdI 2HV66JVPKwd7b+u4FbHTyus9GpSilm/jBxGfTna4xgvkEo2dr4/OxJfWBWH3pds3Pq83 I/7g== X-Gm-Message-State: AOAM530cfQg/HNN7BweFTDKFP8JOzzA35uyFMEYo1lR1TR1u0ieBDokN 0ilL+Aiq+Fz36ZVPe/a1s2QV9YFD5GW+CFHMMuckAA== X-Received: by 2002:a05:600c:1d08:b0:394:54ee:c994 with SMTP id l8-20020a05600c1d0800b0039454eec994mr782732wms.137.1652200302633; Tue, 10 May 2022 09:31:42 -0700 (PDT) MIME-Version: 1.0 References: <20220510154750.212913-1-yury.norov@gmail.com> <20220510154750.212913-8-yury.norov@gmail.com> In-Reply-To: <20220510154750.212913-8-yury.norov@gmail.com> From: Anup Patel Date: Tue, 10 May 2022 22:01:30 +0530 Message-ID: Subject: Re: [PATCH 07/22] risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap() To: Yury Norov Cc: Andy Shevchenko , David Laight , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Rasmus Villemoes , Matti Vaittinen , "linux-kernel@vger.kernel.org List" , Albert Ou , Atish Patra , Jisheng Zhang , Palmer Dabbelt , Paul Walmsley , Tsukasa OI , linux-riscv Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2022 at 9:18 PM Yury Norov wrote: > > bitmap_empty() is better than bitmap_weight() because it may return > earlier, and improves on readability. > > CC: Albert Ou > CC: Anup Patel > CC: Atish Patra > CC: Jisheng Zhang > CC: Palmer Dabbelt > CC: Paul Walmsley > CC: Tsukasa OI > CC: linux-riscv@lists.infradead.org > CC: linux-kernel@vger.kernel.org > Signed-off-by: Yury Norov Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > arch/riscv/kernel/cpufeature.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 1b2d42d7f589..f0298d756f66 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -206,11 +206,10 @@ void __init riscv_fill_hwcap(void) > else > elf_hwcap = this_hwcap; > > - if (bitmap_weight(riscv_isa, RISCV_ISA_EXT_MAX)) > - bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX); > - else > + if (bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX)) > bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX); > - > + else > + bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX); > } > > /* We don't support systems with F but without D, so mask those out > -- > 2.32.0 >