void remove_common(struct virtio_balloon *vb)
> return_free_pages_to_mm(vb, ULONG_MAX);
>
> /* Now we reset the device so we can clean up the queues. */
> - vb->vdev->config->reset(vb->vdev);
> + virtio_reset_device(vb->vdev);
>
> vb->vdev->config->del_vqs(vb->vdev);
> }
> diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
> index ce51ae165943..3aa46703872d 100644
> --- a/drivers/virtio/virtio_input.c
> +++ b/drivers/virtio/virtio_input.c
> @@ -347,7 +347,7 @@ static void virtinput_remove(struct virtio_device *vdev)
> spin_unlock_irqrestore(&vi->lock, flags);
>
> input_unregister_device(vi->idev);
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
> while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
> kfree(buf);
> vdev->config->del_vqs(vdev);
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index bef8ad6bf466..3bab0a625a4b 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -2722,7 +2722,7 @@ static void virtio_mem_remove(struct virtio_device
> *vdev)
> }
>
> /* reset the device and cleanup the queues */
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
> vdev->config->del_vqs(vdev);
>
> kfree(vm);
> diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
> index 0ad89c6629d7..27c3b74070a2 100644
> --- a/fs/fuse/virtio_fs.c
> +++ b/fs/fuse/virtio_fs.c
> @@ -895,7 +895,7 @@ static int virtio_fs_probe(struct virtio_device *vdev)
> return 0;
>
> out_vqs:
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
> virtio_fs_cleanup_vqs(vdev, fs);
> kfree(fs->vqs);
>
> @@ -927,7 +927,7 @@ static void virtio_fs_remove(struct virtio_device *vdev)
> list_del_init(&fs->list);
> virtio_fs_stop_all_queues(fs);
> virtio_fs_drain_all_queues_locked(fs);
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
> virtio_fs_cleanup_vqs(vdev, fs);
>
> vdev->priv = NULL;
> diff --git a/include/linux/virtio.h b/include/linux/virtio.h
> index 41edbc01ffa4..72292a62cd90 100644
> --- a/include/linux/virtio.h
> +++ b/include/linux/virtio.h
> @@ -138,6 +138,7 @@ int virtio_finalize_features(struct virtio_device *dev);
> int virtio_device_freeze(struct virtio_device *dev);
> int virtio_device_restore(struct virtio_device *dev);
> #endif
> +void virtio_reset_device(struct virtio_device *dev);
>
> size_t virtio_max_dma_size(struct virtio_device *vdev);
>
> diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
> index 490a4c900339..19c69821dd04 100644
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -721,7 +721,7 @@ static void p9_virtio_remove(struct virtio_device *vdev)
>
> mutex_unlock(&virtio_9p_lock);
>
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
> vdev->config->del_vqs(vdev);
>
> sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
> diff --git a/net/vmw_vsock/virtio_transport.c
> b/net/vmw_vsock/virtio_transport.c
> index 4f7c99dfd16c..fb3302fff627 100644
> --- a/net/vmw_vsock/virtio_transport.c
> +++ b/net/vmw_vsock/virtio_transport.c
> @@ -665,7 +665,7 @@ static void virtio_vsock_remove(struct virtio_device
> *vdev)
> vsock_for_each_connected_socket(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().
> +* so we can safely call virtio_reset_device().
> */
> mutex_lock(&vsock->rx_lock);
> vsock->rx_run = false;
> @@ -682,7 +682,7 @@ static void virtio_vsock_remove(struct virtio_device
> *vdev)
> /* Flush all device writes and interrupts, device will not use any
> * more buffers.
> */
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
>
> mutex_lock(&vsock->rx_lock);
> while ((pkt = virtqueue_detach_unused_buf(vsock->vqs[VSOCK_VQ_RX])))
> diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c
> index 150ab3e37013..e2847c040f75 100644
> --- a/sound/virtio/virtio_card.c
> +++ b/sound/virtio/virtio_card.c
> @@ -350,7 +350,7 @@ static void virtsnd_remove(struct virtio_device *vdev)
> snd_card_free(snd->card);
>
> vdev->config->del_vqs(vdev);
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
>
> for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) {
> struct virtio_pcm_substream *vss = &snd->substreams[i];
> @@ -379,7 +379,7 @@ static int virtsnd_freeze(struct virtio_device *vdev)
> virtsnd_ctl_msg_cancel_all(snd);
>
> vdev->config->del_vqs(vdev);
> - vdev->config->reset(vdev);
> + virtio_reset_device(vdev);
>
> for (i = 0; i < snd->nsubstreams; ++i)
> cancel_work_sync(&snd->substreams[i].elapsed_period);
Reviewed-by: Pankaj Gupta