All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 1/2] hw/timer/etraxfs_timer: Qdev'ify reset()
Date: Sat, 1 May 2021 18:46:23 +0200	[thread overview]
Message-ID: <cb232237-3fa9-c170-2bde-941a6193b90b@vivier.eu> (raw)
In-Reply-To: <20210423233652.3042941-2-f4bug@amsat.org>

Le 24/04/2021 à 01:36, Philippe Mathieu-Daudé a écrit :
> TYPE_ETRAX_FS_TIMER is a sysbus device, so its DeviceClass::reset()
> handler is called automatically when its qbus parent is reset.
> Convert the generic reset to a qdev one, and remove the
> qemu_register_reset() call.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/timer/etraxfs_timer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
> index 5379006086f..3cfab3e3284 100644
> --- a/hw/timer/etraxfs_timer.c
> +++ b/hw/timer/etraxfs_timer.c
> @@ -309,9 +309,9 @@ static const MemoryRegionOps timer_ops = {
>      }
>  };
>  
> -static void etraxfs_timer_reset(void *opaque)
> +static void etraxfs_timer_reset(DeviceState *dev)
>  {
> -    ETRAXTimerState *t = opaque;
> +    ETRAXTimerState *t = ETRAX_TIMER(dev);
>  
>      ptimer_transaction_begin(t->ptimer_t0);
>      ptimer_stop(t->ptimer_t0);
> @@ -343,7 +343,6 @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
>      memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
>                            "etraxfs-timer", 0x5c);
>      sysbus_init_mmio(sbd, &t->mmio);
> -    qemu_register_reset(etraxfs_timer_reset, t);
>  }
>  
>  static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
> @@ -351,6 +350,7 @@ static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->realize = etraxfs_timer_realize;
> +    dc->reset = etraxfs_timer_reset;
>  }
>  
>  static const TypeInfo etraxfs_timer_info = {
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

But according to the comment in DeviceClass, we should use the resettable interface now:

docs/devel/reset.rst

Thanks,
Laurent


  reply	other threads:[~2021-05-01 16:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 23:36 [PATCH 0/2] hw: Qdev'ify reset() for mc146818rtc & etraxfs_timer Philippe Mathieu-Daudé
2021-04-23 23:36 ` [PATCH 1/2] hw/timer/etraxfs_timer: Qdev'ify reset() Philippe Mathieu-Daudé
2021-05-01 16:46   ` Laurent Vivier [this message]
2021-05-01 21:49     ` Philippe Mathieu-Daudé
2021-04-23 23:36 ` [PATCH 2/2] hw/rtc/mc146818rtc: " Philippe Mathieu-Daudé
2021-05-01 10:17 ` [PATCH 0/2] hw: Qdev'ify reset() for mc146818rtc & etraxfs_timer Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb232237-3fa9-c170-2bde-941a6193b90b@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=edgar.iglesias@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.