[PATCH] aic94xx: fix cascaded expander properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The sas_device properties for a cascaded expander are always empty.  Fix
this by filling them in at the correct point (also refactor the code
since we do this in several places).

James

Index: BUILD-2.6/drivers/scsi/sas/sas_expander.c
===================================================================
--- BUILD-2.6.orig/drivers/scsi/sas/sas_expander.c	2006-07-08 10:44:43.000000000 -0500
+++ BUILD-2.6/drivers/scsi/sas/sas_expander.c	2006-07-08 10:56:53.000000000 -0500
@@ -611,11 +611,7 @@
 		sas_init_dev(child);
 
 		child->rphy = rphy;
-		rphy->identify.phy_identifier = phy->phy->identify.phy_identifier;
-		rphy->identify.device_type = SAS_END_DEVICE;
-		rphy->identify.sas_address = SAS_ADDR(child->sas_addr);
-		rphy->identify.initiator_port_protocols = child->iproto;
-		rphy->identify.target_port_protocols = child->tproto;
+		sas_fill_in_rphy(child, rphy);
 
 		spin_lock(&parent->port->dev_list_lock);
 		list_add_tail(&child->dev_list_node, &parent->port->dev_list);
@@ -698,7 +694,8 @@
 	parent->port->disc.max_level = max(parent->port->disc.max_level,
 					   edev->level);
 	sas_init_dev(child);
-	sas_rphy_add(child->rphy);
+	sas_fill_in_rphy(child, rphy);
+	sas_rphy_add(rphy);
 
 	spin_lock(&parent->port->dev_list_lock);
 	list_add_tail(&child->dev_list_node, &parent->port->dev_list);
Index: BUILD-2.6/drivers/scsi/sas/sas_discover.c
===================================================================
--- BUILD-2.6.orig/drivers/scsi/sas/sas_discover.c	2006-07-08 10:48:55.000000000 -0500
+++ BUILD-2.6/drivers/scsi/sas/sas_discover.c	2006-07-08 10:49:57.000000000 -0500
@@ -278,25 +278,7 @@
 	}
 	rphy->identify.phy_identifier = phy->phy->identify.phy_identifier;
 	memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE);
-	rphy->identify.sas_address = SAS_ADDR(dev->sas_addr);
-	rphy->identify.initiator_port_protocols = dev->iproto;
-	rphy->identify.target_port_protocols = dev->tproto;
-	switch (dev->dev_type) {
-	case SATA_DEV:
-		/* FIXME: need sata device type */
-	case SAS_END_DEV:
-		rphy->identify.device_type = SAS_END_DEVICE;
-		break;
-	case EDGE_DEV:
-		rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
-		break;
-	case FANOUT_DEV:
-		rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
-		break;
-	default:
-		rphy->identify.device_type = SAS_PHY_UNUSED;
-		break;
-	}
+	sas_fill_in_rphy(dev, rphy);
 	sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr);
 	port->port_dev = dev;
 	dev->port = port;
Index: BUILD-2.6/drivers/scsi/sas/sas_internal.h
===================================================================
--- BUILD-2.6.orig/drivers/scsi/sas/sas_internal.h	2006-07-08 10:58:17.000000000 -0500
+++ BUILD-2.6/drivers/scsi/sas/sas_internal.h	2006-07-08 10:58:20.000000000 -0500
@@ -26,8 +26,9 @@
 #ifndef _SAS_INTERNAL_H_
 #define _SAS_INTERNAL_H_
 
-#include <scsi/libsas.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport_sas.h>
+#include <scsi/libsas.h>
 
 #define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
 
@@ -97,4 +98,28 @@
 	spin_unlock_irqrestore(lock, flags);
 }
 
+static inline void sas_fill_in_rphy(struct domain_device *dev,
+				    struct sas_rphy *rphy)
+{
+	rphy->identify.sas_address = SAS_ADDR(dev->sas_addr);
+	rphy->identify.initiator_port_protocols = dev->iproto;
+	rphy->identify.target_port_protocols = dev->tproto;
+	switch (dev->dev_type) {
+	case SATA_DEV:
+		/* FIXME: need sata device type */
+	case SAS_END_DEV:
+		rphy->identify.device_type = SAS_END_DEVICE;
+		break;
+	case EDGE_DEV:
+		rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
+		break;
+	case FANOUT_DEV:
+		rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
+		break;
+	default:
+		rphy->identify.device_type = SAS_PHY_UNUSED;
+		break;
+	}
+}
+
 #endif /* _SAS_INTERNAL_H_ */


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux