Commit 37ae133c authored by Matthew Wilcox's avatar Matthew Wilcox

rsxx: Convert to new IDA API

Eliminate the custom spinlock and the call to ida_pre_get.
Also add a call to ida_free() in the card remove routine, which I believe
fixes a bug in this driver.
Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
parent 5963e78d
...@@ -58,7 +58,6 @@ MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete " ...@@ -58,7 +58,6 @@ MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete "
"until the card startup has completed."); "until the card startup has completed.");
static DEFINE_IDA(rsxx_disk_ida); static DEFINE_IDA(rsxx_disk_ida);
static DEFINE_SPINLOCK(rsxx_ida_lock);
/* --------------------Debugfs Setup ------------------- */ /* --------------------Debugfs Setup ------------------- */
...@@ -771,19 +770,10 @@ static int rsxx_pci_probe(struct pci_dev *dev, ...@@ -771,19 +770,10 @@ static int rsxx_pci_probe(struct pci_dev *dev,
card->dev = dev; card->dev = dev;
pci_set_drvdata(dev, card); pci_set_drvdata(dev, card);
do { st = ida_alloc(&rsxx_disk_ida, GFP_KERNEL);
if (!ida_pre_get(&rsxx_disk_ida, GFP_KERNEL)) { if (st < 0)
st = -ENOMEM;
goto failed_ida_get;
}
spin_lock(&rsxx_ida_lock);
st = ida_get_new(&rsxx_disk_ida, &card->disk_id);
spin_unlock(&rsxx_ida_lock);
} while (st == -EAGAIN);
if (st)
goto failed_ida_get; goto failed_ida_get;
card->disk_id = st;
st = pci_enable_device(dev); st = pci_enable_device(dev);
if (st) if (st)
...@@ -985,9 +975,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, ...@@ -985,9 +975,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
failed_dma_mask: failed_dma_mask:
pci_disable_device(dev); pci_disable_device(dev);
failed_enable: failed_enable:
spin_lock(&rsxx_ida_lock); ida_free(&rsxx_disk_ida, card->disk_id);
ida_remove(&rsxx_disk_ida, card->disk_id);
spin_unlock(&rsxx_ida_lock);
failed_ida_get: failed_ida_get:
kfree(card); kfree(card);
...@@ -1050,6 +1038,7 @@ static void rsxx_pci_remove(struct pci_dev *dev) ...@@ -1050,6 +1038,7 @@ static void rsxx_pci_remove(struct pci_dev *dev)
pci_disable_device(dev); pci_disable_device(dev);
pci_release_regions(dev); pci_release_regions(dev);
ida_free(&rsxx_disk_ida, card->disk_id);
kfree(card); kfree(card);
} }
......
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