From: Anup Patel <anup@brainfault.org> To: Yury Norov <yury.norov@gmail.com> Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>, "David Laight" <David.Laight@aculab.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Joe Perches" <joe@perches.com>, "Julia Lawall" <Julia.Lawall@inria.fr>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl>, "Nicholas Piggin" <npiggin@gmail.com>, "Nicolas Palix" <nicolas.palix@imag.fr>, "Peter Zijlstra" <peterz@infradead.org>, "Rasmus Villemoes" <linux@rasmusvillemoes.dk>, "Matti Vaittinen" <Matti.Vaittinen@fi.rohmeurope.com>, "linux-kernel@vger.kernel.org List" <linux-kernel@vger.kernel.org>, "Albert Ou" <aou@eecs.berkeley.edu>, "Atish Patra" <atishp@atishpatra.org>, "Jisheng Zhang" <jszhang@kernel.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Paul Walmsley" <paul.walmsley@sifive.com>, "Tsukasa OI" <research_trasio@irq.a4lg.com>, linux-riscv <linux-riscv@lists.infradead.org> Subject: Re: [PATCH 07/22] risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap() Date: Tue, 10 May 2022 22:01:30 +0530 [thread overview] Message-ID: <CAAhSdy0=g1pp+VgV2=1-3t_u32nX6xx=zmMuVQBd-zyFtQ983A@mail.gmail.com> (raw) In-Reply-To: <20220510154750.212913-8-yury.norov@gmail.com> On Tue, May 10, 2022 at 9:18 PM Yury Norov <yury.norov@gmail.com> wrote: > > bitmap_empty() is better than bitmap_weight() because it may return > earlier, and improves on readability. > > CC: Albert Ou <aou@eecs.berkeley.edu> > CC: Anup Patel <anup@brainfault.org> > CC: Atish Patra <atishp@atishpatra.org> > CC: Jisheng Zhang <jszhang@kernel.org> > CC: Palmer Dabbelt <palmer@dabbelt.com> > CC: Paul Walmsley <paul.walmsley@sifive.com> > CC: Tsukasa OI <research_trasio@irq.a4lg.com> > CC: linux-riscv@lists.infradead.org > CC: linux-kernel@vger.kernel.org > Signed-off-by: Yury Norov <yury.norov@gmail.com> Looks good to me. Reviewed-by: Anup Patel <anup@brainfault.org> 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 >
WARNING: multiple messages have this Message-ID (diff)
From: Anup Patel <anup@brainfault.org> To: Yury Norov <yury.norov@gmail.com> Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>, "David Laight" <David.Laight@aculab.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Joe Perches" <joe@perches.com>, "Julia Lawall" <Julia.Lawall@inria.fr>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl>, "Nicholas Piggin" <npiggin@gmail.com>, "Nicolas Palix" <nicolas.palix@imag.fr>, "Peter Zijlstra" <peterz@infradead.org>, "Rasmus Villemoes" <linux@rasmusvillemoes.dk>, "Matti Vaittinen" <Matti.Vaittinen@fi.rohmeurope.com>, "linux-kernel@vger.kernel.org List" <linux-kernel@vger.kernel.org>, "Albert Ou" <aou@eecs.berkeley.edu>, "Atish Patra" <atishp@atishpatra.org>, "Jisheng Zhang" <jszhang@kernel.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Paul Walmsley" <paul.walmsley@sifive.com>, "Tsukasa OI" <research_trasio@irq.a4lg.com>, linux-riscv <linux-riscv@lists.infradead.org> Subject: Re: [PATCH 07/22] risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap() Date: Tue, 10 May 2022 22:01:30 +0530 [thread overview] Message-ID: <CAAhSdy0=g1pp+VgV2=1-3t_u32nX6xx=zmMuVQBd-zyFtQ983A@mail.gmail.com> (raw) In-Reply-To: <20220510154750.212913-8-yury.norov@gmail.com> On Tue, May 10, 2022 at 9:18 PM Yury Norov <yury.norov@gmail.com> wrote: > > bitmap_empty() is better than bitmap_weight() because it may return > earlier, and improves on readability. > > CC: Albert Ou <aou@eecs.berkeley.edu> > CC: Anup Patel <anup@brainfault.org> > CC: Atish Patra <atishp@atishpatra.org> > CC: Jisheng Zhang <jszhang@kernel.org> > CC: Palmer Dabbelt <palmer@dabbelt.com> > CC: Paul Walmsley <paul.walmsley@sifive.com> > CC: Tsukasa OI <research_trasio@irq.a4lg.com> > CC: linux-riscv@lists.infradead.org > CC: linux-kernel@vger.kernel.org > Signed-off-by: Yury Norov <yury.norov@gmail.com> Looks good to me. Reviewed-by: Anup Patel <anup@brainfault.org> 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 > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-05-10 16:31 UTC|newest] Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 15:47 [PATCH 00/21] add coccinelle scripts for {bitmap,cpumask,nodes}_empty() Yury Norov 2022-05-10 15:47 ` [PATCH 01/22] introduce bitmap.cocci Yury Norov 2022-05-10 15:47 ` [cocci] " Yury Norov 2022-05-10 15:47 ` [PATCH 02/22] introduce cpumask.cocci Yury Norov 2022-05-10 15:47 ` [cocci] " Yury Norov 2022-05-10 15:47 ` [PATCH 03/22] introduce nodemask.cocci Yury Norov 2022-05-10 15:47 ` [cocci] " Yury Norov 2022-05-10 15:47 ` [PATCH 04/22] ice: use bitmap_empty() in ice_vf_has_no_qs_ena() Yury Norov 2022-05-10 15:47 ` [Intel-wired-lan] " Yury Norov 2022-05-10 15:47 ` [PATCH 05/22] iio: replace bitmap_weight with bitmap_weitght_{eq,le} where appropriate Yury Norov 2022-05-14 15:53 ` Jonathan Cameron 2022-05-14 16:31 ` Joe Perches 2022-05-15 16:40 ` Jonathan Cameron 2022-05-10 15:47 ` [PATCH 06/22] octeontx2: use bitmap_empty() instead of bitmap_weight() Yury Norov 2022-05-10 21:31 ` Jakub Kicinski 2022-05-10 15:47 ` [PATCH 07/22] risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap() Yury Norov 2022-05-10 15:47 ` Yury Norov 2022-05-10 16:31 ` Anup Patel [this message] 2022-05-10 16:31 ` Anup Patel 2022-05-10 15:47 ` [PATCH 08/22] bitops: introduce MANY_BITS() macro Yury Norov 2022-05-10 16:50 ` Alexei Starovoitov 2022-05-10 17:54 ` David Laight 2022-05-10 19:11 ` Yury Norov 2022-05-11 10:59 ` Rasmus Villemoes 2022-05-10 17:57 ` Max Filippov 2022-05-10 19:16 ` Yury Norov 2022-05-11 4:55 ` Max Filippov 2022-05-10 15:47 ` [PATCH 09/22] qed: replace bitmap_weight() with MANY_BITS() Yury Norov 2022-05-10 15:47 ` [PATCH 10/22] net/mlx5e: simplify mlx5e_set_fecparam() Yury Norov 2022-05-10 15:47 ` [PATCH 11/22] KVM: x86: hyper-v: replace bitmap_weight() with hweight64() Yury Norov 2022-05-16 13:08 ` Vitaly Kuznetsov 2022-05-22 14:53 ` Guenter Roeck 2022-05-22 17:39 ` Yury Norov 2022-05-10 15:47 ` [PATCH 12/22] ia64: cleanup remove_siblinginfo() Yury Norov 2022-05-10 15:47 ` Yury Norov 2022-05-10 22:33 ` Andrew Morton 2022-05-10 22:33 ` Andrew Morton 2022-05-10 15:47 ` [PATCH 13/22] x86: smp: move cpumask_weight() out of for-loop in remove_siblinginfo Yury Norov 2022-05-11 9:47 ` Thomas Gleixner 2022-05-10 15:47 ` [PATCH 14/22] x86: smp: use cpumask_weight_eq() " Yury Norov 2022-05-10 15:47 ` [PATCH 15/22] net/mlx5: use cpumask_weight_gt() in irq_pool_request_irq() Yury Norov 2022-05-10 15:47 ` [PATCH 16/22] x86/tsc: use cpumask_weight_gt() in loop_timeout() Yury Norov 2022-05-10 15:47 ` [PATCH 17/22] sched/core: fix opencoded cpumask_any_but() Yury Norov 2022-05-10 16:37 ` Peter Zijlstra 2022-05-10 17:21 ` Valentin Schneider 2022-05-10 15:47 ` [PATCH 18/22] sched/core: remove unneeded cpumask_weight() in sched_core_cpu_{starting,deactivate} Yury Norov 2022-05-10 15:47 ` [PATCH 19/22] sched/core: replace cpumask_weight() with cpumask_weight_eq() where appropriate Yury Norov 2022-05-10 15:47 ` [PATCH 20/22] sched/topology: " Yury Norov 2022-05-10 15:47 ` [PATCH 21/22] cpufreq: use cpumask_weight_gt() in policy_is_shared() Yury Norov 2022-05-11 3:16 ` Viresh Kumar 2022-05-10 15:47 ` [PATCH 22/22] clockevents: use cpumask_weight_eq() in tick_cleanup_dead_cpu() Yury Norov 2022-05-11 8:18 ` Thomas Gleixner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAAhSdy0=g1pp+VgV2=1-3t_u32nX6xx=zmMuVQBd-zyFtQ983A@mail.gmail.com' \ --to=anup@brainfault.org \ --cc=David.Laight@aculab.com \ --cc=Julia.Lawall@inria.fr \ --cc=Matti.Vaittinen@fi.rohmeurope.com \ --cc=andriy.shevchenko@linux.intel.com \ --cc=aou@eecs.berkeley.edu \ --cc=atishp@atishpatra.org \ --cc=gregkh@linuxfoundation.org \ --cc=joe@perches.com \ --cc=jszhang@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=linux@rasmusvillemoes.dk \ --cc=mirq-linux@rere.qmqm.pl \ --cc=nicolas.palix@imag.fr \ --cc=npiggin@gmail.com \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ --cc=peterz@infradead.org \ --cc=research_trasio@irq.a4lg.com \ --cc=yury.norov@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.