[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231203193307.542794-6-yury.norov@gmail.com>
Date: Sun, 3 Dec 2023 11:32:39 -0800
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Rob Herring <robh@...nel.org>, Sam Ravnborg <sam@...nborg.org>,
Yury Norov <yury.norov@...il.com>, sparclinux@...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 07/35] sparc: fix opencoded find_and_set_bit() in alloc_msi()
alloc_msi() opencodes find_and_clear_bit(). Switch it to using the
dedicated function, and make an nice one-liner.
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
arch/sparc/kernel/pci_msi.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index fc7402948b7b..91105c788d1d 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -96,14 +96,9 @@ static u32 pick_msiq(struct pci_pbm_info *pbm)
static int alloc_msi(struct pci_pbm_info *pbm)
{
- int i;
-
- for (i = 0; i < pbm->msi_num; i++) {
- if (!test_and_set_bit(i, pbm->msi_bitmap))
- return i + pbm->msi_first;
- }
+ int i = find_and_set_bit(pbm->msi_bitmap, pbm->msi_num);
- return -ENOENT;
+ return i < pbm->msi_num ? i + pbm->msi_first : -ENOENT;
}
static void free_msi(struct pci_pbm_info *pbm, int msi_num)
--
2.40.1
Powered by blists - more mailing lists