summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2009-09-23 13:39:00 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-24 15:41:08 -0700
commit4acd10521ee002137b5d6791e234d7110033c782 (patch)
tree86a511a04dcc7e7defe0ceb7414221872a710e3f /include
parent3fd5e3124028020e50cbdc61483cb623fb45e4c0 (diff)
[SCSI] scsi_lib_dma.c : fix bug /w dma maps on virtual vc ports
When the updated scsi dma code was introduced recently, it assumed the physical host/adapter was the parent of the scsi host. Unfortunately, on FC virtual ports, the parent of the scsi host is the virtual port, which does not have dma information. I have updated the dma routines to use a function that finds the first non-scsi object. A non-scsi object is defined to be an object that has a non-NULL type (assumes all transport objects have NULL types) or a non-scsi_host type. Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/scsi_host.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6e728b176904..2977806d40ae 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -698,6 +698,10 @@ static inline void *shost_priv(struct Scsi_Host *shost)
int scsi_is_host_device(const struct device *);
+/*
+ * walks object list backward, to find the first shost object.
+ * Skips over transport objects that may not be stargets, etc
+ */
static inline struct Scsi_Host *dev_to_shost(struct device *dev)
{
while (!scsi_is_host_device(dev)) {
@@ -708,6 +712,17 @@ static inline struct Scsi_Host *dev_to_shost(struct device *dev)
return container_of(dev, struct Scsi_Host, shost_gendev);
}
+/*
+ * walks object list backward, to find the first non-scsi object
+ * Skips over transport objects that may be vports, shosts under vports, etc
+ */
+static inline struct device *dev_to_nonscsi_dev(struct device *dev)
+{
+ while (dev->type == NULL || scsi_is_host_device(dev))
+ dev = dev->parent;
+ return dev;
+}
+
static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
{
return shost->shost_state == SHOST_RECOVERY ||