* [PATCH v1] PCI: Switch to bitmap_zalloc()
@ 2018-08-30 10:32 Andy Shevchenko
2018-09-06 19:05 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2018-08-30 10:32 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci; +Cc: Andy Shevchenko
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pci/pci.c | 3 +--
drivers/pci/probe.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 29ff9619b5fa..c6de7e0dd3fa 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5689,8 +5689,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)
{
if (!dev->dma_alias_mask)
- dev->dma_alias_mask = kcalloc(BITS_TO_LONGS(U8_MAX),
- sizeof(long), GFP_KERNEL);
+ dev->dma_alias_mask = bitmap_zalloc(U8_MAX, GFP_KERNEL);
if (!dev->dma_alias_mask) {
pci_warn(dev, "Unable to allocate DMA alias mask\n");
return;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ec784009a36b..b6465a59aeb1 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2140,7 +2140,7 @@ static void pci_release_dev(struct device *dev)
pcibios_release_device(pci_dev);
pci_bus_put(pci_dev->bus);
kfree(pci_dev->driver_override);
- kfree(pci_dev->dma_alias_mask);
+ bitmap_free(pci_dev->dma_alias_mask);
kfree(pci_dev);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] PCI: Switch to bitmap_zalloc()
2018-08-30 10:32 [PATCH v1] PCI: Switch to bitmap_zalloc() Andy Shevchenko
@ 2018-09-06 19:05 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2018-09-06 19:05 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Bjorn Helgaas, linux-pci
On Thu, Aug 30, 2018 at 01:32:36PM +0300, Andy Shevchenko wrote:
> Switch to bitmap_zalloc() to show clearly what we are allocating.
> Besides that it returns pointer of bitmap type instead of opaque void *.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied to pci/misc for v4.20, thanks!
> ---
> drivers/pci/pci.c | 3 +--
> drivers/pci/probe.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 29ff9619b5fa..c6de7e0dd3fa 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5689,8 +5689,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
> void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)
> {
> if (!dev->dma_alias_mask)
> - dev->dma_alias_mask = kcalloc(BITS_TO_LONGS(U8_MAX),
> - sizeof(long), GFP_KERNEL);
> + dev->dma_alias_mask = bitmap_zalloc(U8_MAX, GFP_KERNEL);
> if (!dev->dma_alias_mask) {
> pci_warn(dev, "Unable to allocate DMA alias mask\n");
> return;
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index ec784009a36b..b6465a59aeb1 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2140,7 +2140,7 @@ static void pci_release_dev(struct device *dev)
> pcibios_release_device(pci_dev);
> pci_bus_put(pci_dev->bus);
> kfree(pci_dev->driver_override);
> - kfree(pci_dev->dma_alias_mask);
> + bitmap_free(pci_dev->dma_alias_mask);
> kfree(pci_dev);
> }
>
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-06 23:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 10:32 [PATCH v1] PCI: Switch to bitmap_zalloc() Andy Shevchenko
2018-09-06 19:05 ` Bjorn Helgaas
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).