Thread (1 message) 1 message, 1 author, 2015-07-13
DORMANTno replies

[PATCH 2/3] hwspinlock: sirf: fix the memory base and move to devm_ioremap

From: Barry Song <hidden>
Date: 2015-07-13 09:28:49
Also in: linux-devicetree
Subsystem: hardware spinlock core, the rest · Maintainers: Bjorn Andersson, Linus Torvalds

From: Wei Chen <redacted>

this patch moves to the right base since we fix the dts, then
we can use devm_ioremap now.

Cc: Suman Anna <redacted>
Cc: Bjorn Andersson <redacted>
Signed-off-by: Wei Chen <redacted>
Signed-off-by: Barry Song <redacted>
---
 drivers/hwspinlock/sirf_hwspinlock.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/hwspinlock/sirf_hwspinlock.c b/drivers/hwspinlock/sirf_hwspinlock.c
index 1601854..692ac41 100644
--- a/drivers/hwspinlock/sirf_hwspinlock.c
+++ b/drivers/hwspinlock/sirf_hwspinlock.c
@@ -29,7 +29,7 @@ struct sirf_hwspinlock {
 #define	HW_SPINLOCK_NUMBER	30
 
 /* Hardware spinlock register offsets */
-#define HW_SPINLOCK_BASE	0x404
+#define HW_SPINLOCK_BASE	0x04
 #define HW_SPINLOCK_OFFSET(x)	(HW_SPINLOCK_BASE + 0x4 * (x))
 
 static int sirf_hwspinlock_trylock(struct hwspinlock *lock)
@@ -57,6 +57,7 @@ static int sirf_hwspinlock_probe(struct platform_device *pdev)
 {
 	struct sirf_hwspinlock *hwspin;
 	struct hwspinlock *hwlock;
+	struct resource *res;
 	int idx, ret;
 
 	if (!pdev->dev.of_node)
@@ -68,7 +69,8 @@ static int sirf_hwspinlock_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* retrieve io base */
-	hwspin->io_base = of_iomap(pdev->dev.of_node, 0);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	hwspin->io_base = devm_ioremap_resource(&pdev->dev, res);
 	if (!hwspin->io_base)
 		return -ENOMEM;
 
@@ -91,7 +93,6 @@ static int sirf_hwspinlock_probe(struct platform_device *pdev)
 
 reg_failed:
 	pm_runtime_disable(&pdev->dev);
-	iounmap(hwspin->io_base);
 
 	return ret;
 }
@@ -109,8 +110,6 @@ static int sirf_hwspinlock_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 
-	iounmap(hwspin->io_base);
-
 	return 0;
 }
 
-- 
2.3.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help