[U-Boot] [PATCH 2/4] USB: ULPI: clean a mixup of return types

Igor Grinberg grinberg at compulab.co.il
Mon Dec 12 11:08:33 CET 2011


Clean a mixup between u32 and int as a return type
for functions returning error values.
Use int as it is native (and widely used) return type.

Signed-off-by: Igor Grinberg <grinberg at compulab.co.il>
---
 drivers/usb/ulpi/ulpi-viewport.c |    4 ++--
 drivers/usb/ulpi/ulpi.c          |    8 ++++----
 include/usb/ulpi.h               |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/ulpi/ulpi-viewport.c b/drivers/usb/ulpi/ulpi-viewport.c
index fa2e004..490fb0e 100644
--- a/drivers/usb/ulpi/ulpi-viewport.c
+++ b/drivers/usb/ulpi/ulpi-viewport.c
@@ -98,7 +98,7 @@ static int ulpi_request(u32 ulpi_viewport, u32 value)
 	return err;
 }
 
-u32 ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
+int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
 {
 	u32 val = ULPI_RWRUN | ULPI_RWCTRL | ((u32)reg << 16) | (value & 0xff);
 
@@ -107,7 +107,7 @@ u32 ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
 
 u32 ulpi_read(u32 ulpi_viewport, u8 *reg)
 {
-	u32 err;
+	int err;
 	u32 val = ULPI_RWRUN | ((u32)reg << 16);
 
 	err = ulpi_request(ulpi_viewport, val);
diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c
index 1371aa6..f3f293f 100644
--- a/drivers/usb/ulpi/ulpi.c
+++ b/drivers/usb/ulpi/ulpi.c
@@ -39,8 +39,8 @@ static struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
 
 static int ulpi_integrity_check(u32 ulpi_viewport)
 {
-	u32 err, val, tval = ULPI_TEST_VALUE;
-	int i;
+	u32 val, tval = ULPI_TEST_VALUE;
+	int err, i;
 
 	/* Use the 'special' test value to check all bits */
 	for (i = 0; i < 2; i++, tval <<= 1) {
@@ -171,7 +171,7 @@ int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode)
 
 int ulpi_suspend(u32 ulpi_viewport)
 {
-	u32 err;
+	int err;
 
 	err = ulpi_write(ulpi_viewport, &ulpi->function_ctrl_clear,
 			ULPI_FC_SUSPENDM);
@@ -214,7 +214,7 @@ int ulpi_reset_wait(u32) __attribute__((weak, alias("__ulpi_reset_wait")));
 
 int ulpi_reset(u32 ulpi_viewport)
 {
-	u32 err;
+	int err;
 
 	err = ulpi_write(ulpi_viewport,
 			&ulpi->function_ctrl_set, ULPI_FC_RESET);
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index dc78a59..802f077 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -108,7 +108,7 @@ int ulpi_reset(u32 ulpi_viewport);
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-u32 ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value);
+int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value);
 
 /*
  * Read the ULPI PHY register content via the viewport.
-- 
1.7.3.4



More information about the U-Boot mailing list