/* Removes the specified SAS PORT. If the SAS PORT has an associated phys, unlink them from the port as well.  */
void sas_port_delete(struct sas_port *port)
/* Removes the specified SAS PORT. If the SAS PORT has an associated phys, unlink them from the port as well.  */
void sas_port_delete(struct sas_port *port)
{
	struct device *dev = &port->dev;
	struct sas_phy *phy, *tmp_phy;
	if (port->rphy) {
		sas_rphy_delete(port->rphy);
		port->rphy = NULL;
	}
	mutex_lock(&port->phy_list_mutex);
	list_for_each_entry_safe(phy, tmp_phy, &port->phy_list,
				 port_siblings) {
		sas_port_delete_link(port, phy);
		list_del_init(&phy->port_siblings);
	}
	mutex_unlock(&port->phy_list_mutex);
	if (port->is_backlink) {
		struct device *parent = port->dev.parent;
		sysfs_remove_link(&port->dev.kobj, dev_name(parent));
		port->is_backlink = 0;
	}
	transport_remove_device(dev);
	device_del(dev);
	transport_destroy_device(dev);
	put_device(dev);
}