]> www.infradead.org Git - users/willy/linux.git/commitdiff
scsi: vmw_pvscsi: Use kmalloc instead of __get_free_pages
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 27 Sep 2020 20:29:13 +0000 (16:29 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 28 Sep 2020 13:27:36 +0000 (09:27 -0400)
Since v5.4, kmalloc has returned naturally aligned memory for power-of-two
allocations.  We do not need to allocate from a special allocator
any more.

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

index 081f54ab7d86cb2a076cc71284a76e8c134145e5..fac0de35fa29a590b4db7acefd91673a2cb2af86 100644 (file)
@@ -1206,7 +1206,7 @@ static void pvscsi_free_sgls(const struct pvscsi_adapter *adapter)
        unsigned i;
 
        for (i = 0; i < adapter->req_depth; ++i, ++ctx)
-               free_pages((unsigned long)ctx->sgl, get_order(SGL_SIZE));
+               kfree(ctx->sgl);
 }
 
 static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter)
@@ -1272,14 +1272,12 @@ static int pvscsi_allocate_sg(struct pvscsi_adapter *adapter)
        BUILD_BUG_ON(sizeof(struct pvscsi_sg_list) > SGL_SIZE);
 
        for (i = 0; i < adapter->req_depth; ++i, ++ctx) {
-               ctx->sgl = (void *)__get_free_pages(GFP_KERNEL,
-                                                   get_order(SGL_SIZE));
+               ctx->sgl = kmalloc(SGL_SIZE, GFP_KERNEL);
                ctx->sglPA = 0;
                BUG_ON(!IS_ALIGNED(((unsigned long)ctx->sgl), PAGE_SIZE));
                if (!ctx->sgl) {
                        for (; i >= 0; --i, --ctx) {
-                               free_pages((unsigned long)ctx->sgl,
-                                          get_order(SGL_SIZE));
+                               kfree(ctx->sgl);
                                ctx->sgl = NULL;
                        }
                        return -ENOMEM;