Message ID | 20190729145654.14644-3-damien.hedde@greensocs.com |
---|---|
State | New |
Headers | show |
Series | Multi-phase reset mechanism | expand |
On Mon, 29 Jul 2019 at 15:58, Damien Hedde <damien.hedde@greensocs.com> wrote: > > Provide a temporary function doing what device_reset does to do the > transition with Resettable API which will trigger a prototype change > of device_reset. The other point here is that device_legacy_reset() resets only that device, not any of its qbus children, right? So the new function which we eventually replace the callsites with also has different semantics, which is why we do the changes one by one in patches 10-28. So you could add: The new resettable API function also has different semantics (resetting child buses as well as the specified device). Subsequent commits will make the changeover for each callsite individually; once that is complete device_legacy_reset() will be removed. > Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> I agree with David that patch 3 could be squashed into this one. If you do that and tweak the commit message you can have Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
On 8/7/19 4:27 PM, Peter Maydell wrote: > On Mon, 29 Jul 2019 at 15:58, Damien Hedde <damien.hedde@greensocs.com> wrote: >> >> Provide a temporary function doing what device_reset does to do the >> transition with Resettable API which will trigger a prototype change >> of device_reset. > > The other point here is that device_legacy_reset() resets > only that device, not any of its qbus children, right? > So the new function which we eventually replace the callsites > with also has different semantics, which is why we do the > changes one by one in patches 10-28. Yes, for device_reset there is a change of scope. > > So you could add: > > The new resettable API function also has different semantics > (resetting child buses as well as the specified device). > Subsequent commits will make the changeover for each callsite > individually; once that is complete device_legacy_reset() will be > removed. sure > >> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> > > I agree with David that patch 3 could be squashed into this one. ok > > If you do that and tweak the commit message you can have > Reviewed-by: Peter Maydell <peter.maydell@linaro.org> > > thanks > -- PMM >
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 94ebc0a4a1..043e058396 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -256,7 +256,7 @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) static int qdev_reset_one(DeviceState *dev, void *opaque) { - device_reset(dev); + device_legacy_reset(dev); return 0; } @@ -864,7 +864,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } } if (dev->hotplugged) { - device_reset(dev); + device_legacy_reset(dev); } dev->pending_deleted_event = false; @@ -1086,7 +1086,7 @@ void device_class_set_parent_unrealize(DeviceClass *dc, dc->unrealize = dev_unrealize; } -void device_reset(DeviceState *dev) +void device_legacy_reset(DeviceState *dev) { DeviceClass *klass = DEVICE_GET_CLASS(dev); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e157fc4acd..690ce72433 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -407,11 +407,16 @@ char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev); void qdev_machine_init(void); /** - * @device_reset + * device_legacy_reset: * * Reset a single device (by calling the reset method). */ -void device_reset(DeviceState *dev); +void device_legacy_reset(DeviceState *dev); + +static inline void device_reset(DeviceState *dev) +{ + device_legacy_reset(dev); +} void device_class_set_parent_reset(DeviceClass *dc, DeviceReset dev_reset,
Provide a temporary function doing what device_reset does to do the transition with Resettable API which will trigger a prototype change of device_reset. Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> --- hw/core/qdev.c | 6 +++--- include/hw/qdev-core.h | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-)