in nsm-driver/nsm.c [363:389]
static int nsm_device_update(struct virtio_device *vdev)
{
int rc;
/* Do nothing if the device does not change. */
if (nsm_dev == vdev)
return 0;
/* Clear the old device, if any. */
if (nsm_dev) {
nsm_dev->config->del_vqs(vdev);
nsm_dev = NULL;
}
/* Initialize the new device, if any. */
if (vdev) {
rc = nsm_device_init_vq(vdev);
if (rc) {
pr_err("NSM device queue failed to initialize: %d.\n", rc);
return rc;
}
nsm_dev = vdev;
}
return 0;
}