mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
virtio-bus: remove vdev field
The vdev field is complicated to synchronize. Just access the BusState's list of children. Cc: qemu-stable@nongnu.org Acked-by: Andreas Faerber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
0b81c1ef5c
commit
06d3dff072
4 changed files with 57 additions and 35 deletions
|
@ -72,10 +72,6 @@ typedef struct VirtioBusClass {
|
|||
|
||||
struct VirtioBusState {
|
||||
BusState parent_obj;
|
||||
/*
|
||||
* Only one VirtIODevice can be plugged on the bus.
|
||||
*/
|
||||
VirtIODevice *vdev;
|
||||
};
|
||||
|
||||
int virtio_bus_plug_device(VirtIODevice *vdev);
|
||||
|
@ -98,4 +94,16 @@ void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config);
|
|||
/* Set config of the plugged device. */
|
||||
void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config);
|
||||
|
||||
static inline VirtIODevice *virtio_bus_get_device(VirtioBusState *bus)
|
||||
{
|
||||
BusState *qbus = &bus->parent_obj;
|
||||
BusChild *kid = QTAILQ_FIRST(&qbus->children);
|
||||
DeviceState *qdev = kid ? kid->child : NULL;
|
||||
|
||||
/* This is used on the data path, the cast is guaranteed
|
||||
* to succeed by the qdev machinery.
|
||||
*/
|
||||
return (VirtIODevice *)qdev;
|
||||
}
|
||||
|
||||
#endif /* VIRTIO_BUS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue