diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-06-11 15:53:18 -0400 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-08-21 23:54:18 -0400 |
commit | 4c9ca2fd7c402c8eab6e949899af04bc3c249b2b (patch) | |
tree | ac170d0fb419973498892a3b0919a3c95b1b1785 /drivers/misc/cb710 | |
parent | 37ae133c2e079d50d6198a4a230732e5016676de (diff) |
cb710: Convert to new IDA API
Eliminates the custom spinlock and the call to ida_pre_get.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Diffstat (limited to 'drivers/misc/cb710')
-rw-r--r-- | drivers/misc/cb710/core.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c index 4d4acf763b65..2c43fd09d602 100644 --- a/drivers/misc/cb710/core.c +++ b/drivers/misc/cb710/core.c @@ -16,7 +16,6 @@ #include <linux/gfp.h> static DEFINE_IDA(cb710_ida); -static DEFINE_SPINLOCK(cb710_ida_lock); void cb710_pci_update_config_reg(struct pci_dev *pdev, int reg, uint32_t mask, uint32_t xor) @@ -205,7 +204,6 @@ static int cb710_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct cb710_chip *chip; - unsigned long flags; u32 val; int err; int n = 0; @@ -256,18 +254,10 @@ static int cb710_probe(struct pci_dev *pdev, if (err) return err; - do { - if (!ida_pre_get(&cb710_ida, GFP_KERNEL)) - return -ENOMEM; - - spin_lock_irqsave(&cb710_ida_lock, flags); - err = ida_get_new(&cb710_ida, &chip->platform_id); - spin_unlock_irqrestore(&cb710_ida_lock, flags); - - if (err && err != -EAGAIN) - return err; - } while (err); - + err = ida_alloc(&cb710_ida, GFP_KERNEL); + if (err < 0) + return err; + chip->platform_id = err; dev_info(&pdev->dev, "id %d, IO 0x%p, IRQ %d\n", chip->platform_id, chip->iobase, pdev->irq); @@ -308,7 +298,6 @@ unreg_mmc: static void cb710_remove_one(struct pci_dev *pdev) { struct cb710_chip *chip = pci_get_drvdata(pdev); - unsigned long flags; cb710_unregister_slot(chip, CB710_SLOT_SM); cb710_unregister_slot(chip, CB710_SLOT_MS); @@ -317,9 +306,7 @@ static void cb710_remove_one(struct pci_dev *pdev) BUG_ON(atomic_read(&chip->slot_refs_count) != 0); #endif - spin_lock_irqsave(&cb710_ida_lock, flags); - ida_remove(&cb710_ida, chip->platform_id); - spin_unlock_irqrestore(&cb710_ida_lock, flags); + ida_free(&cb710_ida, chip->platform_id); } static const struct pci_device_id cb710_pci_tbl[] = { |