@@ -595,7 +595,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
static char *usb_get_dev_path(DeviceState *qdev)
{
USBDevice *dev = USB_DEVICE(qdev);
- DeviceState *hcd = qdev->parent_bus->parent;
+ DeviceState *hcd = qdev_get_parent_bus(qdev)->parent;
char *id = qdev_get_dev_path(hcd);
if (id) {
@@ -553,7 +553,7 @@ void usb_desc_set_string(USBDevice *dev, uint8_t index, const char *str)
*/
void usb_desc_create_serial(USBDevice *dev)
{
- DeviceState *hcd = dev->qdev.parent_bus->parent;
+ DeviceState *hcd = qdev_get_parent_bus(DEVICE(dev))->parent;
const USBDesc *desc = usb_device_get_usb_desc(dev);
int index = desc->id.iSerialNumber;
char *path, *serial;
@@ -1187,7 +1187,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
uint8_t *apdu, uint32_t len)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
Answer *answer;
@@ -1210,7 +1210,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
void ccid_card_card_removed(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
ccid_on_slot_change(s, false);
@@ -1221,7 +1221,7 @@ void ccid_card_card_removed(CCIDCardState *card)
int ccid_card_ccid_attach(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
DPRINTF(s, 1, "CCID Attach\n");
@@ -1231,7 +1231,7 @@ int ccid_card_ccid_attach(CCIDCardState *card)
void ccid_card_ccid_detach(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
DPRINTF(s, 1, "CCID Detach\n");
@@ -1244,7 +1244,7 @@ void ccid_card_ccid_detach(CCIDCardState *card)
void ccid_card_card_error(CCIDCardState *card, uint64_t error)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
s->bmCommandStatus = COMMAND_STATUS_FAILED;
@@ -1263,7 +1263,7 @@ void ccid_card_card_error(CCIDCardState *card, uint64_t error)
void ccid_card_card_inserted(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
s->bmCommandStatus = COMMAND_STATUS_NO_ERROR;
@@ -1275,7 +1275,7 @@ static void ccid_card_unrealize(DeviceState *qdev)
{
CCIDCardState *card = CCID_CARD(qdev);
CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
if (ccid_card_inserted(s)) {
@@ -1291,7 +1291,7 @@ static void ccid_card_realize(DeviceState *qdev, Error **errp)
{
CCIDCardState *card = CCID_CARD(qdev);
CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
- USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
+ USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
Error *local_err = NULL;
@@ -520,7 +520,7 @@ void usb_check_attach(USBDevice *dev, Error **errp);
static inline USBBus *usb_bus_from_device(USBDevice *d)
{
- return DO_UPCAST(USBBus, qbus, d->qdev.parent_bus);
+ return DO_UPCAST(USBBus, qbus, qdev_get_parent_bus(DEVICE(d)));
}
extern const VMStateDescription vmstate_usb_device;
DeviceState::parent_bus is an internal field and should be accessed by the qdev_get_parent_bus() helper. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/usb/bus.c | 2 +- hw/usb/desc.c | 2 +- hw/usb/dev-smartcard-reader.c | 16 ++++++++-------- include/hw/usb.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-)