Skip to content

Commit 085c2d6

Browse files
committed
Merge branch 'pci/ctrl/switchtec'
- Prefer ida_alloc()/free() over ida_simple_get()/remove() (Ke Liu) * pci/ctrl/switchtec: PCI: switchtec: Prefer ida_alloc()/free() over ida_simple_get()/remove()
2 parents 3aa321d + aa19535 commit 085c2d6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/pci/switch/switchtec.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev)
13761376
dev->groups = switchtec_device_groups;
13771377
dev->release = stdev_release;
13781378

1379-
minor = ida_simple_get(&switchtec_minor_ida, 0, 0,
1380-
GFP_KERNEL);
1379+
minor = ida_alloc(&switchtec_minor_ida, GFP_KERNEL);
13811380
if (minor < 0) {
13821381
rc = minor;
13831382
goto err_put;
@@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
16921691
err_devadd:
16931692
stdev_kill(stdev);
16941693
err_put:
1695-
ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt));
1694+
ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt));
16961695
put_device(&stdev->dev);
16971696
return rc;
16981697
}
@@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev)
17041703
pci_set_drvdata(pdev, NULL);
17051704

17061705
cdev_device_del(&stdev->cdev, &stdev->dev);
1707-
ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt));
1706+
ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt));
17081707
dev_info(&stdev->dev, "unregistered.\n");
17091708
stdev_kill(stdev);
17101709
put_device(&stdev->dev);

0 commit comments

Comments
 (0)