usb: usb-uas QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gonglei 2015-05-06 20:55:33 +08:00 committed by Gerd Hoffmann
parent 79e2590cbf
commit 0b06d099b0

View File

@ -127,6 +127,9 @@ struct UASDevice {
USBPacket *status3[UAS_MAX_STREAMS + 1];
};
#define TYPE_USB_UAS "usb-uas"
#define USB_UAS(obj) OBJECT_CHECK(UASDevice, (obj), TYPE_USB_UAS)
struct UASRequest {
uint16_t tag;
uint64_t lun;
@ -626,7 +629,7 @@ static const struct SCSIBusInfo usb_uas_scsi_info = {
static void usb_uas_handle_reset(USBDevice *dev)
{
UASDevice *uas = DO_UPCAST(UASDevice, dev, dev);
UASDevice *uas = USB_UAS(dev);
UASRequest *req, *nreq;
UASStatus *st, *nst;
@ -655,7 +658,7 @@ static void usb_uas_handle_control(USBDevice *dev, USBPacket *p,
static void usb_uas_cancel_io(USBDevice *dev, USBPacket *p)
{
UASDevice *uas = DO_UPCAST(UASDevice, dev, dev);
UASDevice *uas = USB_UAS(dev);
UASRequest *req, *nreq;
int i;
@ -797,7 +800,7 @@ incorrect_lun:
static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
{
UASDevice *uas = DO_UPCAST(UASDevice, dev, dev);
UASDevice *uas = USB_UAS(dev);
uas_iu iu;
UASStatus *st;
UASRequest *req;
@ -888,14 +891,14 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
static void usb_uas_handle_destroy(USBDevice *dev)
{
UASDevice *uas = DO_UPCAST(UASDevice, dev, dev);
UASDevice *uas = USB_UAS(dev);
qemu_bh_delete(uas->status_bh);
}
static void usb_uas_realize(USBDevice *dev, Error **errp)
{
UASDevice *uas = DO_UPCAST(UASDevice, dev, dev);
UASDevice *uas = USB_UAS(dev);
usb_desc_create_serial(dev);
usb_desc_init(dev);
@ -943,7 +946,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo uas_info = {
.name = "usb-uas",
.name = TYPE_USB_UAS,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(UASDevice),
.class_init = usb_uas_class_initfn,