Lines Matching refs:device_info

89 	struct dmabounce_device_info *device_info = dev->archdata.dmabounce;  in dmabounce_show()  local
91 device_info->small.allocs, in dmabounce_show()
92 device_info->large.allocs, in dmabounce_show()
93 device_info->total_allocs - device_info->small.allocs - in dmabounce_show()
94 device_info->large.allocs, in dmabounce_show()
95 device_info->total_allocs, in dmabounce_show()
96 device_info->map_op_count, in dmabounce_show()
97 device_info->bounce_count); in dmabounce_show()
106 alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr, in alloc_safe_buffer() argument
111 struct device *dev = device_info->dev; in alloc_safe_buffer()
117 if (size <= device_info->small.size) { in alloc_safe_buffer()
118 pool = &device_info->small; in alloc_safe_buffer()
119 } else if (size <= device_info->large.size) { in alloc_safe_buffer()
120 pool = &device_info->large; in alloc_safe_buffer()
155 device_info->total_allocs++; in alloc_safe_buffer()
158 write_lock_irqsave(&device_info->lock, flags); in alloc_safe_buffer()
159 list_add(&buf->node, &device_info->safe_buffers); in alloc_safe_buffer()
160 write_unlock_irqrestore(&device_info->lock, flags); in alloc_safe_buffer()
167 find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr) in find_safe_buffer() argument
172 read_lock_irqsave(&device_info->lock, flags); in find_safe_buffer()
174 list_for_each_entry(b, &device_info->safe_buffers, node) in find_safe_buffer()
181 read_unlock_irqrestore(&device_info->lock, flags); in find_safe_buffer()
186 free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf) in free_safe_buffer() argument
190 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf); in free_safe_buffer()
192 write_lock_irqsave(&device_info->lock, flags); in free_safe_buffer()
196 write_unlock_irqrestore(&device_info->lock, flags); in free_safe_buffer()
201 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()
486 struct dmabounce_device_info *device_info; in dmabounce_register_dev() local
489 device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC); in dmabounce_register_dev()
490 if (!device_info) { in dmabounce_register_dev()
496 ret = dmabounce_init_pool(&device_info->small, dev, in dmabounce_register_dev()
506 ret = dmabounce_init_pool(&device_info->large, dev, in dmabounce_register_dev()
517 device_info->dev = dev; in dmabounce_register_dev()
518 INIT_LIST_HEAD(&device_info->safe_buffers); in dmabounce_register_dev()
519 rwlock_init(&device_info->lock); in dmabounce_register_dev()
520 device_info->needs_bounce = needs_bounce_fn; in dmabounce_register_dev()
523 device_info->total_allocs = 0; in dmabounce_register_dev()
524 device_info->map_op_count = 0; in dmabounce_register_dev()
525 device_info->bounce_count = 0; in dmabounce_register_dev()
526 device_info->attr_res = device_create_file(dev, &dev_attr_dmabounce_stats); in dmabounce_register_dev()
529 dev->archdata.dmabounce = device_info; in dmabounce_register_dev()
537 dma_pool_destroy(device_info->small.pool); in dmabounce_register_dev()
539 kfree(device_info); in dmabounce_register_dev()
546 struct dmabounce_device_info *device_info = dev->archdata.dmabounce; in dmabounce_unregister_dev() local
551 if (!device_info) { in dmabounce_unregister_dev()
558 if (!list_empty(&device_info->safe_buffers)) { in dmabounce_unregister_dev()
564 if (device_info->small.pool) in dmabounce_unregister_dev()
565 dma_pool_destroy(device_info->small.pool); in dmabounce_unregister_dev()
566 if (device_info->large.pool) in dmabounce_unregister_dev()
567 dma_pool_destroy(device_info->large.pool); in dmabounce_unregister_dev()
570 if (device_info->attr_res == 0) in dmabounce_unregister_dev()
574 kfree(device_info); in dmabounce_unregister_dev()