diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:48:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:48:42 -0400 |
commit | aba16dc5cf9318b4e0fe92f8261779cd9f1d2d77 (patch) | |
tree | 1f53d2cee40e82efe6a727208307af475327af9a /drivers/misc | |
parent | c4726e774ed27680c418e138234dfd2b8e1e89ac (diff) | |
parent | 1df895190233fcc30d46beca4550bcafb7b959a6 (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/misc')
-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 @@ | |||
16 | #include <linux/gfp.h> | 16 | #include <linux/gfp.h> |
17 | 17 | ||
18 | static DEFINE_IDA(cb710_ida); | 18 | static DEFINE_IDA(cb710_ida); |
19 | static DEFINE_SPINLOCK(cb710_ida_lock); | ||
20 | 19 | ||
21 | void cb710_pci_update_config_reg(struct pci_dev *pdev, | 20 | void cb710_pci_update_config_reg(struct pci_dev *pdev, |
22 | int reg, uint32_t mask, uint32_t xor) | 21 | int reg, uint32_t mask, uint32_t xor) |
@@ -205,7 +204,6 @@ static int cb710_probe(struct pci_dev *pdev, | |||
205 | const struct pci_device_id *ent) | 204 | const struct pci_device_id *ent) |
206 | { | 205 | { |
207 | struct cb710_chip *chip; | 206 | struct cb710_chip *chip; |
208 | unsigned long flags; | ||
209 | u32 val; | 207 | u32 val; |
210 | int err; | 208 | int err; |
211 | int n = 0; | 209 | int n = 0; |
@@ -256,18 +254,10 @@ static int cb710_probe(struct pci_dev *pdev, | |||
256 | if (err) | 254 | if (err) |
257 | return err; | 255 | return err; |
258 | 256 | ||
259 | do { | 257 | err = ida_alloc(&cb710_ida, GFP_KERNEL); |
260 | if (!ida_pre_get(&cb710_ida, GFP_KERNEL)) | 258 | if (err < 0) |
261 | return -ENOMEM; | 259 | return err; |
262 | 260 | chip->platform_id = err; | |
263 | spin_lock_irqsave(&cb710_ida_lock, flags); | ||
264 | err = ida_get_new(&cb710_ida, &chip->platform_id); | ||
265 | spin_unlock_irqrestore(&cb710_ida_lock, flags); | ||
266 | |||
267 | if (err && err != -EAGAIN) | ||
268 | return err; | ||
269 | } while (err); | ||
270 | |||
271 | 261 | ||
272 | dev_info(&pdev->dev, "id %d, IO 0x%p, IRQ %d\n", | 262 | dev_info(&pdev->dev, "id %d, IO 0x%p, IRQ %d\n", |
273 | chip->platform_id, chip->iobase, pdev->irq); | 263 | chip->platform_id, chip->iobase, pdev->irq); |
@@ -308,7 +298,6 @@ unreg_mmc: | |||
308 | static void cb710_remove_one(struct pci_dev *pdev) | 298 | static void cb710_remove_one(struct pci_dev *pdev) |
309 | { | 299 | { |
310 | struct cb710_chip *chip = pci_get_drvdata(pdev); | 300 | struct cb710_chip *chip = pci_get_drvdata(pdev); |
311 | unsigned long flags; | ||
312 | 301 | ||
313 | cb710_unregister_slot(chip, CB710_SLOT_SM); | 302 | cb710_unregister_slot(chip, CB710_SLOT_SM); |
314 | cb710_unregister_slot(chip, CB710_SLOT_MS); | 303 | cb710_unregister_slot(chip, CB710_SLOT_MS); |
@@ -317,9 +306,7 @@ static void cb710_remove_one(struct pci_dev *pdev) | |||
317 | BUG_ON(atomic_read(&chip->slot_refs_count) != 0); | 306 | BUG_ON(atomic_read(&chip->slot_refs_count) != 0); |
318 | #endif | 307 | #endif |
319 | 308 | ||
320 | spin_lock_irqsave(&cb710_ida_lock, flags); | 309 | ida_free(&cb710_ida, chip->platform_id); |
321 | ida_remove(&cb710_ida, chip->platform_id); | ||
322 | spin_unlock_irqrestore(&cb710_ida_lock, flags); | ||
323 | } | 310 | } |
324 | 311 | ||
325 | static const struct pci_device_id cb710_pci_tbl[] = { | 312 | static const struct pci_device_id cb710_pci_tbl[] = { |