mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
usb: usb-mtp QOMify
Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
e81b13ad94
commit
7c03a899e6
@ -130,6 +130,9 @@ struct MTPState {
|
||||
QTAILQ_HEAD(, MTPObject) objects;
|
||||
};
|
||||
|
||||
#define TYPE_USB_MTP "usb-mtp"
|
||||
#define USB_MTP(obj) OBJECT_CHECK(MTPState, (obj), TYPE_USB_MTP)
|
||||
|
||||
#define QEMU_STORAGE_ID 0x00010001
|
||||
|
||||
#define MTP_FLAG_WRITABLE 0
|
||||
@ -878,7 +881,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
|
||||
|
||||
static void usb_mtp_handle_reset(USBDevice *dev)
|
||||
{
|
||||
MTPState *s = DO_UPCAST(MTPState, dev, dev);
|
||||
MTPState *s = USB_MTP(dev);
|
||||
|
||||
trace_usb_mtp_reset(s->dev.addr);
|
||||
|
||||
@ -914,7 +917,7 @@ static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p)
|
||||
|
||||
static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)
|
||||
{
|
||||
MTPState *s = DO_UPCAST(MTPState, dev, dev);
|
||||
MTPState *s = USB_MTP(dev);
|
||||
MTPControl cmd;
|
||||
mtp_container container;
|
||||
uint32_t params[5];
|
||||
@ -1062,7 +1065,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)
|
||||
|
||||
static void usb_mtp_realize(USBDevice *dev, Error **errp)
|
||||
{
|
||||
MTPState *s = DO_UPCAST(MTPState, dev, dev);
|
||||
MTPState *s = USB_MTP(dev);
|
||||
|
||||
usb_desc_create_serial(dev);
|
||||
usb_desc_init(dev);
|
||||
@ -1113,7 +1116,7 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static TypeInfo mtp_info = {
|
||||
.name = "usb-mtp",
|
||||
.name = TYPE_USB_MTP,
|
||||
.parent = TYPE_USB_DEVICE,
|
||||
.instance_size = sizeof(MTPState),
|
||||
.class_init = usb_mtp_class_initfn,
|
||||
|
Loading…
Reference in New Issue
Block a user