|
4 | 4 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
5 | 5 |
|
6 | 6 | #include <linux/tsm.h> |
| 7 | +#include <linux/pci.h> |
7 | 8 | #include <linux/rwsem.h> |
8 | 9 | #include <linux/device.h> |
9 | 10 | #include <linux/module.h> |
10 | 11 | #include <linux/cleanup.h> |
11 | 12 | #include <linux/pci-tsm.h> |
| 13 | +#include <linux/pci-ide.h> |
12 | 14 |
|
13 | 15 | static struct class *tsm_class; |
14 | 16 | static DECLARE_RWSEM(tsm_rwsem); |
@@ -106,6 +108,32 @@ void tsm_unregister(struct tsm_dev *tsm_dev) |
106 | 108 | } |
107 | 109 | EXPORT_SYMBOL_GPL(tsm_unregister); |
108 | 110 |
|
| 111 | +/* must be invoked between tsm_register / tsm_unregister */ |
| 112 | +int tsm_ide_stream_register(struct pci_ide *ide) |
| 113 | +{ |
| 114 | + struct pci_dev *pdev = ide->pdev; |
| 115 | + struct pci_tsm *tsm = pdev->tsm; |
| 116 | + struct tsm_dev *tsm_dev = tsm->tsm_dev; |
| 117 | + int rc; |
| 118 | + |
| 119 | + rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name); |
| 120 | + if (rc) |
| 121 | + return rc; |
| 122 | + |
| 123 | + ide->tsm_dev = tsm_dev; |
| 124 | + return 0; |
| 125 | +} |
| 126 | +EXPORT_SYMBOL_GPL(tsm_ide_stream_register); |
| 127 | + |
| 128 | +void tsm_ide_stream_unregister(struct pci_ide *ide) |
| 129 | +{ |
| 130 | + struct tsm_dev *tsm_dev = ide->tsm_dev; |
| 131 | + |
| 132 | + ide->tsm_dev = NULL; |
| 133 | + sysfs_remove_link(&tsm_dev->dev.kobj, ide->name); |
| 134 | +} |
| 135 | +EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister); |
| 136 | + |
109 | 137 | static void tsm_release(struct device *dev) |
110 | 138 | { |
111 | 139 | struct tsm_dev *tsm_dev = container_of(dev, typeof(*tsm_dev), dev); |
|
0 commit comments