diff options
Diffstat (limited to 'drivers/virt/coco/tsm-core.c')
| -rw-r--r-- | drivers/virt/coco/tsm-core.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/virt/coco/tsm-core.c b/drivers/virt/coco/tsm-core.c index 0e705f3067a1..f027876a2f19 100644 --- a/drivers/virt/coco/tsm-core.c +++ b/drivers/virt/coco/tsm-core.c @@ -4,11 +4,13 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/tsm.h> +#include <linux/pci.h> #include <linux/rwsem.h> #include <linux/device.h> #include <linux/module.h> #include <linux/cleanup.h> #include <linux/pci-tsm.h> +#include <linux/pci-ide.h> static struct class *tsm_class; static DECLARE_RWSEM(tsm_rwsem); @@ -106,6 +108,32 @@ void tsm_unregister(struct tsm_dev *tsm_dev) } EXPORT_SYMBOL_GPL(tsm_unregister); +/* must be invoked between tsm_register / tsm_unregister */ +int tsm_ide_stream_register(struct pci_ide *ide) +{ + struct pci_dev *pdev = ide->pdev; + struct pci_tsm *tsm = pdev->tsm; + struct tsm_dev *tsm_dev = tsm->tsm_dev; + int rc; + + rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name); + if (rc) + return rc; + + ide->tsm_dev = tsm_dev; + return 0; +} +EXPORT_SYMBOL_GPL(tsm_ide_stream_register); + +void tsm_ide_stream_unregister(struct pci_ide *ide) +{ + struct tsm_dev *tsm_dev = ide->tsm_dev; + + ide->tsm_dev = NULL; + sysfs_remove_link(&tsm_dev->dev.kobj, ide->name); +} +EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister); + static void tsm_release(struct device *dev) { struct tsm_dev *tsm_dev = container_of(dev, typeof(*tsm_dev), dev); |
