diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2024-09-13 15:31:44 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2024-09-13 15:31:44 +0100 |
commit | 134e0944f473c4d87a67f7e6ec70f0205a8e30c7 (patch) | |
tree | e03345b35b0f89420d191c1032e12c29aee4b1f1 /hw | |
parent | 349ecf61e8c9d5b4f21dab80b37733fe73be5cfe (diff) | |
download | qemu-134e0944f473c4d87a67f7e6ec70f0205a8e30c7.zip qemu-134e0944f473c4d87a67f7e6ec70f0205a8e30c7.tar.gz qemu-134e0944f473c4d87a67f7e6ec70f0205a8e30c7.tar.bz2 |
hw: Define new device_class_set_legacy_reset()
Define a device_class_set_legacy_reset() function which
sets the DeviceClass::reset field. This serves two purposes:
* it makes it clearer to the person writing code that
DeviceClass::reset is now legacy and they should look for
the new alternative (which is Resettable)
* it makes it easier to rename the reset field (which in turn
makes it easier to find places that call it)
The Coccinelle script can be used to automatically convert code that
was doing an open-coded assignment to DeviceClass::reset to call
device_class_set_legacy_reset() instead.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240830145812.1967042-7-peter.maydell@linaro.org
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/qdev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index cf81158..5182785 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -844,6 +844,11 @@ static void device_class_init(ObjectClass *class, void *data) offsetof(DeviceState, parent_bus), NULL, 0); } +void device_class_set_legacy_reset(DeviceClass *dc, DeviceReset dev_reset) +{ + dc->reset = dev_reset; +} + void device_class_set_parent_realize(DeviceClass *dc, DeviceRealize dev_realize, DeviceRealize *parent_realize) |