[PATCH 077/141] staging: unisys: visorchannel_write(): Use memcpy_toio() directly

Benjamin Romer benjamin.romer at unisys.com
Tue May 5 22:36:54 UTC 2015


From: Jes Sorensen <Jes.Sorensen at redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen at redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer at unisys.com>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index bf2f17a..bf75aa0 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -216,10 +216,15 @@ visorchannel_write(struct visorchannel *channel, ulong offset,
 {
 	size_t size = sizeof(struct channel_header);
 
+	if (offset + nbytes > channel->memregion.nbytes)
+		return -EIO;
+
 	if (!offset && nbytes >= size)
 		memcpy(&channel->chan_hdr, local, size);
-	return visor_memregion_write(&channel->memregion,
-				     offset, local, nbytes);
+
+	memcpy_toio(channel->memregion.mapped + offset, local, nbytes);
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(visorchannel_write);
 
-- 
2.1.4



More information about the devel mailing list