* [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
@ 2021-12-17 21:37 Christophe JAILLET
2021-12-17 21:50 ` Christophe JAILLET
0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:37 UTC (permalink / raw)
To: vneethv, oberpar, hca, gor, borntraeger, agordeev
Cc: linux-s390, linux-kernel, kernel-janitors, Christophe JAILLET
'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 <christophe.jaillet@wanadoo.fr>
---
drivers/s390/cio/idset.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
index 45f9c0736be4..7e5550230c0f 100644
--- a/drivers/s390/cio/idset.c
+++ b/drivers/s390/cio/idset.c
@@ -25,11 +25,10 @@ static struct idset *idset_new(int num_ssid, int num_id)
{
struct idset *set;
- set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
+ set = vzalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
if (set) {
set->num_ssid = num_ssid;
set->num_id = num_id;
- memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
}
return set;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
2021-12-17 21:37 [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable Christophe JAILLET
@ 2021-12-17 21:50 ` Christophe JAILLET
0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:50 UTC (permalink / raw)
To: vneethv, oberpar, hca, gor, borntraeger, agordeev
Cc: linux-s390, linux-kernel, kernel-janitors
Le 17/12/2021 à 22:37, Christophe JAILLET a écrit :
> '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 <christophe.jaillet@wanadoo.fr>
> ---
> drivers/s390/cio/idset.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
> index 45f9c0736be4..7e5550230c0f 100644
> --- a/drivers/s390/cio/idset.c
> +++ b/drivers/s390/cio/idset.c
> @@ -25,11 +25,10 @@ static struct idset *idset_new(int num_ssid, int num_id)
> {
> struct idset *set;
>
> - set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
> + set = vzalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
> if (set) {
> set->num_ssid = num_ssid;
> set->num_id = num_id;
> - memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
> }
> return set;
> }
>
NACK,
my git GUI played me some tricks.
Wrong patch attached :(
CJ
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
2021-12-17 21:54 ` Christophe JAILLET
@ 2021-12-26 21:52 ` Michael Ellerman
-1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2021-12-26 21:52 UTC (permalink / raw)
To: mpe, maz, benh, Christophe JAILLET, paulus
Cc: linux-kernel, kernel-janitors, linuxppc-dev
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
@ 2021-12-26 21:52 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2021-12-26 21:52 UTC (permalink / raw)
To: mpe, maz, benh, Christophe JAILLET, paulus
Cc: linuxppc-dev, kernel-janitors, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
@ 2021-12-17 21:54 ` Christophe JAILLET
0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:54 UTC (permalink / raw)
To: mpe, benh, paulus, maz
Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET
'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 <christophe.jaillet@wanadoo.fr>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable
@ 2021-12-17 21:54 ` Christophe JAILLET
0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:54 UTC (permalink / raw)
To: mpe, benh, paulus, maz
Cc: kernel-janitors, Christophe JAILLET, linuxppc-dev, linux-kernel
'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 <christophe.jaillet@wanadoo.fr>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-26 21:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 21:37 [PATCH] powerpc/mpic: Use bitmap_zalloc() when applicable Christophe JAILLET
2021-12-17 21:50 ` Christophe JAILLET
2021-12-17 21:54 Christophe JAILLET
2021-12-17 21:54 ` Christophe JAILLET
2021-12-26 21:52 ` Michael Ellerman
2021-12-26 21:52 ` Michael Ellerman
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.