Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299862
b: refs/heads/master
c: 9487669
h: refs/heads/master
v: v3
  • Loading branch information
Dan Williams authored and James Bottomley committed Apr 23, 2012
1 parent 85b4edf commit e1e1b5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec236e526777ea8825e6e0c3673a40389692eabf
refs/heads/master: 9487669fc225092cf315e1291ece28e23e6754f3
11 changes: 6 additions & 5 deletions trunk/drivers/scsi/libsas/sas_discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
sas_device_set_phy(dev, port->port);

dev->rphy = rphy;
get_device(&dev->rphy->dev);

if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV)
list_add_tail(&dev->disco_list_node, &port->disco_list);
Expand Down Expand Up @@ -255,6 +256,9 @@ void sas_free_device(struct kref *kref)
{
struct domain_device *dev = container_of(kref, typeof(*dev), kref);

put_device(&dev->rphy->dev);
dev->rphy = NULL;

if (dev->parent)
sas_put_device(dev->parent);

Expand Down Expand Up @@ -301,7 +305,6 @@ static void sas_destruct_devices(struct work_struct *work)

sas_remove_children(&dev->rphy->dev);
sas_rphy_delete(dev->rphy);
dev->rphy = NULL;
sas_unregister_common_dev(port, dev);
}
}
Expand All @@ -313,11 +316,11 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
/* this rphy never saw sas_rphy_add */
list_del_init(&dev->disco_list_node);
sas_rphy_free(dev->rphy);
dev->rphy = NULL;
sas_unregister_common_dev(port, dev);
return;
}

if (dev->rphy && !test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) {
if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) {
sas_rphy_unlink(dev->rphy);
list_move_tail(&dev->disco_list_node, &port->destroy_list);
sas_discover_event(dev->port, DISCE_DESTRUCT);
Expand Down Expand Up @@ -417,8 +420,6 @@ static void sas_discover_domain(struct work_struct *work)

if (error) {
sas_rphy_free(dev->rphy);
dev->rphy = NULL;

list_del_init(&dev->disco_list_node);
spin_lock_irq(&port->dev_list_lock);
list_del_init(&dev->dev_list_node);
Expand Down
6 changes: 4 additions & 2 deletions trunk/drivers/scsi/libsas/sas_expander.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ static struct domain_device *sas_ex_discover_end_dev(
sas_init_dev(child);

child->rphy = rphy;
get_device(&rphy->dev);

list_add_tail(&child->disco_list_node, &parent->port->disco_list);

Expand All @@ -806,6 +807,7 @@ static struct domain_device *sas_ex_discover_end_dev(
sas_init_dev(child);

child->rphy = rphy;
get_device(&rphy->dev);
sas_fill_in_rphy(child, rphy);

list_add_tail(&child->disco_list_node, &parent->port->disco_list);
Expand All @@ -830,8 +832,6 @@ static struct domain_device *sas_ex_discover_end_dev(

out_list_del:
sas_rphy_free(child->rphy);
child->rphy = NULL;

list_del(&child->disco_list_node);
spin_lock_irq(&parent->port->dev_list_lock);
list_del(&child->dev_list_node);
Expand Down Expand Up @@ -911,6 +911,7 @@ static struct domain_device *sas_ex_discover_expander(
}
port = parent->port;
child->rphy = rphy;
get_device(&rphy->dev);
edev = rphy_to_expander_device(rphy);
child->dev_type = phy->attached_dev_type;
kref_get(&parent->kref);
Expand All @@ -934,6 +935,7 @@ static struct domain_device *sas_ex_discover_expander(

res = sas_discover_expander(child);
if (res) {
sas_rphy_delete(rphy);
spin_lock_irq(&parent->port->dev_list_lock);
list_del(&child->dev_list_node);
spin_unlock_irq(&parent->port->dev_list_lock);
Expand Down

0 comments on commit e1e1b5a

Please sign in to comment.