static void vtpm_proxy_work(struct work_struct *work) { struct proxy_dev *proxy_dev = container_of(work, struct proxy_dev, work); int rc; rc = tpm_chip_register(proxy_dev->chip); if (rc) vtpm_proxy_fops_undo_open(proxy_dev); else proxy_dev->state |= STATE_REGISTERED_FLAG; }
/* * Counter part to vtpm_create_device. */ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev) { vtpm_proxy_work_stop(proxy_dev); /* * A client may hold the 'ops' lock, so let it know that the server * side shuts down before we try to grab the 'ops' lock when * unregistering the chip. */ vtpm_proxy_fops_undo_open(proxy_dev); tpm_chip_unregister(proxy_dev->chip); vtpm_proxy_delete_proxy_dev(proxy_dev); }
static void vtpm_proxy_work(struct work_struct *work) { struct proxy_dev *proxy_dev = container_of(work, struct proxy_dev, work); int rc; rc = tpm_chip_register(proxy_dev->chip); if (rc) goto err; return; err: vtpm_proxy_fops_undo_open(proxy_dev); }
/* * vtpm_proxy_work_stop: make sure the work has finished * * This function is useful when user space closed the fd * while the driver still determines timeouts. */ static void vtpm_proxy_work_stop(struct proxy_dev *proxy_dev) { vtpm_proxy_fops_undo_open(proxy_dev); flush_work(&proxy_dev->work); }