qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 03/12] isa: Provide set_state callback


From: Andreas Färber
Subject: Re: [Qemu-devel] [RFC v4 03/12] isa: Provide set_state callback
Date: Sun, 12 Jun 2011 13:46:02 +0200

Am 09.06.2011 um 16:53 schrieb Markus Armbruster:

Andreas Färber <address@hidden> writes:

To allow enabling/disabling present ISA devices without hotplug,
keep track of state and add a helper to avoid enabling twice.
Since the properties to be configured are defined at device level,
delegate the actual work to a callback function.

If no callback is supplied, the device can't be disabled.

Prepare VMSTATE_ISA_DEVICE for devices that support disabling.
Legacy devices never change their state and won't need this yet.

Cc: Gerd Hoffmann <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/hw.h      |   15 +++++++++++++++
hw/isa-bus.c |   29 +++++++++++++++++++++++++++++
hw/isa.h     |    4 ++++
3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 2765543..d258932 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c

+int isa_set_state(ISADevice *dev, bool enabled)
+{
+ ISADeviceInfo *info = DO_UPCAST(ISADeviceInfo, qdev, dev- >qdev.info);
+    int err;
+
+    if (dev->enabled == enabled) {
+        return 42;

Sorry, too clever.  Make it return 0 for the benefit of future
maintenance programmers.

Done.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]