linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable
@ 2021-09-26 12:36 Christophe JAILLET
  2021-09-27 13:38 ` Nishanth Menon
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2021-09-26 12:36 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, kernel-janitors, Christophe JAILLET

'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify
code and improve the semantic of the code.

While at it, remove a redundant 'bitmap_zero()' call.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/firmware/ti_sci.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 235c7e7869aa..a33eb884102f 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3352,13 +3352,11 @@ static int ti_sci_probe(struct platform_device *pdev)
 	if (!minfo->xfer_block)
 		return -ENOMEM;
 
-	minfo->xfer_alloc_table = devm_kcalloc(dev,
-					       BITS_TO_LONGS(desc->max_msgs),
-					       sizeof(unsigned long),
-					       GFP_KERNEL);
+	minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
+						     desc->max_msgs,
+						     GFP_KERNEL);
 	if (!minfo->xfer_alloc_table)
 		return -ENOMEM;
-	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
 
 	/* Pre-initialize the buffer pointer to pre-allocated buffers */
 	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable
  2021-09-26 12:36 [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable Christophe JAILLET
@ 2021-09-27 13:38 ` Nishanth Menon
  2022-10-31 20:40   ` Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Nishanth Menon @ 2021-09-27 13:38 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kristo, ssantosh, linux-arm-kernel, linux-kernel, kernel-janitors

On 14:36-20210926, Christophe JAILLET wrote:
> 'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify
> code and improve the semantic of the code.
> 
> While at it, remove a redundant 'bitmap_zero()' call.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/firmware/ti_sci.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 235c7e7869aa..a33eb884102f 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -3352,13 +3352,11 @@ static int ti_sci_probe(struct platform_device *pdev)
>  	if (!minfo->xfer_block)
>  		return -ENOMEM;
>  
> -	minfo->xfer_alloc_table = devm_kcalloc(dev,
> -					       BITS_TO_LONGS(desc->max_msgs),
> -					       sizeof(unsigned long),
> -					       GFP_KERNEL);
> +	minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
> +						     desc->max_msgs,
> +						     GFP_KERNEL);
>  	if (!minfo->xfer_alloc_table)
>  		return -ENOMEM;
> -	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
>  
>  	/* Pre-initialize the buffer pointer to pre-allocated buffers */
>  	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
> -- 
> 2.30.2
> 

Reviewed-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable
  2021-09-27 13:38 ` Nishanth Menon
@ 2022-10-31 20:40   ` Christophe JAILLET
  2022-11-03  5:04     ` Nishanth Menon
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2022-10-31 20:40 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: kristo, ssantosh, linux-arm-kernel, linux-kernel, kernel-janitors

Le 27/09/2021 à 15:38, Nishanth Menon a écrit :
> On 14:36-20210926, Christophe JAILLET wrote:
>> 'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify
>> code and improve the semantic of the code.
>>
>> While at it, remove a redundant 'bitmap_zero()' call.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/firmware/ti_sci.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
>> index 235c7e7869aa..a33eb884102f 100644
>> --- a/drivers/firmware/ti_sci.c
>> +++ b/drivers/firmware/ti_sci.c
>> @@ -3352,13 +3352,11 @@ static int ti_sci_probe(struct platform_device *pdev)
>>   	if (!minfo->xfer_block)
>>   		return -ENOMEM;
>>   
>> -	minfo->xfer_alloc_table = devm_kcalloc(dev,
>> -					       BITS_TO_LONGS(desc->max_msgs),
>> -					       sizeof(unsigned long),
>> -					       GFP_KERNEL);
>> +	minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
>> +						     desc->max_msgs,
>> +						     GFP_KERNEL);
>>   	if (!minfo->xfer_alloc_table)
>>   		return -ENOMEM;
>> -	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
>>   
>>   	/* Pre-initialize the buffer pointer to pre-allocated buffers */
>>   	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
>> -- 
>> 2.30.2
>>
> 
> Reviewed-by: Nishanth Menon <nm@ti.com>
> 

Hi,

another similar patch has been merged against 
'drivers/firmware/ti_sci.c' just a few days ago, so this one could also 
be applied.

Let me know if I need to rebase and/or resend it.

CJ

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable
  2022-10-31 20:40   ` Christophe JAILLET
@ 2022-11-03  5:04     ` Nishanth Menon
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2022-11-03  5:04 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kristo, ssantosh, linux-arm-kernel, linux-kernel, kernel-janitors

On 21:40-20221031, Christophe JAILLET wrote:
> Le 27/09/2021 à 15:38, Nishanth Menon a écrit :
> > On 14:36-20210926, Christophe JAILLET wrote:
> > > 'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify
> > > code and improve the semantic of the code.
> > > 
> > > While at it, remove a redundant 'bitmap_zero()' call.
> > > 
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > > ---
> > >   drivers/firmware/ti_sci.c | 8 +++-----
> > >   1 file changed, 3 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> > > index 235c7e7869aa..a33eb884102f 100644
> > > --- a/drivers/firmware/ti_sci.c
> > > +++ b/drivers/firmware/ti_sci.c
> > > @@ -3352,13 +3352,11 @@ static int ti_sci_probe(struct platform_device *pdev)
> > >   	if (!minfo->xfer_block)
> > >   		return -ENOMEM;
> > > -	minfo->xfer_alloc_table = devm_kcalloc(dev,
> > > -					       BITS_TO_LONGS(desc->max_msgs),
> > > -					       sizeof(unsigned long),
> > > -					       GFP_KERNEL);
> > > +	minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
> > > +						     desc->max_msgs,
> > > +						     GFP_KERNEL);
> > >   	if (!minfo->xfer_alloc_table)
> > >   		return -ENOMEM;
> > > -	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
> > >   	/* Pre-initialize the buffer pointer to pre-allocated buffers */
> > >   	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
> > > -- 
> > > 2.30.2
> > > 
> > 
> > Reviewed-by: Nishanth Menon <nm@ti.com>
> > 
> 
> Hi,
> 
> another similar patch has been merged against 'drivers/firmware/ti_sci.c'
> just a few days ago, so this one could also be applied.
> 
> Let me know if I need to rebase and/or resend it.


Yes please - please rebase and resend.. wow, [1] that is over an year old..
Sorry for letting it slip through the fingers


[1] https://lore.kernel.org/all/1bd77909ff75f62a2228a39db208c4c6d1b3e0e2.1632659746.git.christophe.jaillet@wanadoo.fr/
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-03  5:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 12:36 [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable Christophe JAILLET
2021-09-27 13:38 ` Nishanth Menon
2022-10-31 20:40   ` Christophe JAILLET
2022-11-03  5:04     ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).