summary refs log tree commit diff
path: root/drivers/pci
diff options
context:
space:
mode:
authorKe Liu <liuke94@huawei.com>2022-06-02 07:11:15 +0000
committerBjorn Helgaas <bhelgaas@google.com>2022-06-09 12:28:21 -0500
commitaa195350cdc8e93a890c56d0999b17c441b60b97 (patch)
treec1bfbb09dd0d4539ecd8225189a513c883cde366 /drivers/pci
parentf2906aa863381afb0015a9eb7fefad885d4e5a56 (diff)
downloadlinux-aa195350cdc8e93a890c56d0999b17c441b60b97.tar.gz
PCI: switchtec: Prefer ida_alloc()/free() over ida_simple_get()/remove()
Use ida_alloc() and ida_free() instead of deprecated ida_simple_get() and
ida_simple_remove().

Link: https://lore.kernel.org/r/20220602071115.3833935-1-liuke94@huawei.com
Signed-off-by: Ke Liu <liuke94@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Logan Gunthorpe <logang@deltatee.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/switch/switchtec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index c36c1238c604..75be4fe22509 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -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);