* [PATCH] misc: bcm-vk: Directly use ida_alloc()/free()
@ 2022-06-08 3:19 Ke Liu
2022-06-08 5:31 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Ke Liu @ 2022-06-08 3:19 UTC (permalink / raw)
To: scott.branden
Cc: bcm-kernel-feedback-list, arnd, gregkh, linux-kernel, Ke Liu
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove().
Signed-off-by: Ke Liu <liuke94@huawei.com>
---
drivers/misc/bcm-vk/bcm_vk_dev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
index a16b99bdaa13..a3a82ebbc699 100644
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c
+++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -1401,7 +1401,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
bcm_vk_tty_set_irq_enabled(vk, i);
}
- id = ida_simple_get(&bcm_vk_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&bcm_vk_ida, GFP_KERNEL);
if (id < 0) {
err = id;
dev_err(dev, "unable to get id\n");
@@ -1500,7 +1500,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
misc_device->name = NULL;
err_ida_remove:
- ida_simple_remove(&bcm_vk_ida, id);
+ ida_free(&bcm_vk_ida, id);
err_irq:
for (i = 0; i < vk->num_irqs; i++)
@@ -1573,7 +1573,7 @@ static void bcm_vk_remove(struct pci_dev *pdev)
if (misc_device->name) {
misc_deregister(misc_device);
kfree(misc_device->name);
- ida_simple_remove(&bcm_vk_ida, vk->devid);
+ ida_free(&bcm_vk_ida, vk->devid);
}
for (i = 0; i < vk->num_irqs; i++)
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), vk);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] misc: bcm-vk: Directly use ida_alloc()/free()
2022-06-08 3:19 [PATCH] misc: bcm-vk: Directly use ida_alloc()/free() Ke Liu
@ 2022-06-08 5:31 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2022-06-08 5:31 UTC (permalink / raw)
To: Ke Liu; +Cc: scott.branden, bcm-kernel-feedback-list, arnd, linux-kernel
On Wed, Jun 08, 2022 at 03:19:27AM +0000, Ke Liu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove().
>
> Signed-off-by: Ke Liu <liuke94@huawei.com>
> ---
> drivers/misc/bcm-vk/bcm_vk_dev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
> index a16b99bdaa13..a3a82ebbc699 100644
> --- a/drivers/misc/bcm-vk/bcm_vk_dev.c
> +++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
> @@ -1401,7 +1401,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> bcm_vk_tty_set_irq_enabled(vk, i);
> }
>
> - id = ida_simple_get(&bcm_vk_ida, 0, 0, GFP_KERNEL);
> + id = ida_alloc(&bcm_vk_ida, GFP_KERNEL);
> if (id < 0) {
> err = id;
> dev_err(dev, "unable to get id\n");
> @@ -1500,7 +1500,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> misc_device->name = NULL;
>
> err_ida_remove:
> - ida_simple_remove(&bcm_vk_ida, id);
> + ida_free(&bcm_vk_ida, id);
>
> err_irq:
> for (i = 0; i < vk->num_irqs; i++)
> @@ -1573,7 +1573,7 @@ static void bcm_vk_remove(struct pci_dev *pdev)
> if (misc_device->name) {
> misc_deregister(misc_device);
> kfree(misc_device->name);
> - ida_simple_remove(&bcm_vk_ida, vk->devid);
> + ida_free(&bcm_vk_ida, vk->devid);
If conversions were this simple, why wouldn't the maintainer have done
this already for the whole tree?
Are you sure these types of changes are correct? How did you test them?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-08 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 3:19 [PATCH] misc: bcm-vk: Directly use ida_alloc()/free() Ke Liu
2022-06-08 5:31 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®