[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/66] failover: Remove primary_device_opts
From: |
Michael S. Tsirkin |
Subject: |
[PULL 25/66] failover: Remove primary_device_opts |
Date: |
Tue, 8 Dec 2020 14:34:55 -0500 |
From: Juan Quintela <quintela@redhat.com>
It was really only used once, in failover_add_primary(). Just search
for it on global opts when it is needed.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20201118083748.1328-11-quintela@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio-net.h | 1 -
hw/net/virtio-net.c | 21 +++++----------------
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index ca68be759f..7159e6c0a0 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -202,7 +202,6 @@ struct VirtIONet {
AnnounceTimer announce_timer;
bool needs_vnet_hdr_swap;
bool mtu_bypass_backend;
- QemuOpts *primary_device_opts;
QDict *primary_device_dict;
DeviceState *primary_dev;
char *primary_device_id;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index e334f05352..2a99b0e0f6 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -791,17 +791,17 @@ static inline uint64_t
virtio_net_supported_guest_offloads(VirtIONet *n)
static void failover_add_primary(VirtIONet *n, Error **errp)
{
Error *err = NULL;
+ QemuOpts *opts;
if (n->primary_dev) {
return;
}
- n->primary_device_opts = qemu_opts_find(qemu_find_opts("device"),
- n->primary_device_id);
- if (n->primary_device_opts) {
- n->primary_dev = qdev_device_add(n->primary_device_opts, &err);
+ opts = qemu_opts_find(qemu_find_opts("device"), n->primary_device_id);
+ if (opts) {
+ n->primary_dev = qdev_device_add(opts, &err);
if (err) {
- qemu_opts_del(n->primary_device_opts);
+ qemu_opts_del(opts);
}
} else {
error_setg(errp, "Primary device not found");
@@ -856,7 +856,6 @@ static DeviceState
*virtio_connect_failover_devices(VirtIONet *n, Error **errp)
prim_dev = virtio_net_find_primary(n, &err);
if (prim_dev) {
n->primary_device_id = g_strdup(prim_dev->id);
- n->primary_device_opts = prim_dev->opts;
} else {
error_propagate(errp, err);
}
@@ -3113,14 +3112,6 @@ static bool failover_replug_primary(VirtIONet *n, Error
**errp)
if (!pdev->partially_hotplugged) {
return true;
}
- if (!n->primary_device_opts) {
- n->primary_device_opts = qemu_opts_from_qdict(qemu_find_opts("device"),
- n->primary_device_dict,
- errp);
- if (!n->primary_device_opts) {
- return false;
- }
- }
primary_bus = n->primary_dev->parent_bus;
if (!primary_bus) {
error_setg(errp, "virtio_net: couldn't find primary bus");
@@ -3211,8 +3202,6 @@ static int
virtio_net_primary_should_be_hidden(DeviceListener *listener,
goto out;
}
- n->primary_device_opts = device_opts;
-
/* failover_primary_hidden is set during feature negotiation */
hide = qatomic_read(&n->failover_primary_hidden);
--
MST
- [PULL 10/66] hw/arm/virt: Write extra pci roots into fw_cfg, (continued)
- [PULL 10/66] hw/arm/virt: Write extra pci roots into fw_cfg, Michael S. Tsirkin, 2020/12/08
- [PULL 11/66] acpi: Extract crs build form acpi_build.c, Michael S. Tsirkin, 2020/12/08
- [PULL 12/66] acpi/gpex: Build tables for pxb, Michael S. Tsirkin, 2020/12/08
- [PULL 14/66] unit-test: The files changed., Michael S. Tsirkin, 2020/12/08
- [PULL 15/66] unit-test: Add testcase for pxb, Michael S. Tsirkin, 2020/12/08
- [PULL 13/66] acpi: Align the size to 128k, Michael S. Tsirkin, 2020/12/08
- [PULL 17/66] failover: fix indentantion, Michael S. Tsirkin, 2020/12/08
- [PULL 18/66] failover: Use always atomics for primary_should_be_hidden, Michael S. Tsirkin, 2020/12/08
- [PULL 22/66] failover: qdev_device_add() returns err or dev set, Michael S. Tsirkin, 2020/12/08
- [PULL 24/66] failover: g_strcmp0() knows how to handle NULL, Michael S. Tsirkin, 2020/12/08
- [PULL 25/66] failover: Remove primary_device_opts,
Michael S. Tsirkin <=
- [PULL 16/66] unit-test: Add the binary file and clear diff.h, Michael S. Tsirkin, 2020/12/08
- [PULL 19/66] failover: primary bus is only used once, and where it is set, Michael S. Tsirkin, 2020/12/08
- [PULL 21/66] failover: Remove external partially_hotplugged property, Michael S. Tsirkin, 2020/12/08
- [PULL 20/66] failover: Remove unused parameter, Michael S. Tsirkin, 2020/12/08
- [PULL 26/66] failover: remove standby_id variable, Michael S. Tsirkin, 2020/12/08
- [PULL 27/66] failover: Remove primary_device_dict, Michael S. Tsirkin, 2020/12/08
- [PULL 23/66] failover: Rename bool to failover_primary_hidden, Michael S. Tsirkin, 2020/12/08
- [PULL 29/66] failover: simplify virtio_net_find_primary(), Michael S. Tsirkin, 2020/12/08
- [PULL 28/66] failover: Remove memory leak, Michael S. Tsirkin, 2020/12/08
- [PULL 30/66] failover: should_be_hidden() should take a bool, Michael S. Tsirkin, 2020/12/08