Commit 085c2d67 authored by Bjorn Helgaas's avatar Bjorn Helgaas

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()
parents 3aa321dc aa195350
...@@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) ...@@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev)
dev->groups = switchtec_device_groups; dev->groups = switchtec_device_groups;
dev->release = stdev_release; dev->release = stdev_release;
minor = ida_simple_get(&switchtec_minor_ida, 0, 0, minor = ida_alloc(&switchtec_minor_ida, GFP_KERNEL);
GFP_KERNEL);
if (minor < 0) { if (minor < 0) {
rc = minor; rc = minor;
goto err_put; goto err_put;
...@@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, ...@@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
err_devadd: err_devadd:
stdev_kill(stdev); stdev_kill(stdev);
err_put: 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); put_device(&stdev->dev);
return rc; return rc;
} }
...@@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev) ...@@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
cdev_device_del(&stdev->cdev, &stdev->dev); 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"); dev_info(&stdev->dev, "unregistered.\n");
stdev_kill(stdev); stdev_kill(stdev);
put_device(&stdev->dev); put_device(&stdev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment