RE: [PATCH v4 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class

2025-06-08 Thread Duan, Zhenzhong


>-Original Message-
>From: Philippe Mathieu-Daudé 
>Subject: Re: [PATCH v4 4/5] hw/char/sh_serial: Remove dummy definition of
>SH_SERIAL class
>
>On 6/6/25 12:40, Philippe Mathieu-Daudé wrote:
>> On 6/6/25 11:24, Zhenzhong Duan wrote:
>>> SH_SERIAL is declared with OBJECT_DECLARE_SIMPLE_TYPE but defined with
>>> OBJECT_DEFINE_TYPE, SHSerialStateClass is also a dummy class which
>>> missed its parent.
>>>
>>> Change to use OBJECT_DEFINE_SIMPLE_TYPE and remove SHSerialStateClass.
>>>
>>> Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/
>>> msg00586.html
>>> Suggested-by: David Hildenbrand 
>>> Signed-off-by: Zhenzhong Duan 
>>> ---
>>>   hw/char/sh_serial.c | 4 +---
>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
>>> index 6abd80386f..8ccc2234ba 100644
>>> --- a/hw/char/sh_serial.c
>>> +++ b/hw/char/sh_serial.c
>>> @@ -78,9 +78,7 @@ struct SHSerialState {
>>>   qemu_irq bri;
>>>   };
>>> -typedef struct {} SHSerialStateClass;
>>> -
>>> -OBJECT_DEFINE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
>>> +OBJECT_DEFINE_SIMPLE_TYPE(SHSerialState, sh_serial, SH_SERIAL,
>>> SYS_BUS_DEVICE)
>>
>> I'm surprised this is the first time we use OBJECT_DEFINE_SIMPLE_TYPE.

Ah, yes.

>
>Actually I already posted a patch cleaning that...:
>
>https://lore.kernel.org/qemu-devel/20250124175053.74461-1-
>[email protected]/

Good to see.

>
>Also I now notice I never replied to Peter's questions. I'll and
>queue the series, along with yours.
Thanks.

BRs,
Zhenzhong


Re: [PATCH v4 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class

2025-06-06 Thread Philippe Mathieu-Daudé

On 6/6/25 12:40, Philippe Mathieu-Daudé wrote:

On 6/6/25 11:24, Zhenzhong Duan wrote:

SH_SERIAL is declared with OBJECT_DECLARE_SIMPLE_TYPE but defined with
OBJECT_DEFINE_TYPE, SHSerialStateClass is also a dummy class which
missed its parent.

Change to use OBJECT_DEFINE_SIMPLE_TYPE and remove SHSerialStateClass.

Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/ 
msg00586.html

Suggested-by: David Hildenbrand 
Signed-off-by: Zhenzhong Duan 
---
  hw/char/sh_serial.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 6abd80386f..8ccc2234ba 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -78,9 +78,7 @@ struct SHSerialState {
  qemu_irq bri;
  };
-typedef struct {} SHSerialStateClass;
-
-OBJECT_DEFINE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
+OBJECT_DEFINE_SIMPLE_TYPE(SHSerialState, sh_serial, SH_SERIAL, 
SYS_BUS_DEVICE)


I'm surprised this is the first time we use OBJECT_DEFINE_SIMPLE_TYPE.


Actually I already posted a patch cleaning that...:

https://lore.kernel.org/qemu-devel/[email protected]/

Also I now notice I never replied to Peter's questions. I'll and
queue the series, along with yours.

Regards,

Phil.



Re: [PATCH v4 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class

2025-06-06 Thread Philippe Mathieu-Daudé

On 6/6/25 11:24, Zhenzhong Duan wrote:

SH_SERIAL is declared with OBJECT_DECLARE_SIMPLE_TYPE but defined with
OBJECT_DEFINE_TYPE, SHSerialStateClass is also a dummy class which
missed its parent.

Change to use OBJECT_DEFINE_SIMPLE_TYPE and remove SHSerialStateClass.

Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/msg00586.html
Suggested-by: David Hildenbrand 
Signed-off-by: Zhenzhong Duan 
---
  hw/char/sh_serial.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 6abd80386f..8ccc2234ba 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -78,9 +78,7 @@ struct SHSerialState {
  qemu_irq bri;
  };
  
-typedef struct {} SHSerialStateClass;

-
-OBJECT_DEFINE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
+OBJECT_DEFINE_SIMPLE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)


I'm surprised this is the first time we use OBJECT_DEFINE_SIMPLE_TYPE.