]> www.infradead.org Git - users/willy/linux.git/commitdiff
scsi: sym53c8xx_2: Remove mp0 memory pool
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 27 Sep 2020 16:50:39 +0000 (12:50 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 28 Sep 2020 13:27:36 +0000 (09:27 -0400)
Now we don't use the mp0 pool, we can remove it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
drivers/scsi/sym53c8xx_2/sym_hipd.h
drivers/scsi/sym53c8xx_2/sym_malloc.c

index 9231a289906436db9cad8621c74b7c59a5fd8a99..dba468af3460823bf0133b7094dc5babf20e6f46 100644 (file)
@@ -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.
  */
index 8a6b050d0c3bd1d1f36e3662cd343fee682fae9e..360fb38973caa473a282c4684db2907254aa2c4a 100644 (file)
@@ -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;