From: Matthew Wilcox (Oracle) Date: Sun, 27 Sep 2020 16:50:39 +0000 (-0400) Subject: scsi: sym53c8xx_2: Remove mp0 memory pool X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0c2d4e1961005f88fd9b0888f7fada04530724c5;p=users%2Fwilly%2Flinux.git scsi: sym53c8xx_2: Remove mp0 memory pool Now we don't use the mp0 pool, we can remove it. Signed-off-by: Matthew Wilcox (Oracle) --- diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index 9231a2899064..dba468af3460 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h @@ -1109,11 +1109,6 @@ bad: * MEMORY ALLOCATOR. */ -#define sym_get_mem_cluster() \ - (void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER) -#define sym_free_mem_cluster(p) \ - free_pages((unsigned long)p, SYM_MEM_PAGE_ORDER) - /* * Link between free memory chunks of a given size. */ diff --git a/drivers/scsi/sym53c8xx_2/sym_malloc.c b/drivers/scsi/sym53c8xx_2/sym_malloc.c index 8a6b050d0c3b..360fb38973ca 100644 --- a/drivers/scsi/sym53c8xx_2/sym_malloc.c +++ b/drivers/scsi/sym53c8xx_2/sym_malloc.c @@ -171,35 +171,7 @@ static void __sym_mfree(m_pool_p mp, void *ptr, int size, char *name) ___sym_mfree(mp, ptr, size); } -/* - * Default memory pool we donnot need to involve in DMA. - * - * With DMA abstraction, we use functions (methods), to - * distinguish between non DMAable memory and DMAable memory. - */ -static void *___mp0_get_mem_cluster(m_pool_p mp) -{ - void *m = sym_get_mem_cluster(); - if (m) - ++mp->nump; - return m; -} - -#ifdef SYM_MEM_FREE_UNUSED -static void ___mp0_free_mem_cluster(m_pool_p mp, void *m) -{ - sym_free_mem_cluster(m); - --mp->nump; -} -#else -#define ___mp0_free_mem_cluster NULL -#endif - -static struct sym_m_pool mp0 = { - NULL, - ___mp0_get_mem_cluster, - ___mp0_free_mem_cluster -}; +static struct sym_m_pool *mempools = NULL; /* * Methods that maintains DMAable pools according to user allocations. @@ -252,9 +224,9 @@ static void ___free_dma_mem_cluster(m_pool_p mp, void *m) static inline m_pool_p ___get_dma_pool(m_pool_ident_t dev_dmat) { m_pool_p mp; - for (mp = mp0.next; - mp && !sym_m_pool_match(mp->dev_dmat, dev_dmat); - mp = mp->next); + for (mp = mempools; mp; mp = mp->next) + if (sym_m_pool_match(mp->dev_dmat, dev_dmat)) + break; return mp; } @@ -268,8 +240,8 @@ static m_pool_p ___cre_dma_pool(m_pool_ident_t dev_dmat) #ifdef SYM_MEM_FREE_UNUSED mp->free_mem_cluster = ___free_dma_mem_cluster; #endif - mp->next = mp0.next; - mp0.next = mp; + mp->next = mempools; + mempools = mp; return mp; } return NULL; @@ -279,7 +251,7 @@ static m_pool_p ___cre_dma_pool(m_pool_ident_t dev_dmat) /* Destroy a DMAable memory pool (when got emptied) */ static void ___del_dma_pool(m_pool_p p) { - m_pool_p *pp = &mp0.next; + m_pool_p *pp = &mempools; while (*pp && *pp != p) pp = &(*pp)->next;