diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2015-05-05 18:36:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-08 15:26:04 +0200 |
commit | 213e6a61328689f9106758487a2fefb69d074c6f (patch) | |
tree | 4a4cd8bc787fa63947a0d53946206906cc6702b6 /drivers/staging | |
parent | c37df5f0a0e31b1609fd931f8605f4b675d504d3 (diff) |
staging: unisys: decouple visor_memregion_{read, write}()
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/unisys/visorutil/memregion_direct.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 0ee7cb2fafd0..96460d7fdf0a 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -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); |