diff mbox series

[v5,32/36] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers

Message ID 20181116105729.23240-33-clg@kaod.org
State New
Headers show
Series ppc: support for the XIVE interrupt controller (POWER9) | expand

Commit Message

Cédric Le Goater Nov. 16, 2018, 10:57 a.m. UTC
Removing RTAS handlers will become necessary when the new pseries
machine supporting multiple interrupt mode is introduced.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/spapr_rtas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gibson Nov. 29, 2018, 4:12 a.m. UTC | #1
On Fri, Nov 16, 2018 at 11:57:25AM +0100, Cédric Le Goater wrote:
> Removing RTAS handlers will become necessary when the new pseries
> machine supporting multiple interrupt mode is introduced.

I'd prefer this to be done as a separate spapr_rtas_unregister()
helper, just to improve greppability.

> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/ppc/spapr_rtas.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index d6a0952154ac..e005d5d08151 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -404,7 +404,7 @@ void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
>  
>      token -= RTAS_TOKEN_BASE;
>  
> -    assert(!rtas_table[token].name);
> +    assert(!name || !rtas_table[token].name);
>  
>      rtas_table[token].name = name;
>      rtas_table[token].fn = fn;
Cédric Le Goater Nov. 29, 2018, 4:40 p.m. UTC | #2
On 11/29/18 5:12 AM, David Gibson wrote:
> On Fri, Nov 16, 2018 at 11:57:25AM +0100, Cédric Le Goater wrote:
>> Removing RTAS handlers will become necessary when the new pseries
>> machine supporting multiple interrupt mode is introduced.
> 
> I'd prefer this to be done as a separate spapr_rtas_unregister()
> helper, just to improve greppability.

ok. I should propose an inline :

static inline void spapr_rtas_unregister(int token) 
{ 
	spapr_rtas_register(token, NULL, NULL); 
}
  
> 
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  hw/ppc/spapr_rtas.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
>> index d6a0952154ac..e005d5d08151 100644
>> --- a/hw/ppc/spapr_rtas.c
>> +++ b/hw/ppc/spapr_rtas.c
>> @@ -404,7 +404,7 @@ void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
>>  
>>      token -= RTAS_TOKEN_BASE;
>>  
>> -    assert(!rtas_table[token].name);
>> +    assert(!name || !rtas_table[token].name);
>>  
>>      rtas_table[token].name = name;
>>      rtas_table[token].fn = fn;
>
David Gibson Nov. 29, 2018, 10:44 p.m. UTC | #3
On Thu, Nov 29, 2018 at 05:40:18PM +0100, Cédric Le Goater wrote:
> On 11/29/18 5:12 AM, David Gibson wrote:
> > On Fri, Nov 16, 2018 at 11:57:25AM +0100, Cédric Le Goater wrote:
> >> Removing RTAS handlers will become necessary when the new pseries
> >> machine supporting multiple interrupt mode is introduced.
> > 
> > I'd prefer this to be done as a separate spapr_rtas_unregister()
> > helper, just to improve greppability.
> 
> ok. I should propose an inline :
> 
> static inline void spapr_rtas_unregister(int token) 
> { 
> 	spapr_rtas_register(token, NULL, NULL); 
> }

Fair enough.

>   
> > 
> >>
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >>  hw/ppc/spapr_rtas.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> >> index d6a0952154ac..e005d5d08151 100644
> >> --- a/hw/ppc/spapr_rtas.c
> >> +++ b/hw/ppc/spapr_rtas.c
> >> @@ -404,7 +404,7 @@ void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
> >>  
> >>      token -= RTAS_TOKEN_BASE;
> >>  
> >> -    assert(!rtas_table[token].name);
> >> +    assert(!name || !rtas_table[token].name);
> >>  
> >>      rtas_table[token].name = name;
> >>      rtas_table[token].fn = fn;
> > 
>
diff mbox series

Patch

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index d6a0952154ac..e005d5d08151 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -404,7 +404,7 @@  void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
 
     token -= RTAS_TOKEN_BASE;
 
-    assert(!rtas_table[token].name);
+    assert(!name || !rtas_table[token].name);
 
     rtas_table[token].name = name;
     rtas_table[token].fn = fn;