Skip to contentSkip to conversation

ARM: PRIMA2: rstc: Use helper function to read u32 values

PATCH New Barry Song 1 participant 1 message Sep 11, 2012

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v2 1/1 ARM: PRIMA2: rstc: Use helper function to read u32 values

From: Barry Song <[email protected]>

Use helper function of_property_read_u32() in place of of_get_property and be32_to_cpup() api's for code optimization.

---
-v2: add patch description

 arch/arm/mach-prima2/rstc.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-prima2/rstc.c +3 -6
index 762adb7..d03ff19 100644
@@ -42,13 +42,10 @@ early_initcall(sirfsoc_of_rstc_init);
 
 int sirfsoc_reset_device(struct device *dev)
 {
-	const unsigned int *prop = of_get_property(dev->of_node, "reset-bit", NULL);
-	unsigned int reset_bit;
+	u32 reset_bit;
 
-	if (!prop)
-		return -ENODEV;
-
-	reset_bit = be32_to_cpup(prop);
+	if (of_property_read_u32(dev->of_node, "reset-bit", &reset_bit))
+		return -EINVAL;
 
 	mutex_lock(&rstc_lock);
 
Signature · 6 lines
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog