/* Note: This function must only be called on a remote PHY that has not successfully been added using sas_rphy_add() (or has been sas_rphy_remove()'d)  */
void sas_rphy_free(struct sas_rphy *rphy)
/* Note: This function must only be called on a remote PHY that has not successfully been added using sas_rphy_add() (or has been sas_rphy_remove()'d)  */
void sas_rphy_free(struct sas_rphy *rphy)
{
	struct device *dev = &rphy->dev;
	struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent);
	struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
	mutex_lock(&sas_host->lock);
	list_del(&rphy->list);
	mutex_unlock(&sas_host->lock);
	sas_bsg_remove(shost, rphy);
	transport_destroy_device(dev);
	put_device(dev);
}