Lines Matching refs:device_info

90 	struct dmabounce_device_info *device_info = dev->archdata.dmabounce;  in dmabounce_show()  local
92 device_info->small.allocs, in dmabounce_show()
93 device_info->large.allocs, in dmabounce_show()
94 device_info->total_allocs - device_info->small.allocs - in dmabounce_show()
95 device_info->large.allocs, in dmabounce_show()
96 device_info->total_allocs, in dmabounce_show()
97 device_info->map_op_count, in dmabounce_show()
98 device_info->bounce_count); in dmabounce_show()
107 alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr, in alloc_safe_buffer() argument
112 struct device *dev = device_info->dev; in alloc_safe_buffer()
118 if (size <= device_info->small.size) { in alloc_safe_buffer()
119 pool = &device_info->small; in alloc_safe_buffer()
120 } else if (size <= device_info->large.size) { in alloc_safe_buffer()
121 pool = &device_info->large; in alloc_safe_buffer()
156 device_info->total_allocs++; in alloc_safe_buffer()
159 write_lock_irqsave(&device_info->lock, flags); in alloc_safe_buffer()
160 list_add(&buf->node, &device_info->safe_buffers); in alloc_safe_buffer()
161 write_unlock_irqrestore(&device_info->lock, flags); in alloc_safe_buffer()
168 find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr) in find_safe_buffer() argument
173 read_lock_irqsave(&device_info->lock, flags); in find_safe_buffer()
175 list_for_each_entry(b, &device_info->safe_buffers, node) in find_safe_buffer()
182 read_unlock_irqrestore(&device_info->lock, flags); in find_safe_buffer()
187 free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf) in free_safe_buffer() argument
191 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf); in free_safe_buffer()
193 write_lock_irqsave(&device_info->lock, flags); in free_safe_buffer()
197 write_unlock_irqrestore(&device_info->lock, flags); in free_safe_buffer()
202 dma_free_coherent(device_info->dev, buf->size, buf->safe, in free_safe_buffer()
248 struct dmabounce_device_info *device_info = dev->archdata.dmabounce; in map_single() local
251 if (device_info) in map_single()
252 DO_STATS ( device_info->map_op_count++ ); in map_single()
254 buf = alloc_safe_buffer(device_info, ptr, size, dir); in map_single()
483 struct dmabounce_device_info *device_info; in dmabounce_register_dev() local
486 device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC); in dmabounce_register_dev()
487 if (!device_info) { in dmabounce_register_dev()
493 ret = dmabounce_init_pool(&device_info->small, dev, in dmabounce_register_dev()
503 ret = dmabounce_init_pool(&device_info->large, dev, in dmabounce_register_dev()
514 device_info->dev = dev; in dmabounce_register_dev()
515 INIT_LIST_HEAD(&device_info->safe_buffers); in dmabounce_register_dev()
516 rwlock_init(&device_info->lock); in dmabounce_register_dev()
517 device_info->needs_bounce = needs_bounce_fn; in dmabounce_register_dev()
520 device_info->total_allocs = 0; in dmabounce_register_dev()
521 device_info->map_op_count = 0; in dmabounce_register_dev()
522 device_info->bounce_count = 0; in dmabounce_register_dev()
523 device_info->attr_res = device_create_file(dev, &dev_attr_dmabounce_stats); in dmabounce_register_dev()
526 dev->archdata.dmabounce = device_info; in dmabounce_register_dev()
534 dma_pool_destroy(device_info->small.pool); in dmabounce_register_dev()
536 kfree(device_info); in dmabounce_register_dev()
543 struct dmabounce_device_info *device_info = dev->archdata.dmabounce; in dmabounce_unregister_dev() local
548 if (!device_info) { in dmabounce_unregister_dev()
555 if (!list_empty(&device_info->safe_buffers)) { in dmabounce_unregister_dev()
561 if (device_info->small.pool) in dmabounce_unregister_dev()
562 dma_pool_destroy(device_info->small.pool); in dmabounce_unregister_dev()
563 if (device_info->large.pool) in dmabounce_unregister_dev()
564 dma_pool_destroy(device_info->large.pool); in dmabounce_unregister_dev()
567 if (device_info->attr_res == 0) in dmabounce_unregister_dev()
571 kfree(device_info); in dmabounce_unregister_dev()