Skip to content

Commit

Permalink
auxbus: New aux_bus_realize(), pairing with aux_bus_init()
Browse files Browse the repository at this point in the history
aux_bus_init() encapsulates the creation of an aux-bus and its
aux-to-i2c-bridge device.

Create aux_bus_realize() to similarly encapsulate their realization.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-33-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Jun 15, 2020
1 parent dbe4070 commit b7a1b54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hw/display/xlnx_dp.c
Expand Up @@ -1266,7 +1266,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp)
DisplaySurface *surface;
struct audsettings as;

qdev_init_nofail(DEVICE(s->aux_bus->bridge));
aux_bus_realize(s->aux_bus);

qdev_init_nofail(DEVICE(s->dpcd));
aux_map_slave(AUX_SLAVE(s->dpcd), 0x0000);
Expand Down
5 changes: 5 additions & 0 deletions hw/misc/auxbus.c
Expand Up @@ -81,6 +81,11 @@ AUXBus *aux_bus_init(DeviceState *parent, const char *name)
return bus;
}

void aux_bus_realize(AUXBus *bus)
{
qdev_init_nofail(DEVICE(bus->bridge));
}

void aux_map_slave(AUXSlave *aux_dev, hwaddr addr)
{
DeviceState *dev = DEVICE(aux_dev);
Expand Down
7 changes: 7 additions & 0 deletions include/hw/misc/auxbus.h
Expand Up @@ -93,6 +93,13 @@ struct AUXSlave {
*/
AUXBus *aux_bus_init(DeviceState *parent, const char *name);

/**
* aux_bus_realize: Realize an AUX bus.
*
* @bus: The AUX bus.
*/
void aux_bus_realize(AUXBus *bus);

/*
* aux_request: Make a request on the bus.
*
Expand Down

0 comments on commit b7a1b54

Please sign in to comment.