* [PATCH RESEND] virtio/virtio-balloon: Prefer Object* over void* parameter
@ 2022-03-01 22:23 Bernhard Beschow
2022-03-01 22:23 ` [PATCH vRESEND] " Bernhard Beschow
2022-03-01 22:41 ` [PATCH RESEND] " Bernhard Beschow
0 siblings, 2 replies; 5+ messages in thread
From: Bernhard Beschow @ 2022-03-01 22:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Michael S. Tsirkin, Bernhard Beschow, David Hildenbrand
*opaque is an alias to *obj. Using the ladder makes the code consistent with
with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also
makes the cast more typesafe.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
hw/virtio/virtio-balloon.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index e6c1b0aa46..163d244eb4 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -242,7 +242,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
Error *err = NULL;
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
int i;
if (!visit_start_struct(v, name, NULL, 0, &err)) {
@@ -277,7 +277,7 @@ static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
visit_type_int(v, name, &s->stats_poll_interval, errp);
}
@@ -285,7 +285,7 @@ static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
int64_t value;
if (!visit_type_int(v, name, &value, errp)) {
@@ -1015,12 +1015,12 @@ static void virtio_balloon_instance_init(Object *obj)
s->free_page_hint_notify.notify = virtio_balloon_free_page_hint_notify;
object_property_add(obj, "guest-stats", "guest statistics",
- balloon_stats_get_all, NULL, NULL, s);
+ balloon_stats_get_all, NULL, NULL, NULL);
object_property_add(obj, "guest-stats-polling-interval", "int",
balloon_stats_get_poll_interval,
balloon_stats_set_poll_interval,
- NULL, s);
+ NULL, NULL);
}
static const VMStateDescription vmstate_virtio_balloon = {
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH vRESEND] virtio/virtio-balloon: Prefer Object* over void* parameter
2022-03-01 22:23 [PATCH RESEND] virtio/virtio-balloon: Prefer Object* over void* parameter Bernhard Beschow
@ 2022-03-01 22:23 ` Bernhard Beschow
2022-03-04 10:20 ` Michael S. Tsirkin
2022-03-01 22:41 ` [PATCH RESEND] " Bernhard Beschow
1 sibling, 1 reply; 5+ messages in thread
From: Bernhard Beschow @ 2022-03-01 22:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Michael S. Tsirkin, Bernhard Beschow, David Hildenbrand
*opaque is an alias to *obj. Using the ladder makes the code consistent with
with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also
makes the cast more typesafe.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
hw/virtio/virtio-balloon.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index e6c1b0aa46..163d244eb4 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -242,7 +242,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
Error *err = NULL;
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
int i;
if (!visit_start_struct(v, name, NULL, 0, &err)) {
@@ -277,7 +277,7 @@ static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
visit_type_int(v, name, &s->stats_poll_interval, errp);
}
@@ -285,7 +285,7 @@ static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- VirtIOBalloon *s = opaque;
+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
int64_t value;
if (!visit_type_int(v, name, &value, errp)) {
@@ -1015,12 +1015,12 @@ static void virtio_balloon_instance_init(Object *obj)
s->free_page_hint_notify.notify = virtio_balloon_free_page_hint_notify;
object_property_add(obj, "guest-stats", "guest statistics",
- balloon_stats_get_all, NULL, NULL, s);
+ balloon_stats_get_all, NULL, NULL, NULL);
object_property_add(obj, "guest-stats-polling-interval", "int",
balloon_stats_get_poll_interval,
balloon_stats_set_poll_interval,
- NULL, s);
+ NULL, NULL);
}
static const VMStateDescription vmstate_virtio_balloon = {
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] virtio/virtio-balloon: Prefer Object* over void* parameter
2022-03-01 22:23 [PATCH RESEND] virtio/virtio-balloon: Prefer Object* over void* parameter Bernhard Beschow
2022-03-01 22:23 ` [PATCH vRESEND] " Bernhard Beschow
@ 2022-03-01 22:41 ` Bernhard Beschow
1 sibling, 0 replies; 5+ messages in thread
From: Bernhard Beschow @ 2022-03-01 22:41 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Michael S. Tsirkin, David Hildenbrand
Am 1. März 2022 22:23:00 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>*opaque is an alias to *obj. Using the ladder makes the code consistent with
>with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also
>makes the cast more typesafe.
>
>Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>Reviewed-by: David Hildenbrand <david@redhat.com>
>---
> hw/virtio/virtio-balloon.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
>index e6c1b0aa46..163d244eb4 100644
>--- a/hw/virtio/virtio-balloon.c
>+++ b/hw/virtio/virtio-balloon.c
>@@ -242,7 +242,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
> void *opaque, Error **errp)
> {
> Error *err = NULL;
>- VirtIOBalloon *s = opaque;
>+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> int i;
>
> if (!visit_start_struct(v, name, NULL, 0, &err)) {
>@@ -277,7 +277,7 @@ static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
> const char *name, void *opaque,
> Error **errp)
> {
>- VirtIOBalloon *s = opaque;
>+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> visit_type_int(v, name, &s->stats_poll_interval, errp);
> }
>
>@@ -285,7 +285,7 @@ static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
> const char *name, void *opaque,
> Error **errp)
> {
>- VirtIOBalloon *s = opaque;
>+ VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> int64_t value;
>
> if (!visit_type_int(v, name, &value, errp)) {
>@@ -1015,12 +1015,12 @@ static void virtio_balloon_instance_init(Object *obj)
> s->free_page_hint_notify.notify = virtio_balloon_free_page_hint_notify;
>
> object_property_add(obj, "guest-stats", "guest statistics",
>- balloon_stats_get_all, NULL, NULL, s);
>+ balloon_stats_get_all, NULL, NULL, NULL);
>
> object_property_add(obj, "guest-stats-polling-interval", "int",
> balloon_stats_get_poll_interval,
> balloon_stats_set_poll_interval,
>- NULL, s);
>+ NULL, NULL);
> }
>
> static const VMStateDescription vmstate_virtio_balloon = {
No changes. Just also CC'ed to qemu-trivial.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH vRESEND] virtio/virtio-balloon: Prefer Object* over void* parameter
2022-03-01 22:23 ` [PATCH vRESEND] " Bernhard Beschow
@ 2022-03-04 10:20 ` Michael S. Tsirkin
2022-03-18 12:58 ` Laurent Vivier
0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2022-03-04 10:20 UTC (permalink / raw)
To: Bernhard Beschow; +Cc: qemu-trivial, qemu-devel, David Hildenbrand
On Tue, Mar 01, 2022 at 11:23:01PM +0100, Bernhard Beschow wrote:
> *opaque is an alias to *obj. Using the ladder makes the code consistent with
> with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also
> makes the cast more typesafe.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
trivial tree pls
> ---
> hw/virtio/virtio-balloon.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index e6c1b0aa46..163d244eb4 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -242,7 +242,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
> void *opaque, Error **errp)
> {
> Error *err = NULL;
> - VirtIOBalloon *s = opaque;
> + VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> int i;
>
> if (!visit_start_struct(v, name, NULL, 0, &err)) {
> @@ -277,7 +277,7 @@ static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
> const char *name, void *opaque,
> Error **errp)
> {
> - VirtIOBalloon *s = opaque;
> + VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> visit_type_int(v, name, &s->stats_poll_interval, errp);
> }
>
> @@ -285,7 +285,7 @@ static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
> const char *name, void *opaque,
> Error **errp)
> {
> - VirtIOBalloon *s = opaque;
> + VirtIOBalloon *s = VIRTIO_BALLOON(obj);
> int64_t value;
>
> if (!visit_type_int(v, name, &value, errp)) {
> @@ -1015,12 +1015,12 @@ static void virtio_balloon_instance_init(Object *obj)
> s->free_page_hint_notify.notify = virtio_balloon_free_page_hint_notify;
>
> object_property_add(obj, "guest-stats", "guest statistics",
> - balloon_stats_get_all, NULL, NULL, s);
> + balloon_stats_get_all, NULL, NULL, NULL);
>
> object_property_add(obj, "guest-stats-polling-interval", "int",
> balloon_stats_get_poll_interval,
> balloon_stats_set_poll_interval,
> - NULL, s);
> + NULL, NULL);
> }
>
> static const VMStateDescription vmstate_virtio_balloon = {
> --
> 2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH vRESEND] virtio/virtio-balloon: Prefer Object* over void* parameter
2022-03-04 10:20 ` Michael S. Tsirkin
@ 2022-03-18 12:58 ` Laurent Vivier
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2022-03-18 12:58 UTC (permalink / raw)
To: Michael S. Tsirkin, Bernhard Beschow
Cc: qemu-trivial, qemu-devel, David Hildenbrand
Le 04/03/2022 à 11:20, Michael S. Tsirkin a écrit :
> On Tue, Mar 01, 2022 at 11:23:01PM +0100, Bernhard Beschow wrote:
>> *opaque is an alias to *obj. Using the ladder makes the code consistent with
>> with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also
>> makes the cast more typesafe.
>>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> Reviewed-by: David Hildenbrand <david@redhat.com>
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> trivial tree pls
Applied to my trivial-patches branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-18 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 22:23 [PATCH RESEND] virtio/virtio-balloon: Prefer Object* over void* parameter Bernhard Beschow
2022-03-01 22:23 ` [PATCH vRESEND] " Bernhard Beschow
2022-03-04 10:20 ` Michael S. Tsirkin
2022-03-18 12:58 ` Laurent Vivier
2022-03-01 22:41 ` [PATCH RESEND] " Bernhard Beschow
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.