Lines Matching refs:device_info

88 	struct dmabounce_device_info *device_info = dev->archdata.dmabounce;  in dmabounce_show()  local
90 device_info->small.allocs, in dmabounce_show()
91 device_info->large.allocs, in dmabounce_show()
92 device_info->total_allocs - device_info->small.allocs - in dmabounce_show()
93 device_info->large.allocs, in dmabounce_show()
94 device_info->total_allocs, in dmabounce_show()
95 device_info->map_op_count, in dmabounce_show()
96 device_info->bounce_count); in dmabounce_show()
105 alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr, in alloc_safe_buffer() argument
110 struct device *dev = device_info->dev; in alloc_safe_buffer()
116 if (size <= device_info->small.size) { in alloc_safe_buffer()
117 pool = &device_info->small; in alloc_safe_buffer()
118 } else if (size <= device_info->large.size) { in alloc_safe_buffer()
119 pool = &device_info->large; in alloc_safe_buffer()
154 device_info->total_allocs++; in alloc_safe_buffer()
157 write_lock_irqsave(&device_info->lock, flags); in alloc_safe_buffer()
158 list_add(&buf->node, &device_info->safe_buffers); in alloc_safe_buffer()
159 write_unlock_irqrestore(&device_info->lock, flags); in alloc_safe_buffer()
166 find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr) in find_safe_buffer() argument
171 read_lock_irqsave(&device_info->lock, flags); in find_safe_buffer()
173 list_for_each_entry(b, &device_info->safe_buffers, node) in find_safe_buffer()
180 read_unlock_irqrestore(&device_info->lock, flags); in find_safe_buffer()
185 free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf) in free_safe_buffer() argument
189 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf); in free_safe_buffer()
191 write_lock_irqsave(&device_info->lock, flags); in free_safe_buffer()
195 write_unlock_irqrestore(&device_info->lock, flags); in free_safe_buffer()
200 dma_free_coherent(device_info->dev, buf->size, buf->safe, in free_safe_buffer()
247 struct dmabounce_device_info *device_info = dev->archdata.dmabounce; in map_single() local
250 if (device_info) in map_single()
251 DO_STATS ( device_info->map_op_count++ ); in map_single()
253 buf = alloc_safe_buffer(device_info, ptr, size, dir); in map_single()
485 struct dmabounce_device_info *device_info; in dmabounce_register_dev() local
488 device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC); in dmabounce_register_dev()
489 if (!device_info) { in dmabounce_register_dev()
495 ret = dmabounce_init_pool(&device_info->small, dev, in dmabounce_register_dev()
505 ret = dmabounce_init_pool(&device_info->large, dev, in dmabounce_register_dev()
516 device_info->dev = dev; in dmabounce_register_dev()
517 INIT_LIST_HEAD(&device_info->safe_buffers); in dmabounce_register_dev()
518 rwlock_init(&device_info->lock); in dmabounce_register_dev()
519 device_info->needs_bounce = needs_bounce_fn; in dmabounce_register_dev()
522 device_info->total_allocs = 0; in dmabounce_register_dev()
523 device_info->map_op_count = 0; in dmabounce_register_dev()
524 device_info->bounce_count = 0; in dmabounce_register_dev()
525 device_info->attr_res = device_create_file(dev, &dev_attr_dmabounce_stats); in dmabounce_register_dev()
528 dev->archdata.dmabounce = device_info; in dmabounce_register_dev()
536 dma_pool_destroy(device_info->small.pool); in dmabounce_register_dev()
538 kfree(device_info); in dmabounce_register_dev()
545 struct dmabounce_device_info *device_info = dev->archdata.dmabounce; in dmabounce_unregister_dev() local
550 if (!device_info) { in dmabounce_unregister_dev()
557 if (!list_empty(&device_info->safe_buffers)) { in dmabounce_unregister_dev()
563 if (device_info->small.pool) in dmabounce_unregister_dev()
564 dma_pool_destroy(device_info->small.pool); in dmabounce_unregister_dev()
565 if (device_info->large.pool) in dmabounce_unregister_dev()
566 dma_pool_destroy(device_info->large.pool); in dmabounce_unregister_dev()
569 if (device_info->attr_res == 0) in dmabounce_unregister_dev()
573 kfree(device_info); in dmabounce_unregister_dev()