[PATCH 074/141] staging: unisys: memregion: Eliminate visor_memregion_resize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visorbus/visorchannel.c      | 17 +++++++++++++++--
 drivers/staging/unisys/visorutil/memregion.h        |  1 -
 drivers/staging/unisys/visorutil/memregion_direct.c | 16 ----------------
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 42fabea..cfbb19f 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -89,9 +89,22 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
 	if (uuid_le_cmp(guid, NULL_UUID_LE) == 0)
 		guid = channel->chan_hdr.chtype;
 
-	err = visor_memregion_resize(&channel->memregion, channel_bytes);
-	if (err)
+	iounmap(channel->memregion.mapped);
+	release_mem_region(channel->memregion.physaddr,
+			   channel->memregion.nbytes);
+	channel->memregion.mapped = NULL;
+	if (!request_mem_region(channel->memregion.physaddr, channel_bytes,
+				MYDRVNAME))
+		goto cleanup;
+
+	channel->memregion.mapped = ioremap_cache(channel->memregion.physaddr,
+						  channel_bytes);
+	if (!channel->memregion.mapped) {
+		release_mem_region(channel->memregion.physaddr, channel_bytes);
 		goto cleanup;
+	}
+
+	channel->memregion.nbytes = channel_bytes;
 
 	channel->size = channel_bytes;
 	channel->guid = guid;
diff --git a/drivers/staging/unisys/visorutil/memregion.h b/drivers/staging/unisys/visorutil/memregion.h
index 60d0dc9..57d617f 100644
--- a/drivers/staging/unisys/visorutil/memregion.h
+++ b/drivers/staging/unisys/visorutil/memregion.h
@@ -29,7 +29,6 @@ struct memregion {
 	void __iomem *mapped;
 };
 
-int visor_memregion_resize(struct memregion *memregion, ulong newsize);
 int visor_memregion_read(struct memregion *memregion,
 			 ulong offset, void *dest, ulong nbytes);
 int visor_memregion_write(struct memregion *memregion,
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c
index 79ef4c5..fa7a406 100644
--- a/drivers/staging/unisys/visorutil/memregion_direct.c
+++ b/drivers/staging/unisys/visorutil/memregion_direct.c
@@ -77,22 +77,6 @@ visor_memregion_get_pointer(struct memregion *memregion)
 EXPORT_SYMBOL_GPL(visor_memregion_get_pointer);
 
 int
-visor_memregion_resize(struct memregion *memregion, ulong newsize)
-{
-	int rc;
-
-	if (newsize == memregion->nbytes)
-		return 0;
-
-	unmapit(memregion);
-	memregion->nbytes = newsize;
-	rc = mapit(memregion);
-
-	return rc;
-}
-EXPORT_SYMBOL_GPL(visor_memregion_resize);
-
-int
 visor_memregion_read(struct memregion *memregion, ulong offset, void *dest,
 		     ulong nbytes)
 {
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux