Skip to content

Commit f0bccea

Browse files
keithbuschakpm00
authored andcommitted
dmapool: consolidate page initialization
Various fields of the dma pool are set in different places. Move it all to one function. Link: https://lkml.kernel.org/r/20230126215125.4069751-9-kbusch@meta.com Fixes: 2d55c16 ("dmapool: create/destroy cleanup") Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Matthew Wilcox <willy@infradead.org> Cc: Tony Battersby <tonyb@cybernetics.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 5407df1 commit f0bccea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mm/dmapool.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
274274
unsigned int offset = 0;
275275
unsigned int next_boundary = pool->boundary;
276276

277+
pool_init_page(pool, page);
278+
page->in_use = 0;
279+
page->offset = 0;
277280
do {
278281
unsigned int next = offset + pool->size;
279282
if (unlikely((next + pool->size) >= next_boundary)) {
@@ -300,11 +303,7 @@ static struct dma_page *pool_alloc_page(struct dma_pool *pool, gfp_t mem_flags)
300303
return NULL;
301304
}
302305

303-
pool_init_page(pool, page);
304306
pool_initialise_page(pool, page);
305-
page->in_use = 0;
306-
page->offset = 0;
307-
308307
return page;
309308
}
310309

0 commit comments

Comments
 (0)