if (!phy)
return NULL;
- get_device(parent);
-
phy->number = number;
device_initialize(&phy->dev);
void sas_phy_free(struct sas_phy *phy)
{
transport_destroy_device(&phy->dev);
- put_device(phy->dev.parent);
- put_device(phy->dev.parent);
- put_device(phy->dev.parent);
- kfree(phy);
+ put_device(&phy->dev);
}
EXPORT_SYMBOL(sas_phy_free);
transport_remove_device(dev);
device_del(dev);
transport_destroy_device(dev);
- put_device(dev->parent);
+ put_device(dev);
}
EXPORT_SYMBOL(sas_phy_delete);
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
if (!rdev) {
- put_device(&parent->dev);
return NULL;
}
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
if (!rdev) {
- put_device(&parent->dev);
return NULL;
}
*/
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);
list_del(&rphy->list);
mutex_unlock(&sas_host->lock);
- transport_destroy_device(&rphy->dev);
- put_device(rphy->dev.parent);
- put_device(rphy->dev.parent);
- put_device(rphy->dev.parent);
- if (rphy->identify.device_type == SAS_END_DEVICE) {
- struct sas_end_device *edev = rphy_to_end_device(rphy);
-
- kfree(edev);
- } else {
- /* must be expander */
- struct sas_expander_device *edev =
- rphy_to_expander_device(rphy);
+ transport_destroy_device(dev);
- kfree(edev);
- }
+ put_device(dev);
}
EXPORT_SYMBOL(sas_rphy_free);
parent->rphy = NULL;
- put_device(&parent->dev);
+ put_device(dev);
}
EXPORT_SYMBOL(sas_rphy_delete);