[PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE1684d LANDED

Landed in mainline as 2fe4ca6ad7f6 on 2021-12-20.

2 messages, 2 authors, 2021-12-26 · open the first message on its own page

[PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable

From: Christophe JAILLET <hidden>
Date: 2021-12-17 21:54:21

'mpic->protected' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.

Signed-off-by: Christophe JAILLET <redacted>
---
 arch/powerpc/sysdev/mpic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 995fb2ada507..626ba4a9f64f 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1323,8 +1323,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 	psrc = of_get_property(mpic->node, "protected-sources", &psize);
 	if (psrc) {
 		/* Allocate a bitmap with one bit per interrupt */
-		unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
-		mpic->protected = kcalloc(mapsize, sizeof(long), GFP_KERNEL);
+		mpic->protected = bitmap_zalloc(intvec_top + 1, GFP_KERNEL);
 		BUG_ON(mpic->protected == NULL);
 		for (i = 0; i < psize/sizeof(u32); i++) {
 			if (psrc[i] > intvec_top)
-- 
2.30.2

Re: [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable

From: Michael Ellerman <hidden>
Date: 2021-12-26 21:54:03

On Fri, 17 Dec 2021 22:54:12 +0100, Christophe JAILLET wrote:
'mpic->protected' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.
Applied to powerpc/next.

[1/1] powerpc/mpic: Use bitmap_zalloc() when applicable
      https://git.kernel.org/powerpc/c/2fe4ca6ad7f6a0b98f97c498320051e5066e4b95

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help