[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231203193307.542794-5-yury.norov@gmail.com>
Date: Sun, 3 Dec 2023 11:32:38 -0800
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Yury Norov <yury.norov@...il.com>, linux-mips@...r.kernel.org
Cc: Jan Kara <jack@...e.cz>,
Mirsad Todorovac <mirsad.todorovac@....unizg.hr>,
Matthew Wilcox <willy@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Maxim Kuvyrkov <maxim.kuvyrkov@...aro.org>,
Alexey Klimov <klimov.linux@...il.com>,
Bart Van Assche <bvanassche@....org>,
Sergey Shtylyov <s.shtylyov@....ru>
Subject: [PATCH v2 06/35] mips: sgi-ip30: rework heart_alloc_int()
heart_alloc_int() opencodes find_and_set_bit(). Switch it to using the
dedicated function, and make an nice one-liner.
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
arch/mips/sgi-ip30/ip30-irq.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
index 423c32cb66ed..3c4d4e947817 100644
--- a/arch/mips/sgi-ip30/ip30-irq.c
+++ b/arch/mips/sgi-ip30/ip30-irq.c
@@ -28,17 +28,9 @@ static DEFINE_PER_CPU(unsigned long, irq_enable_mask);
static inline int heart_alloc_int(void)
{
- int bit;
+ int bit = find_and_set_bit(heart_irq_map, HEART_NUM_IRQS);
-again:
- bit = find_first_zero_bit(heart_irq_map, HEART_NUM_IRQS);
- if (bit >= HEART_NUM_IRQS)
- return -ENOSPC;
-
- if (test_and_set_bit(bit, heart_irq_map))
- goto again;
-
- return bit;
+ return bit < HEART_NUM_IRQS ? bit : -ENOSPC;
}
static void ip30_error_irq(struct irq_desc *desc)
--
2.40.1
Powered by blists - more mailing lists