diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-05 15:08:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-05 15:08:20 -0400 |
commit | da87bbd14299ef43848742c44dfe05fa1da5a21f (patch) | |
tree | ac28a7cf89fbcad8cc18f71c041c520d216ec091 /lib | |
parent | e91b3b2681148371d84b9cdf4cab6f9de0522544 (diff) | |
parent | 6e85c5ba73c07b990798087e9b858c065db2b234 (diff) |
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
kernel/posix-cpu-timers.c: fix sparse warning
dma-debug: remove broken dma memory leak detection for 2.6.30
locking: Documentation: lockdep-design.txt, fix note of state bits
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dma-debug.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index d3da7edc034f..69da09a085a1 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -400,60 +400,9 @@ out_err: | |||
400 | return -ENOMEM; | 400 | return -ENOMEM; |
401 | } | 401 | } |
402 | 402 | ||
403 | static int device_dma_allocations(struct device *dev) | ||
404 | { | ||
405 | struct dma_debug_entry *entry; | ||
406 | unsigned long flags; | ||
407 | int count = 0, i; | ||
408 | |||
409 | for (i = 0; i < HASH_SIZE; ++i) { | ||
410 | spin_lock_irqsave(&dma_entry_hash[i].lock, flags); | ||
411 | list_for_each_entry(entry, &dma_entry_hash[i].list, list) { | ||
412 | if (entry->dev == dev) | ||
413 | count += 1; | ||
414 | } | ||
415 | spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags); | ||
416 | } | ||
417 | |||
418 | return count; | ||
419 | } | ||
420 | |||
421 | static int dma_debug_device_change(struct notifier_block *nb, | ||
422 | unsigned long action, void *data) | ||
423 | { | ||
424 | struct device *dev = data; | ||
425 | int count; | ||
426 | |||
427 | |||
428 | switch (action) { | ||
429 | case BUS_NOTIFY_UNBIND_DRIVER: | ||
430 | count = device_dma_allocations(dev); | ||
431 | if (count == 0) | ||
432 | break; | ||
433 | err_printk(dev, NULL, "DMA-API: device driver has pending " | ||
434 | "DMA allocations while released from device " | ||
435 | "[count=%d]\n", count); | ||
436 | break; | ||
437 | default: | ||
438 | break; | ||
439 | } | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | void dma_debug_add_bus(struct bus_type *bus) | 403 | void dma_debug_add_bus(struct bus_type *bus) |
445 | { | 404 | { |
446 | struct notifier_block *nb; | 405 | /* FIXME: register notifier */ |
447 | |||
448 | nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); | ||
449 | if (nb == NULL) { | ||
450 | printk(KERN_ERR "dma_debug_add_bus: out of memory\n"); | ||
451 | return; | ||
452 | } | ||
453 | |||
454 | nb->notifier_call = dma_debug_device_change; | ||
455 | |||
456 | bus_register_notifier(bus, nb); | ||
457 | } | 406 | } |
458 | 407 | ||
459 | /* | 408 | /* |