Skip to contentSkip to conversation

ARM: imx: Use PTR_ERR_OR_ZERO in platform-mxc_rnga.c

PATCH New Sachin Kamat 3 participants 8 messages May 29, 2014 – Jun 2, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 ARM: imx: Use PTR_ERR_OR_ZERO in platform-mxc_rnga.c

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/devices/platform-mxc_rnga.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/devices/platform-mxc_rnga.c +2 -4
index c58404badb59..33d58ca2001a 100644
@@ -6,6 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
+#include <linux/err.h>
 #include "../hardware.h"
 #include "devices-common.h"
 
@@ -48,9 +49,6 @@ static int __init imxXX_add_mxc_rnga(void)
 #endif /* if defined(CONFIG_SOC_IMX31) */
 		ret = ERR_PTR(-ENODEV);
 
-	if (IS_ERR(ret))
-		return PTR_ERR(ret);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(ret);
 }
 arch_initcall(imxXX_add_mxc_rnga);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/5 ARM: imx: Use PTR_ERR_OR_ZERO in mach-mx31moboard.c

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/mach-mx31moboard.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-imx/mach-mx31moboard.c +1 -3
index 6bed57040973..bb6f8a52a6b8 100644
@@ -435,10 +435,8 @@ static int __init moboard_usbh2_init(void)
 		return -ENODEV;
 
 	pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 
 static const struct gpio_led mx31moboard_leds[] __initconst = {
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/5 ARM: imx: Use PTR_ERR_OR_ZERO in mx31moboard-devboard.c

In reply to Sachin Kamat

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/mx31moboard-devboard.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-imx/mx31moboard-devboard.c +2 -3
index 1e4ea1640a2a..a85377f52647 100644
@@ -12,6 +12,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -214,10 +215,8 @@ static int __init devboard_usbh1_init(void)
 	usbh1_pdata.otg = phy;
 
 	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 
 
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 4/5 ARM: imx: Use PTR_ERR_OR_ZERO in mx31moboard-marxbot.c

In reply to Sachin Kamat

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/mx31moboard-marxbot.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-imx/mx31moboard-marxbot.c +2 -3
index 699d01a4fef8..2e62192394c1 100644
@@ -13,6 +13,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -328,10 +329,8 @@ static int __init marxbot_usbh1_init(void)
 	usbh1_pdata.otg = phy;
 
 	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 
 static const struct fsl_usb2_platform_data usb_pdata __initconst = {
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 5/5 ARM: imx: Use PTR_ERR_OR_ZERO in mx31moboard-smartbot.c

In reply to Sachin Kamat

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/mx31moboard-smartbot.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-imx/mx31moboard-smartbot.c +2 -3
index 4b3d66eb8d34..b73a4b36e040 100644
@@ -13,6 +13,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -142,10 +143,8 @@ static int __init smartbot_otg_host_init(void)
 		return -ENODEV;
 
 	pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 #else
 static inline int smartbot_otg_host_init(void) { return 0; }
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 1/5 ARM: imx: Use PTR_ERR_OR_ZERO in platform-mxc_rnga.c

In reply to Sachin Kamat
Quoted 20 lines · Sachin Kamat

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/devices/platform-mxc_rnga.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/devices/platform-mxc_rnga.c +1 -0
index c58404badb59..33d58ca2001a 100644
@@ -6,6 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
+#include <linux/err.h>
 #include "../hardware.h"
 #include "devices-common.h"
 

arch/arm/mach-imx/devices/platform-mxc_rnga.c static int __init imxXX_add_mxc_rnga(void) · line 52

Quoted 8 lines
arch/arm/mach-imx/devices/platform-mxc_rnga.c +1 -4
@@ -48,9 +49,6 @@ static int __init imxXX_add_mxc_rnga(void)
 #endif /* if defined(CONFIG_SOC_IMX31) */
 		ret = ERR_PTR(-ENODEV);
 
-	if (IS_ERR(ret))
-		return PTR_ERR(ret);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(ret);

The existing code looks just fine and actually more readable to me. Also, all the files you are patching will eventually be killed by DT support. So let's just leave it there as it is for now.

Shawn

Quoted 5 lines
arch/arm/mach-imx/devices/platform-mxc_rnga.c +0 -0
 }
 arch_initcall(imxXX_add_mxc_rnga);
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 1/5 ARM: imx: Use PTR_ERR_OR_ZERO in platform-mxc_rnga.c

Quoted 24 lines · Shawn Guo
Quoted 23 lines · Sachin Kamat

PTR_ERR_OR_ZERO simplifies the code.

---
 arch/arm/mach-imx/devices/platform-mxc_rnga.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/devices/platform-mxc_rnga.c +1 -0
index c58404badb59..33d58ca2001a 100644
@@ -6,6 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
+#include <linux/err.h>
 #include "../hardware.h"
 #include "devices-common.h"
 
@@ -48,9 +49,6 @@ static int __init imxXX_add_mxc_rnga(void)
 #endif /* if defined(CONFIG_SOC_IMX31) */
              ret = ERR_PTR(-ENODEV);
 
Quoted 9 lines

arch/arm/mach-imx/devices/platform-mxc_rnga.c static int __init imxXX_add_mxc_rnga(void) · line 52

Quoted 5 lines
arch/arm/mach-imx/devices/platform-mxc_rnga.c +1 -4
-     if (IS_ERR(ret))
-             return PTR_ERR(ret);
-
-     return 0;
+     return PTR_ERR_OR_ZERO(ret);

The existing code looks just fine and actually more readable to me. Also, all the files you are patching will eventually be killed by DT support. So let's just leave it there as it is for now.

If these files are meant to go, then we can leave these changes out. Thanks Shawn.

Signature · 2 lines
With warm regards,
Sachin
#7 lore raw

PATCH 1/5 ARM: imx: Use PTR_ERR_OR_ZERO in platform-mxc_rnga.c

In reply to Shawn Guo

Le 29/05/2014 10:03, Shawn Guo a ?crit :

Quoted 7 lines · Sachin Kamat
Quoted 6 lines

PTR_ERR_OR_ZERO simplifies the code.

arch/arm/mach-imx/devices/platform-mxc_rnga.c | 6 ++---- 1 file
changed, 2 insertions(+), 4 deletions(-)

Quoted 7 lines
Quoted 3 lines
(quoted diff) +0 -0

b/arch/arm/mach-imx/devices/platform-mxc_rnga.c index [...]

The existing code looks just fine and actually more readable to me. Also, all the files you are patching will eventually be killed by DT support. So let's just leave it there as it is for now.

heh ... well ... not so fast please !
There is a non-negligible amount of work to have a fully functional imx31 on DT.

Not working:
- USB (chipidea driver sort of works, but the PHY is a complete mess).
- Camera
- SPI hardware chip select support
- pinmux support is totally absent

Currently, on imx31 we can boot on DT with (and only if the bootloader does the pinmux for you):
- SDMA
- Watchdog
- SDHC
- Timer
- Uart

And I did not even had a look at the i2c, EMI, LCD and sound support.

So I hope imx31 platform boards can stay until the situation gets better.

Thanks,

Philippe