All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
@ 2022-07-04 13:15 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2022-07-04 13:15 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci,
	linux-arm-kernel

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
index 757b7fbcdc59..fee036b07cd4 100644
--- a/drivers/pci/controller/pcie-iproc-msi.c
+++ b/drivers/pci/controller/pcie-iproc-msi.c
@@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
 		msi->has_inten_reg = true;
 
 	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
-	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
-				   sizeof(*msi->bitmap), GFP_KERNEL);
+	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
+					 GFP_KERNEL);
 	if (!msi->bitmap)
 		return -ENOMEM;
 
-- 
2.34.1


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

* [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
@ 2022-07-04 13:15 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2022-07-04 13:15 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci,
	linux-arm-kernel

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
index 757b7fbcdc59..fee036b07cd4 100644
--- a/drivers/pci/controller/pcie-iproc-msi.c
+++ b/drivers/pci/controller/pcie-iproc-msi.c
@@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
 		msi->has_inten_reg = true;
 
 	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
-	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
-				   sizeof(*msi->bitmap), GFP_KERNEL);
+	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
+					 GFP_KERNEL);
 	if (!msi->bitmap)
 		return -ENOMEM;
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
  2022-07-04 13:15 ` Christophe JAILLET
@ 2022-07-04 17:28   ` Ray Jui
  -1 siblings, 0 replies; 6+ messages in thread
From: Ray Jui @ 2022-07-04 17:28 UTC (permalink / raw)
  To: Christophe JAILLET, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: linux-kernel, kernel-janitors, linux-pci, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]



On 7/4/2022 6:15 AM, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 757b7fbcdc59..fee036b07cd4 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
>  		msi->has_inten_reg = true;
>  
>  	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
> -	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
> -				   sizeof(*msi->bitmap), GFP_KERNEL);
> +	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
> +					 GFP_KERNEL);
>  	if (!msi->bitmap)
>  		return -ENOMEM;
>  

Improvement looks fine to me. Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

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

* Re: [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
@ 2022-07-04 17:28   ` Ray Jui
  0 siblings, 0 replies; 6+ messages in thread
From: Ray Jui @ 2022-07-04 17:28 UTC (permalink / raw)
  To: Christophe JAILLET, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: linux-kernel, kernel-janitors, linux-pci, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1097 bytes --]



On 7/4/2022 6:15 AM, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 757b7fbcdc59..fee036b07cd4 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
>  		msi->has_inten_reg = true;
>  
>  	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
> -	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
> -				   sizeof(*msi->bitmap), GFP_KERNEL);
> +	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
> +					 GFP_KERNEL);
>  	if (!msi->bitmap)
>  		return -ENOMEM;
>  

Improvement looks fine to me. Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
  2022-07-04 13:15 ` Christophe JAILLET
@ 2022-07-05 20:03   ` Bjorn Helgaas
  -1 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2022-07-05 20:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-kernel,
	kernel-janitors, linux-pci, linux-arm-kernel

On Mon, Jul 04, 2022 at 03:15:03PM +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied with Ray's ack to pci/ctrl/iproc for v5.20, thanks!

> ---
>  drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 757b7fbcdc59..fee036b07cd4 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
>  		msi->has_inten_reg = true;
>  
>  	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
> -	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
> -				   sizeof(*msi->bitmap), GFP_KERNEL);
> +	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
> +					 GFP_KERNEL);
>  	if (!msi->bitmap)
>  		return -ENOMEM;
>  
> -- 
> 2.34.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps
@ 2022-07-05 20:03   ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2022-07-05 20:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-kernel,
	kernel-janitors, linux-pci, linux-arm-kernel

On Mon, Jul 04, 2022 at 03:15:03PM +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied with Ray's ack to pci/ctrl/iproc for v5.20, thanks!

> ---
>  drivers/pci/controller/pcie-iproc-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 757b7fbcdc59..fee036b07cd4 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -589,8 +589,8 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
>  		msi->has_inten_reg = true;
>  
>  	msi->nr_msi_vecs = msi->nr_irqs * EQ_LEN;
> -	msi->bitmap = devm_kcalloc(pcie->dev, BITS_TO_LONGS(msi->nr_msi_vecs),
> -				   sizeof(*msi->bitmap), GFP_KERNEL);
> +	msi->bitmap = devm_bitmap_zalloc(pcie->dev, msi->nr_msi_vecs,
> +					 GFP_KERNEL);
>  	if (!msi->bitmap)
>  		return -ENOMEM;
>  
> -- 
> 2.34.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-07-05 20:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 13:15 [PATCH] PCI: iproc: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-04 13:15 ` Christophe JAILLET
2022-07-04 17:28 ` Ray Jui
2022-07-04 17:28   ` Ray Jui
2022-07-05 20:03 ` Bjorn Helgaas
2022-07-05 20:03   ` Bjorn Helgaas

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.