Lines Matching refs:tmc_pages

140 tmc_pages_get_offset(struct tmc_pages *tmc_pages, dma_addr_t addr)  in tmc_pages_get_offset()  argument
145 for (i = 0; i < tmc_pages->nr_pages; i++) { in tmc_pages_get_offset()
146 page_start = tmc_pages->daddrs[i]; in tmc_pages_get_offset()
159 static void tmc_pages_free(struct tmc_pages *tmc_pages, in tmc_pages_free() argument
165 for (i = 0; i < tmc_pages->nr_pages; i++) { in tmc_pages_free()
166 if (tmc_pages->daddrs && tmc_pages->daddrs[i]) in tmc_pages_free()
167 dma_unmap_page(real_dev, tmc_pages->daddrs[i], in tmc_pages_free()
169 if (tmc_pages->pages && tmc_pages->pages[i]) in tmc_pages_free()
170 __free_page(tmc_pages->pages[i]); in tmc_pages_free()
173 kfree(tmc_pages->pages); in tmc_pages_free()
174 kfree(tmc_pages->daddrs); in tmc_pages_free()
175 tmc_pages->pages = NULL; in tmc_pages_free()
176 tmc_pages->daddrs = NULL; in tmc_pages_free()
177 tmc_pages->nr_pages = 0; in tmc_pages_free()
188 static int tmc_pages_alloc(struct tmc_pages *tmc_pages, in tmc_pages_alloc() argument
197 nr_pages = tmc_pages->nr_pages; in tmc_pages_alloc()
198 tmc_pages->daddrs = kcalloc(nr_pages, sizeof(*tmc_pages->daddrs), in tmc_pages_alloc()
200 if (!tmc_pages->daddrs) in tmc_pages_alloc()
202 tmc_pages->pages = kcalloc(nr_pages, sizeof(*tmc_pages->pages), in tmc_pages_alloc()
204 if (!tmc_pages->pages) { in tmc_pages_alloc()
205 kfree(tmc_pages->daddrs); in tmc_pages_alloc()
206 tmc_pages->daddrs = NULL; in tmc_pages_alloc()
224 tmc_pages->daddrs[i] = paddr; in tmc_pages_alloc()
225 tmc_pages->pages[i] = page; in tmc_pages_alloc()
229 tmc_pages_free(tmc_pages, dev, dir); in tmc_pages_alloc()
268 struct tmc_pages *table_pages = &sg_table->table_pages; in tmc_alloc_table_pages()
356 struct tmc_pages *data = &table->data_pages; in tmc_sg_table_sync_data_range()
372 struct tmc_pages *table_pages = &sg_table->table_pages; in tmc_sg_table_sync_table()
394 struct tmc_pages *data_pages = &sg_table->data_pages; in tmc_sg_table_get_data()
418 struct tmc_pages *tmc_pages; in tmc_sg_daddr_to_vaddr() local
421 tmc_pages = &sg_table->table_pages; in tmc_sg_daddr_to_vaddr()
424 tmc_pages = &sg_table->data_pages; in tmc_sg_daddr_to_vaddr()
428 offset = tmc_pages_get_offset(tmc_pages, addr); in tmc_sg_daddr_to_vaddr()