Thread (24 messages) flat view 24 messages, 5 authors, 2014-08-01
STALE4422d

[PATCH 08/13] uio: uio_pruss: make the UIO SRAM memory region optional

From: Andre Heider <hidden>
Date: 2014-06-29 16:21:42
Also in: linux-devicetree, linux-omap
Subsystem: the rest, userspace i/o (uio) · Maintainers: Linus Torvalds, Greg Kroah-Hartman

Skip creating the UIO SRAM memory region if no SRAM genalloc has been
passed along. This will be the case for am33xx SoCs.

The order of the memory regions is not changed for already supported
platforms. That is to keep the current behavior for existing userland
drivers.

For am33x this gives one memory region less. This behavior is in line
with downstream patches and userland driver support for this SoC family.

Signed-off-by: Andre Heider <redacted>
---
 drivers/uio/uio_pruss.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 50ff206..afaf726 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -111,7 +111,7 @@ static int pruss_probe(struct platform_device *pdev)
 	struct uio_pruss_dev *gdev;
 	struct resource *regs_prussio;
 	struct device *dev = &pdev->dev;
-	int ret = -ENODEV, cnt = 0;
+	int ret = -ENODEV, cnt = 0, i;
 	struct uio_pruss_pdata *pdata = dev_get_platdata(dev);
 	dma_addr_t ddr_paddr;
 
@@ -160,17 +160,24 @@ static int pruss_probe(struct platform_device *pdev)
 	gdev->hostirq_start = platform_get_irq(pdev, 0);
 
 	for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) {
-		p->mem[0].addr = regs_prussio->start;
-		p->mem[0].size = resource_size(regs_prussio);
-		p->mem[0].memtype = UIO_MEM_PHYS;
-
-		p->mem[1].addr = gdev->sram_paddr;
-		p->mem[1].size = sram_pool_sz;
-		p->mem[1].memtype = UIO_MEM_PHYS;
+		i = 0;
+
+		p->mem[i].addr = regs_prussio->start;
+		p->mem[i].size = resource_size(regs_prussio);
+		p->mem[i].memtype = UIO_MEM_PHYS;
+		i++;
+
+		if (gdev->sram_vaddr) {
+			p->mem[i].addr = gdev->sram_paddr;
+			p->mem[i].size = sram_pool_sz;
+			p->mem[i].memtype = UIO_MEM_PHYS;
+			i++;
+		}
 
-		p->mem[2].addr = ddr_paddr;
-		p->mem[2].size = extram_pool_sz;
-		p->mem[2].memtype = UIO_MEM_PHYS;
+		p->mem[i].addr = ddr_paddr;
+		p->mem[i].size = extram_pool_sz;
+		p->mem[i].memtype = UIO_MEM_PHYS;
+		i++;
 
 		p->name = kasprintf(GFP_KERNEL, "pruss_evt%d", cnt);
 		p->version = DRV_VERSION;
-- 
2.0.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help