nfc: Modify virtio device init/exit 17/19917/4
authorMunkyu Im <munkyu.im@samsung.com>
Wed, 23 Apr 2014 05:29:30 +0000 (14:29 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 23 Apr 2014 05:50:47 +0000 (22:50 -0700)
Applied for qemu 2.0

Change-Id: Ia2b15b1941574741cd4e44ec035c3f6f27f57e89
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/hw/maru_virtio_evdi.c
tizen/src/hw/maru_virtio_nfc.c

index 2df1fa32094b21028353526e63d0cb9e2297bca0..2158be3acad2b747b927fe0caf05de39499bb7c8 100644 (file)
@@ -224,7 +224,7 @@ static void virtio_evdi_realize(DeviceState *dev, Error **errp)
     vio_evdi = VIRTIO_EVDI(dev);
     if (vio_evdi == NULL) {
         ERR("failed to initialize evdi device\n");
-        return; //need any guide for return value
+        return;
     }
 
     INFO("initialize evdi device\n");
index 08c9a64a11f8b8d3f5e10353f5669de362023d57..e0dacd8574b65a562da684a39df1df2d56e31dea 100644 (file)
@@ -201,38 +201,36 @@ static void maru_nfc_bh(void *opaque)
     flush_nfc_recv_queue();
 }
 
-static int virtio_nfc_init(VirtIODevice* vdev)
+static void virtio_nfc_realize(VirtIODevice* dev, Error **errp)
 {
-    INFO("initialize nfc device\n");
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     vio_nfc = VIRTIO_NFC(vdev);
-
-    virtio_init(vdev, NFC_DEVICE_NAME, VIRTIO_ID_NFC, 0);
-
     if (vio_nfc == NULL) {
         ERR("failed to initialize nfc device\n");
-        return -1;
+        return;
     }
 
+    INFO("initialize nfc device\n");
+
+    virtio_init(vdev, NFC_DEVICE_NAME, VIRTIO_ID_NFC, 0);
+
     vio_nfc->rvq = virtio_add_queue(&vio_nfc->vdev, 256, virtio_nfc_recv);
     vio_nfc->svq = virtio_add_queue(&vio_nfc->vdev, 256, virtio_nfc_send);
 
     vio_nfc->bh = qemu_bh_new(maru_nfc_bh, vio_nfc);
-
-    return 0;
 }
 
-static int virtio_nfc_exit(DeviceState* dev)
+static void virtio_nfc_unrealize(DeviceState* dev, Error **errp)
 {
-    INFO("destroy nfc device\n");
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
 
+    INFO("destroy nfc device\n");
+
     if (vio_nfc->bh) {
         qemu_bh_delete(vio_nfc->bh);
     }
 
     virtio_cleanup(vdev);
-
-    return 0;
 }
 
 static void virtio_nfc_reset(VirtIODevice *vdev)
@@ -243,10 +241,9 @@ static void virtio_nfc_reset(VirtIODevice *vdev)
 
 static void virtio_nfc_class_init(ObjectClass *klass, void *data)
 {
-    DeviceClass *dc = DEVICE_CLASS(klass);
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
-    dc->exit = virtio_nfc_exit;
-    vdc->init = virtio_nfc_init;
+    vdc->realize = virtio_nfc_realize;
+    vdc->unrealize = virtio_nfc_unrealize;
     vdc->get_features = virtio_nfc_get_features;
     vdc->reset = virtio_nfc_reset;
 }