[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] hw/timer/etraxfs_timer: Qdev'ify reset()
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 1/2] hw/timer/etraxfs_timer: Qdev'ify reset() |
Date: |
Sat, 1 May 2021 23:49:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 5/1/21 6:46 PM, Laurent Vivier wrote:
> 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
Eh... As a first step, I think we gain in removing the
qemu_register_reset() call.
It seems overkill to use the 3-state reset interface,
but if it is deprecated, then OK.
Thanks for reviewing,
Phil.