Revision e13e973e hw/usb-ccid.c

b/hw/usb-ccid.c
255 255
    MIGRATION_MIGRATED,
256 256
};
257 257

  
258
typedef struct CCIDBus CCIDBus;
259
typedef struct USBCCIDState USBCCIDState;
258
typedef struct CCIDBus {
259
    BusState qbus;
260
} CCIDBus;
260 261

  
261 262
#define MAX_PROTOCOL_SIZE   7
262 263

  
263 264
/*
264 265
 * powered - defaults to true, changed by PowerOn/PowerOff messages
265 266
 */
266
struct USBCCIDState {
267
typedef struct USBCCIDState {
267 268
    USBDevice dev;
268
    CCIDBus *bus;
269
    CCIDBus bus;
269 270
    CCIDCardState *card;
270 271
    CCIDCardInfo *cardinfo; /* caching the info pointer */
271 272
    BulkIn bulk_in_pending[BULK_IN_PENDING_NUM]; /* circular */
......
293 294
    uint8_t  powered;
294 295
    uint8_t  notify_slot_change;
295 296
    uint8_t  debug;
296
};
297
} USBCCIDState;
297 298

  
298 299
/*
299 300
 * CCID Spec chapter 4: CCID uses a standard device descriptor per Chapter 9,
......
1113 1114
    }
1114 1115
}
1115 1116

  
1116
struct CCIDBus {
1117
    BusState qbus;
1118
};
1119

  
1120 1117
static struct BusInfo ccid_bus_info = {
1121 1118
    .name = "ccid-bus",
1122 1119
    .size = sizeof(CCIDBus),
......
1127 1124
    }
1128 1125
};
1129 1126

  
1130
static CCIDBus *ccid_bus_new(DeviceState *dev)
1131
{
1132
    CCIDBus *bus;
1133

  
1134
    bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL));
1135
    bus->qbus.allow_hotplug = 1;
1136

  
1137
    return bus;
1138
}
1139

  
1140 1127
void ccid_card_send_apdu_to_guest(CCIDCardState *card,
1141 1128
                                  uint8_t *apdu, uint32_t len)
1142 1129
{
......
1276 1263
{
1277 1264
    USBCCIDState *s = DO_UPCAST(USBCCIDState, dev, dev);
1278 1265

  
1279
    s->bus = ccid_bus_new(&dev->qdev);
1266
    qbus_create_inplace(&s->bus.qbus, &ccid_bus_info, &dev->qdev, NULL);
1267
    s->bus.qbus.allow_hotplug = 1;
1280 1268
    s->card = NULL;
1281 1269
    s->cardinfo = NULL;
1282 1270
    s->migration_state = MIGRATION_NONE;

Also available in: Unified diff