diff options
Diffstat (limited to 'drivers/scsi/isci/remote_device.h')
-rw-r--r-- | drivers/scsi/isci/remote_device.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h index 2b6a5bb7bd60..05842b5f1e3b 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #ifndef _ISCI_REMOTE_DEVICE_H_ | 56 | #ifndef _ISCI_REMOTE_DEVICE_H_ |
57 | #define _ISCI_REMOTE_DEVICE_H_ | 57 | #define _ISCI_REMOTE_DEVICE_H_ |
58 | #include <scsi/libsas.h> | 58 | #include <scsi/libsas.h> |
59 | #include <linux/kref.h> | ||
59 | #include "scu_remote_node_context.h" | 60 | #include "scu_remote_node_context.h" |
60 | #include "remote_node_context.h" | 61 | #include "remote_node_context.h" |
61 | #include "port.h" | 62 | #include "port.h" |
@@ -134,7 +135,9 @@ struct isci_remote_device { | |||
134 | #define IDEV_STOP_PENDING 1 | 135 | #define IDEV_STOP_PENDING 1 |
135 | #define IDEV_ALLOCATED 2 | 136 | #define IDEV_ALLOCATED 2 |
136 | #define IDEV_EH 3 | 137 | #define IDEV_EH 3 |
138 | #define IDEV_GONE 4 | ||
137 | unsigned long flags; | 139 | unsigned long flags; |
140 | struct kref kref; | ||
138 | struct isci_port *isci_port; | 141 | struct isci_port *isci_port; |
139 | struct domain_device *domain_dev; | 142 | struct domain_device *domain_dev; |
140 | struct list_head node; | 143 | struct list_head node; |
@@ -145,6 +148,26 @@ struct isci_remote_device { | |||
145 | 148 | ||
146 | #define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 | 149 | #define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 |
147 | 150 | ||
151 | /* device reference routines must be called under scic_lock */ | ||
152 | static inline struct isci_remote_device *isci_lookup_device(struct domain_device *dev) | ||
153 | { | ||
154 | struct isci_remote_device *idev = dev->lldd_dev; | ||
155 | |||
156 | if (idev && !test_bit(IDEV_GONE, &idev->flags)) { | ||
157 | kref_get(&idev->kref); | ||
158 | return idev; | ||
159 | } | ||
160 | |||
161 | return NULL; | ||
162 | } | ||
163 | |||
164 | void isci_remote_device_release(struct kref *kref); | ||
165 | static inline void isci_put_device(struct isci_remote_device *idev) | ||
166 | { | ||
167 | if (idev) | ||
168 | kref_put(&idev->kref, isci_remote_device_release); | ||
169 | } | ||
170 | |||
148 | enum sci_status isci_remote_device_stop(struct isci_host *ihost, | 171 | enum sci_status isci_remote_device_stop(struct isci_host *ihost, |
149 | struct isci_remote_device *idev); | 172 | struct isci_remote_device *idev); |
150 | void isci_remote_device_nuke_requests(struct isci_host *ihost, | 173 | void isci_remote_device_nuke_requests(struct isci_host *ihost, |