]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] scsi_transport_sas: add expander backlink
authorJames Bottomley <James.Bottomley@steeleye.com>
Sun, 9 Jul 2006 17:38:19 +0000 (12:38 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Wed, 12 Jul 2006 13:03:20 +0000 (09:03 -0400)
This patch adds the ability to add a backlink to a particular port.  The
idea is to represent properly ports on expanders that are used
specifically for linking to the parent device in the topology.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_transport_sas.c
include/scsi/scsi_transport_sas.h

index 9bb4e37a1a614f9154d226267bdaeb038124e562..7871bc25fafbecf81413c964321e60a02ad3291f 100644 (file)
@@ -692,6 +692,13 @@ void sas_port_delete(struct sas_port *port)
        }
        mutex_unlock(&port->phy_list_mutex);
 
+       if (port->is_backlink) {
+               struct device *parent = port->dev.parent;
+
+               sysfs_remove_link(&port->dev.kobj, parent->bus_id);
+               port->is_backlink = 0;
+       }
+
        transport_remove_device(dev);
        device_del(dev);
        transport_destroy_device(dev);
@@ -767,6 +774,19 @@ void sas_port_delete_phy(struct sas_port *port, struct sas_phy *phy)
 }
 EXPORT_SYMBOL(sas_port_delete_phy);
 
+void sas_port_mark_backlink(struct sas_port *port)
+{
+       struct device *parent = port->dev.parent->parent->parent;
+
+       if (port->is_backlink)
+               return;
+       port->is_backlink = 1;
+       sysfs_create_link(&port->dev.kobj, &parent->kobj,
+                         parent->bus_id);
+
+}
+EXPORT_SYMBOL(sas_port_mark_backlink);
+
 /*
  * SAS remote PHY attributes.
  */
index f5772ff61d0d406fdb8745b7610b4a30e6295e1b..6cc2314098cf72fa1823eae546c34f999a5aa91b 100644 (file)
@@ -130,6 +130,8 @@ struct sas_port {
 
        int                     port_identifier;
        int                     num_phys;
+       /* port flags */
+       unsigned int            is_backlink:1;
 
        /* the other end of the link */
        struct sas_rphy         *rphy;
@@ -175,6 +177,7 @@ void sas_port_free(struct sas_port *);
 void sas_port_delete(struct sas_port *);
 void sas_port_add_phy(struct sas_port *, struct sas_phy *);
 void sas_port_delete_phy(struct sas_port *, struct sas_phy *);
+void sas_port_mark_backlink(struct sas_port *);
 int scsi_is_sas_port(const struct device *);
 
 extern struct scsi_transport_template *