Skip to contentSkip to conversation

ARM: PRIMA2: rstc: use of_property_read_u32 to replace of_get_property and be32_to_cpup

PATCH New Barry Song 3 participants 4 messages Aug 23, 2012 – Sep 11, 2012

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH 1/1 ARM: PRIMA2: rstc: use of_property_read_u32 to replace of_get_property and be32_to_cpup

From: Barry Song <[email protected]>

---
 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.0.4



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
#1 lore raw

PATCH 1/1 ARM: PRIMA2: rstc: use of_property_read_u32 to replace of_get_property and be32_to_cpup

2012/8/23 Barry Song <[email protected]>:

Quoted 3 lines

From: Barry Song <[email protected]>

Olof, would you apply this or you want me to send a pull request for it?

Quoted 26 lines
---
 arch/arm/mach-prima2/rstc.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-prima2/rstc.c +3 -7
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);
 
--
Quoted 2 lines

1.7.0.4

-barry

#2 lore raw

PATCH 1/1 ARM: PRIMA2: rstc: use of_property_read_u32 to replace of_get_property and be32_to_cpup

Quoted 6 lines · Barry Song

2012/8/23 Barry Song <[email protected]>:

Quoted 3 lines

From: Barry Song <[email protected]>

Olof, would you apply this or you want me to send a pull request for it?

I can apply it but it needs a patch description, at least a short sentence.

-Olof

Quoted 31 lines
Quoted 27 lines
---
 arch/arm/mach-prima2/rstc.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-prima2/rstc.c +3 -7
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);
 
--
Quoted 2 lines

1.7.0.4

-barry

#3 lore raw

PATCH 1/1 ARM: PRIMA2: rstc: use of_property_read_u32 to replace of_get_property and be32_to_cpup

2012/9/8 Olof Johansson <[email protected]>:

Quoted 9 lines · Barry Song
Quoted 6 lines

2012/8/23 Barry Song <[email protected]>:

Quoted 3 lines

From: Barry Song <[email protected]>

Olof, would you apply this or you want me to send a pull request for it?

I can apply it but it needs a patch description, at least a short sentence.

Thanks and done:
http://www.spinics.net/lists/arm-kernel/msg194041.html

Quoted 4 lines

-Olof

Quoted 1 line

-barry