[PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()

Gavin Shan posted 31 patches 1 year ago
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Beniamino Galvani <b.galvani@gmail.com>, Strahinja Jankovic <strahinja.p.jankovic@gmail.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Niek Linnenbank <nieklinnenbank@gmail.com>, Radoslaw Biernacki <rad@semihalf.com>, Leif Lindholm <quic_llindhol@quicinc.com>, Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Laurent Vivier <laurent@vivier.eu>, Vijai Kumar K <vijai@behindbytes.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Brian Cain <bcain@quicinc.com>, Song Gao <gaosong@loongson.cn>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Huacai Chen <chenhuacai@kernel.org>, Stafford Horne <shorne@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Yoshinori Sato <ysato@users.sourceforge.jp>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
[PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by Gavin Shan 1 year ago
No need to check if @oc is abstract because it has been covered
by cpu_class_by_name().

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 target/hppa/cpu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 04de1689d7..fc4d2abad7 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -163,7 +163,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc = object_class_by_name(typename);
 
     if (oc &&
-        !object_class_is_abstract(oc) &&
         object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
         return oc;
     }
-- 
2.41.0
Re: [PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by Philippe Mathieu-Daudé 1 year ago
On 15/11/23 00:55, Gavin Shan wrote:
> No need to check if @oc is abstract because it has been covered
> by cpu_class_by_name().

Since commit 3a9d0d7b64 ("hw/cpu: Call object_class_is_abstract() once 
in cpu_class_by_name()") ...

> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>   target/hppa/cpu.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by BALATON Zoltan 1 year ago
On Wed, 15 Nov 2023, Gavin Shan wrote:
> No need to check if @oc is abstract because it has been covered
> by cpu_class_by_name().
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
> target/hppa/cpu.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index 04de1689d7..fc4d2abad7 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -163,7 +163,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
>     ObjectClass *oc = object_class_by_name(typename);
>
>     if (oc &&
> -        !object_class_is_abstract(oc) &&
>         object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {

Might as well remove the line break as the remaining expression fits in 80 
chars.

Regards,
BALATON Zoltan

>         return oc;
>     }
>
Re: [PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by Gavin Shan 1 year ago
On 11/15/23 21:18, BALATON Zoltan wrote:
> On Wed, 15 Nov 2023, Gavin Shan wrote:
>> No need to check if @oc is abstract because it has been covered
>> by cpu_class_by_name().
>>
>> Signed-off-by: Gavin Shan <gshan@redhat.com>
>> ---
>> target/hppa/cpu.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
>> index 04de1689d7..fc4d2abad7 100644
>> --- a/target/hppa/cpu.c
>> +++ b/target/hppa/cpu.c
>> @@ -163,7 +163,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
>>     ObjectClass *oc = object_class_by_name(typename);
>>
>>     if (oc &&
>> -        !object_class_is_abstract(oc) &&
>>         object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
> 
> Might as well remove the line break as the remaining expression fits in 80 chars.
> 

Yes, but the whole chunk of code will be removed in PATCH[03]. So I think
we needn't the extra effort to adjust the format in PATCH[02]?

Thaks,
Gavin

>>         return oc;
>>     }
>>
> 


Re: [PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by BALATON Zoltan 1 year ago
On Wed, 15 Nov 2023, Gavin Shan wrote:
> On 11/15/23 21:18, BALATON Zoltan wrote:
>> On Wed, 15 Nov 2023, Gavin Shan wrote:
>>> No need to check if @oc is abstract because it has been covered
>>> by cpu_class_by_name().
>>> 
>>> Signed-off-by: Gavin Shan <gshan@redhat.com>
>>> ---
>>> target/hppa/cpu.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
>>> index 04de1689d7..fc4d2abad7 100644
>>> --- a/target/hppa/cpu.c
>>> +++ b/target/hppa/cpu.c
>>> @@ -163,7 +163,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char 
>>> *cpu_model)
>>>     ObjectClass *oc = object_class_by_name(typename);
>>> 
>>>     if (oc &&
>>> -        !object_class_is_abstract(oc) &&
>>>         object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
>> 
>> Might as well remove the line break as the remaining expression fits in 80 
>> chars.
>> 
>
> Yes, but the whole chunk of code will be removed in PATCH[03]. So I think
> we needn't the extra effort to adjust the format in PATCH[02]?

Yes, if it's gone later then does not matter.

Regards,
BALATON Zoltan

> Thaks,
> Gavin
>
>>>         return oc;
>>>     }
>>> 
>> 
>
>
>
Re: [PATCH v5 02/31] target/hppa: Remove object_class_is_abstract()
Posted by Richard Henderson 1 year ago
On 11/14/23 15:55, Gavin Shan wrote:
> No need to check if @oc is abstract because it has been covered
> by cpu_class_by_name().
> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>   target/hppa/cpu.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index 04de1689d7..fc4d2abad7 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -163,7 +163,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
>       ObjectClass *oc = object_class_by_name(typename);
>   
>       if (oc &&
> -        !object_class_is_abstract(oc) &&
>           object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
>           return oc;
>       }