[PATCH 3/5] adb: Switch bus reset to 3-phase-reset

Peter Maydell posted 5 patches 10 months, 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>
[PATCH 3/5] adb: Switch bus reset to 3-phase-reset
Posted by Peter Maydell 10 months, 1 week ago
Switch the ADB bus from using BusClass::reset to the Resettable
interface.

This has no behavioural change, because the BusClass code to support
subclasses that use the legacy BusClass::reset will call that method
in the hold phase of 3-phase reset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/input/adb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index 0f3c73d6d00..98f39b4281a 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -231,9 +231,9 @@ static const VMStateDescription vmstate_adb_bus = {
     }
 };
 
-static void adb_bus_reset(BusState *qbus)
+static void adb_bus_reset_hold(Object *obj)
 {
-    ADBBusState *adb_bus = ADB_BUS(qbus);
+    ADBBusState *adb_bus = ADB_BUS(obj);
 
     adb_bus->autopoll_enabled = false;
     adb_bus->autopoll_mask = 0xffff;
@@ -262,10 +262,11 @@ static void adb_bus_unrealize(BusState *qbus)
 static void adb_bus_class_init(ObjectClass *klass, void *data)
 {
     BusClass *k = BUS_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     k->realize = adb_bus_realize;
     k->unrealize = adb_bus_unrealize;
-    k->reset = adb_bus_reset;
+    rc->phases.hold = adb_bus_reset_hold;
 }
 
 static const TypeInfo adb_bus_type_info = {
-- 
2.34.1
Re: [PATCH 3/5] adb: Switch bus reset to 3-phase-reset
Posted by Zhao Liu 10 months ago
On Fri, Jan 19, 2024 at 04:35:10PM +0000, Peter Maydell wrote:
> Date: Fri, 19 Jan 2024 16:35:10 +0000
> From: Peter Maydell <peter.maydell@linaro.org>
> Subject: [PATCH 3/5] adb: Switch bus reset to 3-phase-reset
> X-Mailer: git-send-email 2.34.1
> 
> Switch the ADB bus from using BusClass::reset to the Resettable
> interface.
> 
> This has no behavioural change, because the BusClass code to support
> subclasses that use the legacy BusClass::reset will call that method
> in the hold phase of 3-phase reset.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/input/adb.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 0f3c73d6d00..98f39b4281a 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -231,9 +231,9 @@ static const VMStateDescription vmstate_adb_bus = {
>      }
>  };
>  
> -static void adb_bus_reset(BusState *qbus)
> +static void adb_bus_reset_hold(Object *obj)
>  {
> -    ADBBusState *adb_bus = ADB_BUS(qbus);
> +    ADBBusState *adb_bus = ADB_BUS(obj);
>  
>      adb_bus->autopoll_enabled = false;
>      adb_bus->autopoll_mask = 0xffff;
> @@ -262,10 +262,11 @@ static void adb_bus_unrealize(BusState *qbus)
>  static void adb_bus_class_init(ObjectClass *klass, void *data)
>  {
>      BusClass *k = BUS_CLASS(klass);
> +    ResettableClass *rc = RESETTABLE_CLASS(klass);
>  
>      k->realize = adb_bus_realize;
>      k->unrealize = adb_bus_unrealize;
> -    k->reset = adb_bus_reset;
> +    rc->phases.hold = adb_bus_reset_hold;
>  }
>  
>  static const TypeInfo adb_bus_type_info = {
> -- 
> 2.34.1
> 
>
Re: [PATCH 3/5] adb: Switch bus reset to 3-phase-reset
Posted by Mark Cave-Ayland 10 months ago
On 19/01/2024 16:35, Peter Maydell wrote:

> Switch the ADB bus from using BusClass::reset to the Resettable
> interface.
> 
> This has no behavioural change, because the BusClass code to support
> subclasses that use the legacy BusClass::reset will call that method
> in the hold phase of 3-phase reset.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/input/adb.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 0f3c73d6d00..98f39b4281a 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -231,9 +231,9 @@ static const VMStateDescription vmstate_adb_bus = {
>       }
>   };
>   
> -static void adb_bus_reset(BusState *qbus)
> +static void adb_bus_reset_hold(Object *obj)
>   {
> -    ADBBusState *adb_bus = ADB_BUS(qbus);
> +    ADBBusState *adb_bus = ADB_BUS(obj);
>   
>       adb_bus->autopoll_enabled = false;
>       adb_bus->autopoll_mask = 0xffff;
> @@ -262,10 +262,11 @@ static void adb_bus_unrealize(BusState *qbus)
>   static void adb_bus_class_init(ObjectClass *klass, void *data)
>   {
>       BusClass *k = BUS_CLASS(klass);
> +    ResettableClass *rc = RESETTABLE_CLASS(klass);
>   
>       k->realize = adb_bus_realize;
>       k->unrealize = adb_bus_unrealize;
> -    k->reset = adb_bus_reset;
> +    rc->phases.hold = adb_bus_reset_hold;
>   }
>   
>   static const TypeInfo adb_bus_type_info = {

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.