aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-05-11 08:44:27 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-11 08:44:31 -0400
commit41fb454ebe6024f5c1e3b3cbc0abc0da762e7b51 (patch)
tree51c50bcb67a5039448ddfa1869d7948cab1217e9 /lib/dma-debug.c
parent19c1a6f5764d787113fa323ffb18be7991208f82 (diff)
parent091bf7624d1c90cec9e578a18529f615213ff847 (diff)
Merge commit 'v2.6.30-rc5' into core/iommu
Merge reason: core/iommu was on an .30-rc1 base, update it to .30-rc5 to refresh. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 5d61019330cd..cdd205d6bf7c 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -458,60 +458,9 @@ out_err:
458 return -ENOMEM; 458 return -ENOMEM;
459} 459}
460 460
461static int device_dma_allocations(struct device *dev)
462{
463 struct dma_debug_entry *entry;
464 unsigned long flags;
465 int count = 0, i;
466
467 for (i = 0; i < HASH_SIZE; ++i) {
468 spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
469 list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
470 if (entry->dev == dev)
471 count += 1;
472 }
473 spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
474 }
475
476 return count;
477}
478
479static int dma_debug_device_change(struct notifier_block *nb,
480 unsigned long action, void *data)
481{
482 struct device *dev = data;
483 int count;
484
485
486 switch (action) {
487 case BUS_NOTIFY_UNBIND_DRIVER:
488 count = device_dma_allocations(dev);
489 if (count == 0)
490 break;
491 err_printk(dev, NULL, "DMA-API: device driver has pending "
492 "DMA allocations while released from device "
493 "[count=%d]\n", count);
494 break;
495 default:
496 break;
497 }
498
499 return 0;
500}
501
502void dma_debug_add_bus(struct bus_type *bus) 461void dma_debug_add_bus(struct bus_type *bus)
503{ 462{
504 struct notifier_block *nb; 463 /* FIXME: register notifier */
505
506 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
507 if (nb == NULL) {
508 printk(KERN_ERR "dma_debug_add_bus: out of memory\n");
509 return;
510 }
511
512 nb->notifier_call = dma_debug_device_change;
513
514 bus_register_notifier(bus, nb);
515} 464}
516 465
517/* 466/*