diff options
| author | Yury Norov <ynorov@nvidia.com> | 2026-03-23 12:17:12 -0400 |
|---|---|---|
| committer | Yury Norov <ynorov@nvidia.com> | 2026-03-23 13:33:51 -0400 |
| commit | be56db15fcce8bb8bd85f236382276d52ce73d08 (patch) | |
| tree | 88d0d51b496d8d0aa39364ce39080f68129f7d4f /arch | |
| parent | 4e64c91b813f666dffc3962a815a8a50b7d6f468 (diff) | |
lib: count_zeros: unify count_{leading,trailing}_zeros()
The 'leading' helper returns BITS_PER_LONG if x == 0, while 'trailing'
one returns COUNT_TRAILING_ZEROS_0, which turns to be -1.
None of the current users explicitly check the returned value for
COUNT_TRAILING_ZEROS_0, except the loongarch, which tests implicitly
for the '>= 0'.
So, align count_trailing_zeros() with the count_leading_zeros(), and
simplify the loongarch handling.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/loongarch/kvm/intc/eiointc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c index d2acb4d09e73..3b5268116727 100644 --- a/arch/loongarch/kvm/intc/eiointc.c +++ b/arch/loongarch/kvm/intc/eiointc.c @@ -16,7 +16,7 @@ static void eiointc_set_sw_coreisr(struct loongarch_eiointc *s) ipnum = (s->ipmap >> (irq / 32 * 8)) & 0xff; if (!(s->status & BIT(EIOINTC_ENABLE_INT_ENCODE))) { ipnum = count_trailing_zeros(ipnum); - ipnum = (ipnum >= 0 && ipnum < 4) ? ipnum : 0; + ipnum = ipnum < 4 ? ipnum : 0; } cpuid = ((u8 *)s->coremap)[irq]; @@ -41,7 +41,7 @@ static void eiointc_update_irq(struct loongarch_eiointc *s, int irq, int level) ipnum = (s->ipmap >> (irq / 32 * 8)) & 0xff; if (!(s->status & BIT(EIOINTC_ENABLE_INT_ENCODE))) { ipnum = count_trailing_zeros(ipnum); - ipnum = (ipnum >= 0 && ipnum < 4) ? ipnum : 0; + ipnum = ipnum < 4 ? ipnum : 0; } cpu = s->sw_coremap[irq]; |
