hpsa_sas_phy
static struct hpsa_sas_phy *hpsa_alloc_sas_phy(
struct hpsa_sas_phy *hpsa_sas_phy;
hpsa_sas_phy = kzalloc_obj(*hpsa_sas_phy);
if (!hpsa_sas_phy)
kfree(hpsa_sas_phy);
hpsa_sas_phy->phy = phy;
hpsa_sas_phy->parent_port = hpsa_sas_port;
return hpsa_sas_phy;
static void hpsa_free_sas_phy(struct hpsa_sas_phy *hpsa_sas_phy)
struct sas_phy *phy = hpsa_sas_phy->phy;
sas_port_delete_phy(hpsa_sas_phy->parent_port->port, phy);
if (hpsa_sas_phy->added_to_port)
list_del(&hpsa_sas_phy->phy_list_entry);
kfree(hpsa_sas_phy);
static int hpsa_sas_port_add_phy(struct hpsa_sas_phy *hpsa_sas_phy)
hpsa_sas_port = hpsa_sas_phy->parent_port;
phy = hpsa_sas_phy->phy;
rc = sas_phy_add(hpsa_sas_phy->phy);
sas_port_add_phy(hpsa_sas_port->port, hpsa_sas_phy->phy);
list_add_tail(&hpsa_sas_phy->phy_list_entry,
hpsa_sas_phy->added_to_port = true;
struct hpsa_sas_phy *hpsa_sas_phy;
struct hpsa_sas_phy *next;
list_for_each_entry_safe(hpsa_sas_phy, next,
hpsa_free_sas_phy(hpsa_sas_phy);
struct hpsa_sas_phy *hpsa_sas_phy;
hpsa_sas_phy = hpsa_alloc_sas_phy(hpsa_sas_port);
if (!hpsa_sas_phy) {
rc = hpsa_sas_port_add_phy(hpsa_sas_phy);
sas_phy_free(hpsa_sas_phy->phy);
kfree(hpsa_sas_phy);