#include <pthread.h>
-#include "ui/console.h"
#include "maru_virtio_touchscreen.h"
#include "maru_device_ids.h"
#include "emul_state.h"
maru_virtio_touchscreen_notify();
}
-static int virtio_touchscreen_device_init(VirtIODevice *vdev)
+static void virtio_touchscreen_device_realize(DeviceState *dev, Error **errp)
{
- DeviceState *qdev = DEVICE(vdev);
- ts = VIRTIO_TOUCHSCREEN(vdev);
+ VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+ ts = VIRTIO_TOUCHSCREEN(dev);
INFO("initialize the touchscreen device\n");
// TODO: reduce size
ts->vq = virtio_add_queue(&ts->vdev, 64, maru_virtio_touchscreen_handle);
- ts->qdev = qdev;
+ ts->qdev = dev;
/* bottom halves */
ts->bh = qemu_bh_new(maru_touchscreen_bh, ts);
-
- return 0;
}
-static int virtio_touchscreen_device_exit(DeviceState *qdev)
+static void virtio_touchscreen_device_unrealize(DeviceState *dev, Error **errp)
{
- VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
+ VirtIODevice *vdev = VIRTIO_DEVICE(dev);
INFO("exit the touchscreen device\n");
pthread_mutex_destroy(&event_mutex);
pthread_mutex_destroy(&elem_mutex);
-
- return 0;
}
static Property virtio_touchscreen_properties[] = {
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
- dc->exit = virtio_touchscreen_device_exit;
+
dc->props = virtio_touchscreen_properties;
- vdc->init = virtio_touchscreen_device_init;
+ vdc->realize = virtio_touchscreen_device_realize;
+ vdc->unrealize = virtio_touchscreen_device_unrealize;
vdc->reset = virtio_touchscreen_device_reset;
vdc->get_config = virtio_touchscreen_get_config;
vdc->set_config = virtio_touchscreen_set_config;