Lines Matching refs:resource

48 static struct vme_bridge *find_bridge(struct vme_resource *resource)  in find_bridge()  argument
51 switch (resource->type) { in find_bridge()
53 return list_entry(resource->entry, struct vme_master_resource, in find_bridge()
57 return list_entry(resource->entry, struct vme_slave_resource, in find_bridge()
61 return list_entry(resource->entry, struct vme_dma_resource, in find_bridge()
65 return list_entry(resource->entry, struct vme_lm_resource, in find_bridge()
86 void *vme_alloc_consistent(struct vme_resource *resource, size_t size, in vme_alloc_consistent() argument
91 if (!resource) { in vme_alloc_consistent()
96 bridge = find_bridge(resource); in vme_alloc_consistent()
126 void vme_free_consistent(struct vme_resource *resource, size_t size, in vme_free_consistent() argument
131 if (!resource) { in vme_free_consistent()
136 bridge = find_bridge(resource); in vme_free_consistent()
167 size_t vme_get_size(struct vme_resource *resource) in vme_get_size() argument
174 switch (resource->type) { in vme_get_size()
176 retval = vme_master_get(resource, &enabled, &base, &size, in vme_get_size()
184 retval = vme_slave_get(resource, &enabled, &base, &size, in vme_get_size()
297 struct vme_resource *resource = NULL; in vme_slave_request() local
333 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_slave_request()
334 if (!resource) in vme_slave_request()
337 resource->type = VME_SLAVE; in vme_slave_request()
338 resource->entry = &allocated_image->list; in vme_slave_request()
340 return resource; in vme_slave_request()
370 int vme_slave_set(struct vme_resource *resource, int enabled, in vme_slave_set() argument
374 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_set()
378 if (resource->type != VME_SLAVE) { in vme_slave_set()
383 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_set()
420 int vme_slave_get(struct vme_resource *resource, int *enabled, in vme_slave_get() argument
424 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_get()
427 if (resource->type != VME_SLAVE) { in vme_slave_get()
432 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_get()
450 void vme_slave_free(struct vme_resource *resource) in vme_slave_free() argument
454 if (resource->type != VME_SLAVE) { in vme_slave_free()
459 slave_image = list_entry(resource->entry, struct vme_slave_resource, in vme_slave_free()
475 kfree(resource); in vme_slave_free()
498 struct vme_resource *resource = NULL; in vme_master_request() local
537 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_master_request()
538 if (!resource) in vme_master_request()
541 resource->type = VME_MASTER; in vme_master_request()
542 resource->entry = &allocated_image->list; in vme_master_request()
544 return resource; in vme_master_request()
574 int vme_master_set(struct vme_resource *resource, int enabled, in vme_master_set() argument
578 struct vme_bridge *bridge = find_bridge(resource); in vme_master_set()
582 if (resource->type != VME_MASTER) { in vme_master_set()
587 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_set()
625 int vme_master_get(struct vme_resource *resource, int *enabled, in vme_master_get() argument
629 struct vme_bridge *bridge = find_bridge(resource); in vme_master_get()
632 if (resource->type != VME_MASTER) { in vme_master_get()
637 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_get()
664 ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count, in vme_master_read() argument
667 struct vme_bridge *bridge = find_bridge(resource); in vme_master_read()
676 if (resource->type != VME_MASTER) { in vme_master_read()
681 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_read()
683 length = vme_get_size(resource); in vme_master_read()
713 ssize_t vme_master_write(struct vme_resource *resource, void *buf, in vme_master_write() argument
716 struct vme_bridge *bridge = find_bridge(resource); in vme_master_write()
725 if (resource->type != VME_MASTER) { in vme_master_write()
730 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_write()
732 length = vme_get_size(resource); in vme_master_write()
765 unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, in vme_master_rmw() argument
768 struct vme_bridge *bridge = find_bridge(resource); in vme_master_rmw()
776 if (resource->type != VME_MASTER) { in vme_master_rmw()
781 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_rmw()
798 int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma) in vme_master_mmap() argument
804 if (resource->type != VME_MASTER) { in vme_master_mmap()
809 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_mmap()
830 void vme_master_free(struct vme_resource *resource) in vme_master_free() argument
834 if (resource->type != VME_MASTER) { in vme_master_free()
839 master_image = list_entry(resource->entry, struct vme_master_resource, in vme_master_free()
855 kfree(resource); in vme_master_free()
875 struct vme_resource *resource = NULL; in vme_dma_request() local
912 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_dma_request()
913 if (!resource) in vme_dma_request()
916 resource->type = VME_DMA; in vme_dma_request()
917 resource->entry = &allocated_ctrlr->list; in vme_dma_request()
919 return resource; in vme_dma_request()
942 struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) in vme_new_dma_list() argument
946 if (resource->type != VME_DMA) { in vme_new_dma_list()
956 dma_list->parent = list_entry(resource->entry, in vme_new_dma_list()
1222 int vme_dma_free(struct vme_resource *resource) in vme_dma_free() argument
1226 if (resource->type != VME_DMA) { in vme_dma_free()
1231 ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); in vme_dma_free()
1248 kfree(resource); in vme_dma_free()
1480 struct vme_resource *resource = NULL; in vme_lm_request() local
1512 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_lm_request()
1513 if (!resource) in vme_lm_request()
1516 resource->type = VME_LM; in vme_lm_request()
1517 resource->entry = &allocated_lm->list; in vme_lm_request()
1519 return resource; in vme_lm_request()
1543 int vme_lm_count(struct vme_resource *resource) in vme_lm_count() argument
1547 if (resource->type != VME_LM) { in vme_lm_count()
1552 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_count()
1572 int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, in vme_lm_set() argument
1575 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_set()
1578 if (resource->type != VME_LM) { in vme_lm_set()
1583 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_set()
1608 int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base, in vme_lm_get() argument
1611 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_get()
1614 if (resource->type != VME_LM) { in vme_lm_get()
1619 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_get()
1645 int vme_lm_attach(struct vme_resource *resource, int monitor, in vme_lm_attach() argument
1648 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_attach()
1651 if (resource->type != VME_LM) { in vme_lm_attach()
1656 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_attach()
1679 int vme_lm_detach(struct vme_resource *resource, int monitor) in vme_lm_detach() argument
1681 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_detach()
1684 if (resource->type != VME_LM) { in vme_lm_detach()
1689 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_detach()
1712 void vme_lm_free(struct vme_resource *resource) in vme_lm_free() argument
1716 if (resource->type != VME_LM) { in vme_lm_free()
1721 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_free()
1734 kfree(resource); in vme_lm_free()