staging: unisys: visorchannel_clear(): No need to use vmalloc here
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:29 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:26:03 +0000 (15:26 +0200)
Using a page is sufficient, and avoids the cost of vmalloc/vfree

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorbus/visorchannel.c

index e555476be54d70e8e8f5e0d719249491abd1a3ae..1a1e7be6369cc5259ca9f99dbfaf09329b2823b2 100644 (file)
@@ -214,17 +214,18 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch,
                   ulong nbytes)
 {
        int err;
-       int bufsize = 65536;
+       int bufsize = PAGE_SIZE;
        int written = 0;
        u8 *buf;
 
-       buf = vmalloc(bufsize);
+       buf = (u8 *) __get_free_page(GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
        memset(buf, ch, bufsize);
+
        while (nbytes > 0) {
-               ulong thisbytes = bufsize;
+               int thisbytes = bufsize;
 
                if (nbytes < thisbytes)
                        thisbytes = nbytes;
@@ -239,7 +240,7 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch,
        err = 0;
 
 cleanup:
-       vfree(buf);
+       free_page((unsigned long) buf);
        return err;
 }
 EXPORT_SYMBOL_GPL(visorchannel_clear);