drivers: pci: Directly use ida_alloc()/free()
Subsystems (4)
PATCH 1/1 drivers: pci: Directly use ida_alloc()/free()
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .
Signed-off-by keliu <[email protected]>
--- drivers/pci/controller/vmd.c | 6 +++--- drivers/pci/switch/switchtec.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/pci/controller/vmd.c +3 -3
@@ -893,7 +893,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)return -ENOMEM ; vmd->dev = dev; - vmd->instance =ida_simple_get (&vmd_instance_ida,0 ,0 ,GFP_KERNEL ); + vmd->instance =ida_alloc (&vmd_instance_ida,GFP_KERNEL );if (vmd->instance <0 )return vmd->instance;
@@ -934,7 +934,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)return 0 ; out_release_instance: -ida_simple_remove (&vmd_instance_ida, vmd->instance); +ida_free (&vmd_instance_ida, vmd->instance);kfree (vmd->name);return err; }
@@ -957,7 +957,7 @@ static void vmd_remove(struct pci_dev *dev)vmd_cleanup_srcu (vmd);vmd_detach_resources (vmd);vmd_remove_irq_domain (vmd); -ida_simple_remove (&vmd_instance_ida, vmd->instance); +ida_free (&vmd_instance_ida, vmd->instance);kfree (vmd->name); }
drivers/pci/switch/switchtec.c +3 -4
@@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) dev->groups = switchtec_device_groups; dev->release = stdev_release; - minor =ida_simple_get (&switchtec_minor_ida,0 ,0 , -GFP_KERNEL ); + minor =ida_alloc (&switchtec_minor_ida,GFP_KERNEL );if (minor <0 ) { rc = minor; goto err_put;
@@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, err_devadd:stdev_kill (stdev); err_put: -ida_simple_remove (&switchtec_minor_ida,MINOR (stdev->dev.devt)); +ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));put_device (&stdev->dev);return rc; }
@@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev)pci_set_drvdata (pdev,NULL );cdev_device_del (&stdev->cdev, &stdev->dev); -ida_simple_remove (&switchtec_minor_ida,MINOR (stdev->dev.devt)); +ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));dev_info (&stdev->dev,"unregistered.\n" );stdev_kill (stdev);put_device (&stdev->dev);
Signature · 1 line
2.25.1
Quoted 4 lines · keliu
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .Signed-off-by keliu <[email protected]>
I see you got some feedback about a full name already (here's a reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v5.17#n407)
so I'll wait for the update. When you do, please also update the subject line to match previous drivers/pci/ history (use "git log --oneline drivers/pci/" to see it).
The patch itself looks good to me. Thanks for doing this!
Quoted 71 lines
--- drivers/pci/controller/vmd.c | 6 +++--- drivers/pci/switch/switchtec.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)drivers/pci/controller/vmd.c +3
-3@@ -893,7 +893,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)return -ENOMEM ; vmd->dev = dev; - vmd->instance =ida_simple_get (&vmd_instance_ida,0 ,0 ,GFP_KERNEL ); + vmd->instance =ida_alloc (&vmd_instance_ida,GFP_KERNEL );if (vmd->instance <0 )return vmd->instance;@@ -934,7 +934,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)return 0 ; out_release_instance: -ida_simple_remove (&vmd_instance_ida, vmd->instance); +ida_free (&vmd_instance_ida, vmd->instance);kfree (vmd->name);return err; }@@ -957,7 +957,7 @@ static void vmd_remove(struct pci_dev *dev)vmd_cleanup_srcu (vmd);vmd_detach_resources (vmd);vmd_remove_irq_domain (vmd); -ida_simple_remove (&vmd_instance_ida, vmd->instance); +ida_free (&vmd_instance_ida, vmd->instance);kfree (vmd->name); }drivers/pci/switch/switchtec.c +3
-4@@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) dev->groups = switchtec_device_groups; dev->release = stdev_release; - minor =ida_simple_get (&switchtec_minor_ida,0 ,0 , -GFP_KERNEL ); + minor =ida_alloc (&switchtec_minor_ida,GFP_KERNEL );if (minor <0 ) { rc = minor; goto err_put;@@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, err_devadd:stdev_kill (stdev); err_put: -ida_simple_remove (&switchtec_minor_ida,MINOR (stdev->dev.devt)); +ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));put_device (&stdev->dev);return rc; }@@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev)pci_set_drvdata (pdev,NULL );cdev_device_del (&stdev->cdev, &stdev->dev); -ida_simple_remove (&switchtec_minor_ida,MINOR (stdev->dev.devt)); +ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));dev_info (&stdev->dev,"unregistered.\n" );stdev_kill (stdev);put_device (&stdev->dev);Signature · 1 line
2.25.1