Re: [U-Boot] [PATCH 31/51] fpga: altera: Make altera_validate return normal values

2014-09-22 Thread Pavel Machek
On Sun 2014-09-21 15:12:12, Marek Vasut wrote:
 Make the function return either 0 or -EINVAL, that is, normal
 expected error codes and success codes instead of true/false
 nonsense.
 
 Signed-off-by: Marek Vasut ma...@denx.de
 Cc: Chin Liang See cl...@altera.com
 Cc: Dinh Nguyen dingu...@altera.com
 Cc: Albert Aribaud albert.u.b...@aribaud.net
 Cc: Tom Rini tr...@ti.com
 Cc: Wolfgang Denk w...@denx.de

Acked-by: Pavel Machek pa...@denx.de

 @@ -133,7 +133,7 @@ int altera_info(Altera_desc *desc)
  {
   int ret_val = FPGA_FAIL;
  
 - if (!altera_validate (desc, (char *)__func__)) {
 + if (altera_validate (desc, (char *)__func__)) {
+   if (altera_validate(desc, (char *)__func__)) {

You have extra space there, checkpatch would be angry.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 31/51] fpga: altera: Make altera_validate return normal values

2014-09-22 Thread Marek Vasut
On Monday, September 22, 2014 at 11:16:04 AM, Pavel Machek wrote:
 On Sun 2014-09-21 15:12:12, Marek Vasut wrote:
  Make the function return either 0 or -EINVAL, that is, normal
  expected error codes and success codes instead of true/false
  nonsense.
  
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Chin Liang See cl...@altera.com
  Cc: Dinh Nguyen dingu...@altera.com
  Cc: Albert Aribaud albert.u.b...@aribaud.net
  Cc: Tom Rini tr...@ti.com
  Cc: Wolfgang Denk w...@denx.de
 
 Acked-by: Pavel Machek pa...@denx.de
 
  @@ -133,7 +133,7 @@ int altera_info(Altera_desc *desc)
  
   {
   
  int ret_val = FPGA_FAIL;
  
  -   if (!altera_validate (desc, (char *)__func__)) {
  +   if (altera_validate (desc, (char *)__func__)) {
 
 +   if (altera_validate(desc, (char *)__func__)) {
 
 You have extra space there, checkpatch would be angry.

I'm sure it will, but this was resolved somewhere down the patch stack. The 
final result doesn't have this warning.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 31/51] fpga: altera: Make altera_validate return normal values

2014-09-21 Thread Marek Vasut
Make the function return either 0 or -EINVAL, that is, normal
expected error codes and success codes instead of true/false
nonsense.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chin Liang See cl...@altera.com
Cc: Dinh Nguyen dingu...@altera.com
Cc: Albert Aribaud albert.u.b...@aribaud.net
Cc: Tom Rini tr...@ti.com
Cc: Wolfgang Denk w...@denx.de
Cc: Pavel Machek pa...@denx.de
---
 drivers/fpga/altera.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
index 9e9df50..941e7c8 100644
--- a/drivers/fpga/altera.c
+++ b/drivers/fpga/altera.c
@@ -12,38 +12,38 @@
  *  Altera FPGA support
  */
 #include common.h
+#include errno.h
 #include ACEX1K.h
 #include stratixII.h
 
 /* Define FPGA_DEBUG to 1 to get debug printf's */
 #define FPGA_DEBUG 0
 
-/* Local Static Functions */
 static int altera_validate(Altera_desc *desc, const char *fn)
 {
if (!desc) {
printf(%s: NULL descriptor!\n, fn);
-   return false;
+   return -EINVAL;
}
 
if ((desc-family  min_altera_type) ||
(desc-family  max_altera_type)) {
printf(%s: Invalid family type, %d\n, fn, desc-family);
-   return false;
+   return -EINVAL;
}
 
if ((desc-iface  min_altera_iface_type) ||
(desc-iface  max_altera_iface_type)) {
printf(%s: Invalid Interface type, %d\n, fn, desc-iface);
-   return false;
+   return -EINVAL;
}
 
if (!desc-size) {
printf(%s: NULL part size\n, fn);
-   return false;
+   return -EINVAL;
}
 
-   return true;
+   return 0;
 }
 
 /* - */
@@ -51,7 +51,7 @@ int altera_load(Altera_desc *desc, const void *buf, size_t 
bsize)
 {
int ret_val = FPGA_FAIL;/* assume a failure */
 
-   if (!altera_validate(desc, (char *)__func__)) {
+   if (altera_validate(desc, (char *)__func__)) {
printf(%s: Invalid device descriptor\n, __func__);
return FPGA_FAIL;
}
@@ -95,7 +95,7 @@ int altera_dump(Altera_desc *desc, const void *buf, size_t 
bsize)
 {
int ret_val = FPGA_FAIL;/* assume a failure */
 
-   if (!altera_validate (desc, (char *)__func__)) {
+   if (altera_validate(desc, (char *)__func__)) {
printf(%s: Invalid device descriptor\n, __func__);
return FPGA_FAIL;
}
@@ -133,7 +133,7 @@ int altera_info(Altera_desc *desc)
 {
int ret_val = FPGA_FAIL;
 
-   if (!altera_validate (desc, (char *)__func__)) {
+   if (altera_validate (desc, (char *)__func__)) {
printf(%s: Invalid device descriptor\n, __func__);
return FPGA_FAIL;
}
-- 
2.0.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot