diff options
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 20 | ||||
-rw-r--r-- | include/scsi/scsi_transport_sas.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 9bb4e37a1a61..7871bc25fafb 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -692,6 +692,13 @@ void sas_port_delete(struct sas_port *port) | |||
692 | } | 692 | } |
693 | mutex_unlock(&port->phy_list_mutex); | 693 | mutex_unlock(&port->phy_list_mutex); |
694 | 694 | ||
695 | if (port->is_backlink) { | ||
696 | struct device *parent = port->dev.parent; | ||
697 | |||
698 | sysfs_remove_link(&port->dev.kobj, parent->bus_id); | ||
699 | port->is_backlink = 0; | ||
700 | } | ||
701 | |||
695 | transport_remove_device(dev); | 702 | transport_remove_device(dev); |
696 | device_del(dev); | 703 | device_del(dev); |
697 | transport_destroy_device(dev); | 704 | transport_destroy_device(dev); |
@@ -767,6 +774,19 @@ void sas_port_delete_phy(struct sas_port *port, struct sas_phy *phy) | |||
767 | } | 774 | } |
768 | EXPORT_SYMBOL(sas_port_delete_phy); | 775 | EXPORT_SYMBOL(sas_port_delete_phy); |
769 | 776 | ||
777 | void sas_port_mark_backlink(struct sas_port *port) | ||
778 | { | ||
779 | struct device *parent = port->dev.parent->parent->parent; | ||
780 | |||
781 | if (port->is_backlink) | ||
782 | return; | ||
783 | port->is_backlink = 1; | ||
784 | sysfs_create_link(&port->dev.kobj, &parent->kobj, | ||
785 | parent->bus_id); | ||
786 | |||
787 | } | ||
788 | EXPORT_SYMBOL(sas_port_mark_backlink); | ||
789 | |||
770 | /* | 790 | /* |
771 | * SAS remote PHY attributes. | 791 | * SAS remote PHY attributes. |
772 | */ | 792 | */ |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index f5772ff61d0d..6cc2314098cf 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -130,6 +130,8 @@ struct sas_port { | |||
130 | 130 | ||
131 | int port_identifier; | 131 | int port_identifier; |
132 | int num_phys; | 132 | int num_phys; |
133 | /* port flags */ | ||
134 | unsigned int is_backlink:1; | ||
133 | 135 | ||
134 | /* the other end of the link */ | 136 | /* the other end of the link */ |
135 | struct sas_rphy *rphy; | 137 | struct sas_rphy *rphy; |
@@ -175,6 +177,7 @@ void sas_port_free(struct sas_port *); | |||
175 | void sas_port_delete(struct sas_port *); | 177 | void sas_port_delete(struct sas_port *); |
176 | void sas_port_add_phy(struct sas_port *, struct sas_phy *); | 178 | void sas_port_add_phy(struct sas_port *, struct sas_phy *); |
177 | void sas_port_delete_phy(struct sas_port *, struct sas_phy *); | 179 | void sas_port_delete_phy(struct sas_port *, struct sas_phy *); |
180 | void sas_port_mark_backlink(struct sas_port *); | ||
178 | int scsi_is_sas_port(const struct device *); | 181 | int scsi_is_sas_port(const struct device *); |
179 | 182 | ||
180 | extern struct scsi_transport_template * | 183 | extern struct scsi_transport_template * |