linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/rtas: Replace magic values with defines
@ 2015-07-22 16:56 Thomas Huth
  2015-07-23  0:24 ` Tyrel Datwyler
  2015-08-03  1:35 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2015-07-22 16:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: benh, paulus, mpe

rtas.h already has some nice #defines for RTAS return status
codes - let's use them instead of hard-coded "magic" values!

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 arch/powerpc/kernel/rtas.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7a488c1..10fb402 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status)
 
 	if (status == RTAS_BUSY) {
 		ms = 1;
-	} else if (status >= 9900 && status <= 9905) {
-		order = status - 9900;
+	} else if (status >= RTAS_EXTENDED_DELAY_MIN &&
+		   status <= RTAS_EXTENDED_DELAY_MAX) {
+		order = status - RTAS_EXTENDED_DELAY_MIN;
 		for (ms = 1; order > 0; order--)
 			ms *= 10;
 	}
@@ -641,7 +642,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value)
 
 	rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
 
-	WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905));
+	WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
+				    rc <= RTAS_EXTENDED_DELAY_MAX));
 
 	if (rc < 0)
 		return rtas_error_rc(rc);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/rtas: Replace magic values with defines
  2015-07-22 16:56 [PATCH] powerpc/rtas: Replace magic values with defines Thomas Huth
@ 2015-07-23  0:24 ` Tyrel Datwyler
  2015-08-03  1:35 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Tyrel Datwyler @ 2015-07-23  0:24 UTC (permalink / raw)
  To: Thomas Huth, linuxppc-dev; +Cc: paulus

On 07/22/2015 09:56 AM, Thomas Huth wrote:
> rtas.h already has some nice #defines for RTAS return status
> codes - let's use them instead of hard-coded "magic" values!
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

> ---
>  arch/powerpc/kernel/rtas.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 7a488c1..10fb402 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status)
>  
>  	if (status == RTAS_BUSY) {
>  		ms = 1;
> -	} else if (status >= 9900 && status <= 9905) {
> -		order = status - 9900;
> +	} else if (status >= RTAS_EXTENDED_DELAY_MIN &&
> +		   status <= RTAS_EXTENDED_DELAY_MAX) {
> +		order = status - RTAS_EXTENDED_DELAY_MIN;
>  		for (ms = 1; order > 0; order--)
>  			ms *= 10;
>  	}
> @@ -641,7 +642,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value)
>  
>  	rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
>  
> -	WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905));
> +	WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
> +				    rc <= RTAS_EXTENDED_DELAY_MAX));
>  
>  	if (rc < 0)
>  		return rtas_error_rc(rc);
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc/rtas: Replace magic values with defines
  2015-07-22 16:56 [PATCH] powerpc/rtas: Replace magic values with defines Thomas Huth
  2015-07-23  0:24 ` Tyrel Datwyler
@ 2015-08-03  1:35 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2015-08-03  1:35 UTC (permalink / raw)
  To: Thomas Huth, linuxppc-dev; +Cc: paulus

On Wed, 2015-22-07 at 16:56:47 UTC, Thomas Huth wrote:
> rtas.h already has some nice #defines for RTAS return status
> codes - let's use them instead of hard-coded "magic" values!
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9ef03193a93553885b43

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-03  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 16:56 [PATCH] powerpc/rtas: Replace magic values with defines Thomas Huth
2015-07-23  0:24 ` Tyrel Datwyler
2015-08-03  1:35 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).