# \[PATCH\] powerpc/pseries/dlpar: use rtas\_get\_sensor()

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), THE REST
- Maintainers: Madhavan Srinivasan, Linus Torvalds
- Status: LANDED (bfb0c9fcf587 · 2021-06-25 04:47)
- Landed in mainline as bfb0c9fcf587 on 2021-06-25.
- List: linuxppc-dev
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linuxppc-dev/2021/05/9522436/t

## \[PATCH\] powerpc/pseries/dlpar: use rtas\_get\_sensor()

- From: Nathan Lynch \<hidden\>
- Date: 2021-05-04 02:54:07 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/9522436.md

```text
Instead of making bare calls to get-sensor-state, use
rtas_get_sensor(), which correctly handles busy and extended delay
statuses.

Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
Signed-off-by: Nathan Lynch <redacted>
---
 arch/powerpc/platforms/pseries/dlpar.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 3ac70790ec7a..b1f01ac0c29e 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -289,8 +289,7 @@ int dlpar_acquire_drc(u32 drc_index)
 {
 	int dr_status, rc;
 
-	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
-		       DR_ENTITY_SENSE, drc_index);
+	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
 	if (rc || dr_status != DR_ENTITY_UNUSABLE)
 		return -1;
 
@@ -311,8 +310,7 @@ int dlpar_release_drc(u32 drc_index)
 {
 	int dr_status, rc;
 
-	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
-		       DR_ENTITY_SENSE, drc_index);
+	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
 	if (rc || dr_status != DR_ENTITY_PRESENT)
 		return -1;
 
@@ -333,8 +331,7 @@ int dlpar_unisolate_drc(u32 drc_index)
 {
 	int dr_status, rc;
 
-	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
-				DR_ENTITY_SENSE, drc_index);
+	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
 	if (rc || dr_status != DR_ENTITY_PRESENT)
 		return -1;
 
-- 
2.30.2

```

## Re: \[PATCH\] powerpc/pseries/dlpar: use rtas\_get\_sensor()

- From: Laurent Dufour \<hidden\>
- Date: 2021-05-04 12:43:06 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/9522470.md

```text
Le 04/05/2021 à 04:53, Nathan Lynch a écrit :
> Instead of making bare calls to get-sensor-state, use
> rtas_get_sensor(), which correctly handles busy and extended delay
> statuses.

Reviewed-by: Laurent Dufour <redacted>

> Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
> Signed-off-by: Nathan Lynch <redacted>
> ---
>   arch/powerpc/platforms/pseries/dlpar.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index 3ac70790ec7a..b1f01ac0c29e 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -289,8 +289,7 @@ int dlpar_acquire_drc(u32 drc_index)
>   {
>   	int dr_status, rc;
>   
> -	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
> -		       DR_ENTITY_SENSE, drc_index);
> +	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
>   	if (rc || dr_status != DR_ENTITY_UNUSABLE)
>   		return -1;
>   
> @@ -311,8 +310,7 @@ int dlpar_release_drc(u32 drc_index)
>   {
>   	int dr_status, rc;
>   
> -	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
> -		       DR_ENTITY_SENSE, drc_index);
> +	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
>   	if (rc || dr_status != DR_ENTITY_PRESENT)
>   		return -1;
>   
> @@ -333,8 +331,7 @@ int dlpar_unisolate_drc(u32 drc_index)
>   {
>   	int dr_status, rc;
>   
> -	rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
> -				DR_ENTITY_SENSE, drc_index);
> +	rc = rtas_get_sensor(DR_ENTITY_SENSE, drc_index, &dr_status);
>   	if (rc || dr_status != DR_ENTITY_PRESENT)
>   		return -1;
>   
>

```

## Re: \[PATCH\] powerpc/pseries/dlpar: use rtas\_get\_sensor()

- From: Michael Ellerman \<hidden\>
- Date: 2021-06-26 10:42:43 
- Message: https://ratatoskr.run/linuxppc-dev/2021/06/9523407.md

```text
On Mon, 3 May 2021 21:53:29 -0500, Nathan Lynch wrote:
> Instead of making bare calls to get-sensor-state, use
> rtas_get_sensor(), which correctly handles busy and extended delay
> statuses.

Applied to powerpc/next.

[1/1] powerpc/pseries/dlpar: use rtas_get_sensor()
      https://git.kernel.org/powerpc/c/bfb0c9fcf5870036e54081b28cae2af5f9ee7088

cheers
```
