]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: unisys: decouple visor_memregion_{read, write}()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:30 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:26:04 +0000 (15:26 +0200)
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/visorutil/memregion_direct.c

index 0ee7cb2fafd04da648804c42924b81cea5966dcf..96460d7fdf0a1b8c2989c7ffaec4097e25573222 100644 (file)
@@ -124,35 +124,27 @@ visor_memregion_resize(struct memregion *memregion, ulong newsize)
 }
 EXPORT_SYMBOL_GPL(visor_memregion_resize);
 
-static int
-memregion_readwrite(BOOL is_write,
-                   struct memregion *memregion, ulong offset,
-                   void *local, ulong nbytes)
+int
+visor_memregion_read(struct memregion *memregion, ulong offset, void *dest,
+                    ulong nbytes)
 {
        if (offset + nbytes > memregion->nbytes)
                return -EIO;
 
-       if (is_write)
-               memcpy_toio(memregion->mapped + offset, local, nbytes);
-       else
-               memcpy_fromio(local, memregion->mapped + offset, nbytes);
-
+       memcpy_fromio(dest, memregion->mapped + offset, nbytes);
        return 0;
 }
-
-int
-visor_memregion_read(struct memregion *memregion, ulong offset, void *dest,
-                    ulong nbytes)
-{
-       return memregion_readwrite(FALSE, memregion, offset, dest, nbytes);
-}
 EXPORT_SYMBOL_GPL(visor_memregion_read);
 
 int
 visor_memregion_write(struct memregion *memregion, ulong offset, void *src,
                      ulong nbytes)
 {
-       return memregion_readwrite(TRUE, memregion, offset, src, nbytes);
+       if (offset + nbytes > memregion->nbytes)
+               return -EIO;
+
+       memcpy_toio(memregion->mapped + offset, src, nbytes);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(visor_memregion_write);