* [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp
@ 2017-04-19 18:21 Zihan Yang
2017-04-19 18:21 ` [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void Zihan Yang
2017-04-24 8:59 ` [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Cornelia Huck
0 siblings, 2 replies; 4+ messages in thread
From: Zihan Yang @ 2017-04-19 18:21 UTC (permalink / raw)
To: qemu-devel
Cc: Zihan Yang, Cornelia Huck, Christian Borntraeger, Alexander Graf,
Paolo Bonzini
Currently, the console_exit function in sclpconsole-lm.c and
sclpconsole.c does nothing, just remove them. Since there is
a NULL check on the DeviceClass exit callback as suggested by
Frederic Konrad, it should be safe to simply remove them.
Signed-off-by: Zihan Yang <tgnyang@gmail.com>
---
hw/char/sclpconsole-lm.c | 6 ------
hw/char/sclpconsole.c | 6 ------
include/hw/s390x/event-facility.h | 2 +-
3 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 07d6ebd..86ddda6 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -318,11 +318,6 @@ static int console_init(SCLPEvent *event)
return 0;
}
-static int console_exit(SCLPEvent *event)
-{
- return 0;
-}
-
static void console_reset(DeviceState *dev)
{
SCLPEvent *event = SCLP_EVENT(dev);
@@ -349,7 +344,6 @@ static void console_class_init(ObjectClass *klass, void *data)
dc->reset = console_reset;
dc->vmsd = &vmstate_sclplmconsole;
ec->init = console_init;
- ec->exit = console_exit;
ec->get_send_mask = send_mask;
ec->get_receive_mask = receive_mask;
ec->can_handle_event = can_handle_event;
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index b78f240..e916cac 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -246,11 +246,6 @@ static void console_reset(DeviceState *dev)
scon->notify = false;
}
-static int console_exit(SCLPEvent *event)
-{
- return 0;
-}
-
static Property console_properties[] = {
DEFINE_PROP_CHR("chardev", SCLPConsole, chr),
DEFINE_PROP_END_OF_LIST(),
@@ -265,7 +260,6 @@ static void console_class_init(ObjectClass *klass, void *data)
dc->reset = console_reset;
dc->vmsd = &vmstate_sclpconsole;
ec->init = console_init;
- ec->exit = console_exit;
ec->get_send_mask = send_mask;
ec->get_receive_mask = receive_mask;
ec->can_handle_event = can_handle_event;
diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
index def1bb0..1a32f3a 100644
--- a/include/hw/s390x/event-facility.h
+++ b/include/hw/s390x/event-facility.h
@@ -162,7 +162,7 @@ typedef struct SCLPEvent {
typedef struct SCLPEventClass {
DeviceClass parent_class;
int (*init)(SCLPEvent *event);
- int (*exit)(SCLPEvent *event);
+ void (*exit)(SCLPEvent *event);
/* get SCLP's send mask */
unsigned int (*get_send_mask)(void);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void
2017-04-19 18:21 [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Zihan Yang
@ 2017-04-19 18:21 ` Zihan Yang
2017-04-24 9:03 ` Cornelia Huck
2017-04-24 8:59 ` [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Cornelia Huck
1 sibling, 1 reply; 4+ messages in thread
From: Zihan Yang @ 2017-04-19 18:21 UTC (permalink / raw)
To: qemu-devel
Cc: Zihan Yang, Richard Henderson, Alexander Graf, Cornelia Huck,
Christian Borntraeger, Michael S. Tsirkin
Note that only the virtio_ccw_exit, which is the exit function
of VirtIOCCWDeviceClass, is modified to return void in this patch.
'virtio_ccw_busdev_exit' belongs to DeviceClass so it remains
unchanged for the moment to give a split-out patch, because
modifying it would involve some other folders like hw/audio.
Signed-off-by: Zihan Yang <tgnyang@gmail.com>
---
hw/s390x/event-facility.c | 6 +-----
hw/s390x/virtio-ccw.c | 6 +++---
hw/s390x/virtio-ccw.h | 2 +-
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index 34b2faf..f7c509c 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -413,11 +413,7 @@ static void event_unrealize(DeviceState *qdev, Error **errp)
SCLPEvent *event = SCLP_EVENT(qdev);
SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event);
if (child->exit) {
- int rc = child->exit(event);
- if (rc < 0) {
- error_setg(errp, "SCLP event exit failed.");
- return;
- }
+ child->exit(event);
}
}
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 00b3bde..0dbd3ee 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -722,7 +722,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
}
}
-static int virtio_ccw_exit(VirtioCcwDevice *dev)
+static void virtio_ccw_exit(VirtioCcwDevice *dev)
{
CcwDevice *ccw_dev = CCW_DEVICE(dev);
SubchDev *sch = ccw_dev->sch;
@@ -735,7 +735,6 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev)
release_indicator(&dev->routes.adapter, dev->indicators);
dev->indicators = NULL;
}
- return 0;
}
static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
@@ -1621,7 +1620,8 @@ static int virtio_ccw_busdev_exit(DeviceState *dev)
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
- return _info->exit(_dev);
+ _info->exit(_dev);
+ return 0; /* TODO workaround, should remove once converted to unrealize */
}
static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 41d4010..ce8baa3 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -74,7 +74,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice;
typedef struct VirtIOCCWDeviceClass {
CCWDeviceClass parent_class;
void (*realize)(VirtioCcwDevice *dev, Error **errp);
- int (*exit)(VirtioCcwDevice *dev);
+ void (*exit)(VirtioCcwDevice *dev);
} VirtIOCCWDeviceClass;
/* Performance improves when virtqueue kick processing is decoupled from the
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp
2017-04-19 18:21 [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Zihan Yang
2017-04-19 18:21 ` [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void Zihan Yang
@ 2017-04-24 8:59 ` Cornelia Huck
1 sibling, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2017-04-24 8:59 UTC (permalink / raw)
To: Zihan Yang
Cc: qemu-devel, Christian Borntraeger, Alexander Graf, Paolo Bonzini
On Thu, 20 Apr 2017 02:21:29 +0800
Zihan Yang <tgnyang@gmail.com> wrote:
> Currently, the console_exit function in sclpconsole-lm.c and
> sclpconsole.c does nothing, just remove them. Since there is
> a NULL check on the DeviceClass exit callback as suggested by
> Frederic Konrad, it should be safe to simply remove them.
Something strange happened to the commit message (leading whitespace).
You should also mention that you convert the callback to void.
>
> Signed-off-by: Zihan Yang <tgnyang@gmail.com>
> ---
> hw/char/sclpconsole-lm.c | 6 ------
> hw/char/sclpconsole.c | 6 ------
> include/hw/s390x/event-facility.h | 2 +-
> 3 files changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
> index 07d6ebd..86ddda6 100644
> --- a/hw/char/sclpconsole-lm.c
> +++ b/hw/char/sclpconsole-lm.c
> @@ -318,11 +318,6 @@ static int console_init(SCLPEvent *event)
> return 0;
> }
>
> -static int console_exit(SCLPEvent *event)
> -{
> - return 0;
> -}
> -
> static void console_reset(DeviceState *dev)
> {
> SCLPEvent *event = SCLP_EVENT(dev);
> @@ -349,7 +344,6 @@ static void console_class_init(ObjectClass *klass, void *data)
> dc->reset = console_reset;
> dc->vmsd = &vmstate_sclplmconsole;
> ec->init = console_init;
> - ec->exit = console_exit;
> ec->get_send_mask = send_mask;
> ec->get_receive_mask = receive_mask;
> ec->can_handle_event = can_handle_event;
> diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
> index b78f240..e916cac 100644
> --- a/hw/char/sclpconsole.c
> +++ b/hw/char/sclpconsole.c
> @@ -246,11 +246,6 @@ static void console_reset(DeviceState *dev)
> scon->notify = false;
> }
>
> -static int console_exit(SCLPEvent *event)
> -{
> - return 0;
> -}
> -
> static Property console_properties[] = {
> DEFINE_PROP_CHR("chardev", SCLPConsole, chr),
> DEFINE_PROP_END_OF_LIST(),
> @@ -265,7 +260,6 @@ static void console_class_init(ObjectClass *klass, void *data)
> dc->reset = console_reset;
> dc->vmsd = &vmstate_sclpconsole;
> ec->init = console_init;
> - ec->exit = console_exit;
> ec->get_send_mask = send_mask;
> ec->get_receive_mask = receive_mask;
> ec->can_handle_event = can_handle_event;
> diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
> index def1bb0..1a32f3a 100644
> --- a/include/hw/s390x/event-facility.h
> +++ b/include/hw/s390x/event-facility.h
> @@ -162,7 +162,7 @@ typedef struct SCLPEvent {
> typedef struct SCLPEventClass {
> DeviceClass parent_class;
> int (*init)(SCLPEvent *event);
> - int (*exit)(SCLPEvent *event);
> + void (*exit)(SCLPEvent *event);
>
> /* get SCLP's send mask */
> unsigned int (*get_send_mask)(void);
You missed one:
/home/cohuck/git/qemu/hw/s390x/event-facility.c: In function ‘event_unrealize’:
/home/cohuck/git/qemu/hw/s390x/event-facility.c:416:18: error: void value not ignored as it ought to be
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void
2017-04-19 18:21 ` [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void Zihan Yang
@ 2017-04-24 9:03 ` Cornelia Huck
0 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2017-04-24 9:03 UTC (permalink / raw)
To: Zihan Yang
Cc: qemu-devel, Richard Henderson, Alexander Graf,
Christian Borntraeger, Michael S. Tsirkin
On Thu, 20 Apr 2017 02:21:30 +0800
Zihan Yang <tgnyang@gmail.com> wrote:
> Note that only the virtio_ccw_exit, which is the exit function
> of VirtIOCCWDeviceClass, is modified to return void in this patch.
> 'virtio_ccw_busdev_exit' belongs to DeviceClass so it remains
> unchanged for the moment to give a split-out patch, because
> modifying it would involve some other folders like hw/audio.
Change the last sentence to "DeviceClass::exit will be converted to
void in another patch" or so.
Also, the same leading whitespace as in your previous patch.
>
> Signed-off-by: Zihan Yang <tgnyang@gmail.com>
> ---
> hw/s390x/event-facility.c | 6 +-----
> hw/s390x/virtio-ccw.c | 6 +++---
> hw/s390x/virtio-ccw.h | 2 +-
> 3 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
> index 34b2faf..f7c509c 100644
> --- a/hw/s390x/event-facility.c
> +++ b/hw/s390x/event-facility.c
> @@ -413,11 +413,7 @@ static void event_unrealize(DeviceState *qdev, Error **errp)
> SCLPEvent *event = SCLP_EVENT(qdev);
> SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event);
> if (child->exit) {
> - int rc = child->exit(event);
> - if (rc < 0) {
> - error_setg(errp, "SCLP event exit failed.");
> - return;
> - }
> + child->exit(event);
> }
> }
Ah, here's the hunk that should have been in the previous patch.
>
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 00b3bde..0dbd3ee 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -722,7 +722,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
> }
> }
>
> -static int virtio_ccw_exit(VirtioCcwDevice *dev)
> +static void virtio_ccw_exit(VirtioCcwDevice *dev)
> {
> CcwDevice *ccw_dev = CCW_DEVICE(dev);
> SubchDev *sch = ccw_dev->sch;
> @@ -735,7 +735,6 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev)
> release_indicator(&dev->routes.adapter, dev->indicators);
> dev->indicators = NULL;
> }
> - return 0;
> }
>
> static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
> @@ -1621,7 +1620,8 @@ static int virtio_ccw_busdev_exit(DeviceState *dev)
> VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
> VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
>
> - return _info->exit(_dev);
> + _info->exit(_dev);
> + return 0; /* TODO workaround, should remove once converted to unrealize */
I find that comment a bit confusing - just omit it?
> }
>
> static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
> diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
> index 41d4010..ce8baa3 100644
> --- a/hw/s390x/virtio-ccw.h
> +++ b/hw/s390x/virtio-ccw.h
> @@ -74,7 +74,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice;
> typedef struct VirtIOCCWDeviceClass {
> CCWDeviceClass parent_class;
> void (*realize)(VirtioCcwDevice *dev, Error **errp);
> - int (*exit)(VirtioCcwDevice *dev);
> + void (*exit)(VirtioCcwDevice *dev);
> } VirtIOCCWDeviceClass;
>
> /* Performance improves when virtqueue kick processing is decoupled from the
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-24 9:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-19 18:21 [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Zihan Yang
2017-04-19 18:21 ` [Qemu-devel] [PATCH 2/2] hw/s390x: make virtio_ccw_exit function in virtio-ccw return void Zihan Yang
2017-04-24 9:03 ` Cornelia Huck
2017-04-24 8:59 ` [Qemu-devel] [PATCH 1/2] hw/char: remove console_exit function in sclp Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).