[PATCH 045/141] staging: unisys: memregion: Nothing uses overlap allocations, so nuke it

[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/visorutil/memregion.h       |  2 -
 .../staging/unisys/visorutil/memregion_direct.c    | 52 +++-------------------
 2 files changed, 7 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/unisys/visorutil/memregion.h b/drivers/staging/unisys/visorutil/memregion.h
index 0c3eebc..1eb3a67 100644
--- a/drivers/staging/unisys/visorutil/memregion.h
+++ b/drivers/staging/unisys/visorutil/memregion.h
@@ -26,8 +26,6 @@
 struct memregion;
 
 struct memregion *visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes);
-struct memregion *visor_memregion_create_overlapped(struct memregion *parent,
-						    ulong offset, ulong nbytes);
 int visor_memregion_resize(struct memregion *memregion, ulong newsize);
 int visor_memregion_read(struct memregion *memregion,
 			 ulong offset, void *dest, ulong nbytes);
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c
index 6bb439d..93c10b4 100644
--- a/drivers/staging/unisys/visorutil/memregion_direct.c
+++ b/drivers/staging/unisys/visorutil/memregion_direct.c
@@ -30,7 +30,6 @@ struct memregion {
 	ulong nbytes;
 	void __iomem *mapped;
 	BOOL requested;
-	BOOL overlapped;
 };
 
 static BOOL mapit(struct memregion *memregion);
@@ -48,7 +47,6 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes)
 
 	memregion->physaddr = physaddr;
 	memregion->nbytes = nbytes;
-	memregion->overlapped = FALSE;
 	if (!mapit(memregion)) {
 		rc = NULL;
 		goto cleanup;
@@ -63,35 +61,6 @@ cleanup:
 }
 EXPORT_SYMBOL_GPL(visor_memregion_create);
 
-struct memregion *
-visor_memregion_create_overlapped(struct memregion *parent, ulong offset,
-				  ulong nbytes)
-{
-	struct memregion *memregion = NULL;
-
-	if (parent == NULL)
-		return NULL;
-
-	if (parent->mapped == NULL)
-		return NULL;
-
-	if ((offset >= parent->nbytes) ||
-	    ((offset + nbytes) >= parent->nbytes))
-		return NULL;
-
-	memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY);
-	if (memregion == NULL)
-		return NULL;
-
-	memregion->physaddr = parent->physaddr + offset;
-	memregion->nbytes = nbytes;
-	memregion->mapped = ((u8 __iomem *)(parent->mapped)) + offset;
-	memregion->requested = FALSE;
-	memregion->overlapped = TRUE;
-	return memregion;
-}
-EXPORT_SYMBOL_GPL(visor_memregion_create_overlapped);
-
 static BOOL
 mapit(struct memregion *memregion)
 {
@@ -147,17 +116,12 @@ visor_memregion_resize(struct memregion *memregion, ulong newsize)
 {
 	if (newsize == memregion->nbytes)
 		return 0;
-	if (memregion->overlapped)
-		/* no error check here - we no longer know the
-		 * parent's range!
-		 */
-		memregion->nbytes = newsize;
-	else {
-		unmapit(memregion);
-		memregion->nbytes = newsize;
-		if (!mapit(memregion))
-			return -EIO;
-	}
+
+	unmapit(memregion);
+	memregion->nbytes = newsize;
+	if (!mapit(memregion))
+		return -EIO;
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(visor_memregion_resize);
@@ -199,9 +163,7 @@ visor_memregion_destroy(struct memregion *memregion)
 {
 	if (!memregion)
 		return;
-	if (!memregion->overlapped)
-		unmapit(memregion);
+	unmapit(memregion);
 	kfree(memregion);
 }
 EXPORT_SYMBOL_GPL(visor_memregion_destroy);
-
-- 
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