summaryrefslogtreecommitdiffstats
path: root/drivers/block/rsxx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 14:48:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 14:48:42 -0400
commitaba16dc5cf9318b4e0fe92f8261779cd9f1d2d77 (patch)
tree1f53d2cee40e82efe6a727208307af475327af9a /drivers/block/rsxx
parentc4726e774ed27680c418e138234dfd2b8e1e89ac (diff)
parent1df895190233fcc30d46beca4550bcafb7b959a6 (diff)
Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax
Pull IDA updates from Matthew Wilcox: "A better IDA API: id = ida_alloc(ida, GFP_xxx); ida_free(ida, id); rather than the cumbersome ida_simple_get(), ida_simple_remove(). The new IDA API is similar to ida_simple_get() but better named. The internal restructuring of the IDA code removes the bitmap preallocation nonsense. I hope the net -200 lines of code is convincing" * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits) ida: Change ida_get_new_above to return the id ida: Remove old API test_ida: check_ida_destroy and check_ida_alloc test_ida: Convert check_ida_conv to new API test_ida: Move ida_check_max test_ida: Move ida_check_leaf idr-test: Convert ida_check_nomem to new API ida: Start new test_ida module target/iscsi: Allocate session IDs from an IDA iscsi target: fix session creation failure handling drm/vmwgfx: Convert to new IDA API dmaengine: Convert to new IDA API ppc: Convert vas ID allocation to new IDA API media: Convert entity ID allocation to new IDA API ppc: Convert mmu context allocation to new IDA API Convert net_namespace to new IDA API cb710: Convert to new IDA API rsxx: Convert to new IDA API osd: Convert to new IDA API sd: Convert to new IDA API ...
Diffstat (limited to 'drivers/block/rsxx')
-rw-r--r--drivers/block/rsxx/core.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index b7d71914a32a..f2c631ce793c 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -58,7 +58,6 @@ MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete "
58 "until the card startup has completed."); 58 "until the card startup has completed.");
59 59
60static DEFINE_IDA(rsxx_disk_ida); 60static DEFINE_IDA(rsxx_disk_ida);
61static DEFINE_SPINLOCK(rsxx_ida_lock);
62 61
63/* --------------------Debugfs Setup ------------------- */ 62/* --------------------Debugfs Setup ------------------- */
64 63
@@ -771,19 +770,10 @@ static int rsxx_pci_probe(struct pci_dev *dev,
771 card->dev = dev; 770 card->dev = dev;
772 pci_set_drvdata(dev, card); 771 pci_set_drvdata(dev, card);
773 772
774 do { 773 st = ida_alloc(&rsxx_disk_ida, GFP_KERNEL);
775 if (!ida_pre_get(&rsxx_disk_ida, GFP_KERNEL)) { 774 if (st < 0)
776 st = -ENOMEM;
777 goto failed_ida_get;
778 }
779
780 spin_lock(&rsxx_ida_lock);
781 st = ida_get_new(&rsxx_disk_ida, &card->disk_id);
782 spin_unlock(&rsxx_ida_lock);
783 } while (st == -EAGAIN);
784
785 if (st)
786 goto failed_ida_get; 775 goto failed_ida_get;
776 card->disk_id = st;
787 777
788 st = pci_enable_device(dev); 778 st = pci_enable_device(dev);
789 if (st) 779 if (st)
@@ -985,9 +975,7 @@ failed_request_regions:
985failed_dma_mask: 975failed_dma_mask:
986 pci_disable_device(dev); 976 pci_disable_device(dev);
987failed_enable: 977failed_enable:
988 spin_lock(&rsxx_ida_lock); 978 ida_free(&rsxx_disk_ida, card->disk_id);
989 ida_remove(&rsxx_disk_ida, card->disk_id);
990 spin_unlock(&rsxx_ida_lock);
991failed_ida_get: 979failed_ida_get:
992 kfree(card); 980 kfree(card);
993 981
@@ -1050,6 +1038,7 @@ static void rsxx_pci_remove(struct pci_dev *dev)
1050 pci_disable_device(dev); 1038 pci_disable_device(dev);
1051 pci_release_regions(dev); 1039 pci_release_regions(dev);
1052 1040
1041 ida_free(&rsxx_disk_ida, card->disk_id);
1053 kfree(card); 1042 kfree(card);
1054} 1043}
1055 1044