Bluetooth: Add BT LE discovery feature
[platform/kernel/linux-rpi.git] / net / vmw_vsock / virtio_transport.c
index 4f7c99d..c5f936f 100644 (file)
@@ -24,6 +24,7 @@
 static struct workqueue_struct *virtio_vsock_workqueue;
 static struct virtio_vsock __rcu *the_virtio_vsock;
 static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
+static struct virtio_transport virtio_transport; /* forward declaration */
 
 struct virtio_vsock {
        struct virtio_device *vdev;
@@ -384,7 +385,8 @@ static void virtio_vsock_event_handle(struct virtio_vsock *vsock,
        switch (le32_to_cpu(event->id)) {
        case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
                virtio_vsock_update_guest_cid(vsock);
-               vsock_for_each_connected_socket(virtio_vsock_reset_sock);
+               vsock_for_each_connected_socket(&virtio_transport.transport,
+                                               virtio_vsock_reset_sock);
                break;
        }
 }
@@ -620,6 +622,13 @@ static int virtio_vsock_probe(struct virtio_device *vdev)
        INIT_WORK(&vsock->event_work, virtio_transport_event_work);
        INIT_WORK(&vsock->send_pkt_work, virtio_transport_send_pkt_work);
 
+       if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET))
+               vsock->seqpacket_allow = true;
+
+       vdev->priv = vsock;
+
+       virtio_device_ready(vdev);
+
        mutex_lock(&vsock->tx_lock);
        vsock->tx_run = true;
        mutex_unlock(&vsock->tx_lock);
@@ -634,10 +643,6 @@ static int virtio_vsock_probe(struct virtio_device *vdev)
        vsock->event_run = true;
        mutex_unlock(&vsock->event_lock);
 
-       if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET))
-               vsock->seqpacket_allow = true;
-
-       vdev->priv = vsock;
        rcu_assign_pointer(the_virtio_vsock, vsock);
 
        mutex_unlock(&the_virtio_vsock_mutex);
@@ -662,7 +667,8 @@ static void virtio_vsock_remove(struct virtio_device *vdev)
        synchronize_rcu();
 
        /* Reset all connected sockets when the device disappear */
-       vsock_for_each_connected_socket(virtio_vsock_reset_sock);
+       vsock_for_each_connected_socket(&virtio_transport.transport,
+                                       virtio_vsock_reset_sock);
 
        /* Stop all work handlers to make sure no one is accessing the device,
         * so we can safely call vdev->config->reset().