]> www.infradead.org Git - users/willy/linux.git/commitdiff
scsi: ncr53c8xx: Use slab instead of custom memory allocator
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)
There's no need to use __m_calloc for these data structures which
aren't shared with the device's processor.

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

index 03d70138ad58daffda6e3d211b0c41078d5b3c39..17edb18da40317d8392fa792170ceeed057c59b5 100644 (file)
@@ -373,7 +373,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
        m_addr_t vp;
        m_vtob_s *vbp;
 
-       vbp = __m_calloc(&mp0, sizeof(*vbp), "VTOB");
+       vbp = kzalloc(sizeof(*vbp), GFP_ATOMIC);
        if (vbp) {
                dma_addr_t daddr;
                vp = (m_addr_t) dma_alloc_coherent(mp->bush,
@@ -390,7 +390,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
                }
        }
        if (vbp)
-               __m_free(&mp0, vbp, sizeof(*vbp), "VTOB");
+               kfree(vbp);
        return 0;
 }
 
@@ -407,7 +407,7 @@ static void ___dma_freep(m_pool_s *mp, m_addr_t m)
                *vbpp = (*vbpp)->next;
                dma_free_coherent(mp->bush, PAGE_SIZE<<MEMO_PAGE_ORDER,
                                  (void *)vbp->vaddr, (dma_addr_t)vbp->baddr);
-               __m_free(&mp0, vbp, sizeof(*vbp), "VTOB");
+               kfree(vbp);
                --mp->nump;
        }
 }
@@ -422,9 +422,8 @@ static inline m_pool_s *___get_dma_pool(m_bush_t bush)
 static m_pool_s *___cre_dma_pool(m_bush_t bush)
 {
        m_pool_s *mp;
-       mp = __m_calloc(&mp0, sizeof(*mp), "MPOOL");
+       mp = kzalloc(sizeof(*mp), GFP_ATOMIC);
        if (mp) {
-               memset(mp, 0, sizeof(*mp));
                mp->bush = bush;
                mp->getp = ___dma_getp;
                mp->freep = ___dma_freep;
@@ -442,7 +441,7 @@ static void ___del_dma_pool(m_pool_s *p)
                pp = &(*pp)->next;
        if (*pp) {
                *pp = (*pp)->next;
-               __m_free(&mp0, p, sizeof(*p), "MPOOL");
+               kfree(p);
        }
 }