aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_discover.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas/sas_discover.c')
-rw-r--r--drivers/scsi/libsas/sas_discover.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index c56cc6400819..789b50861bb9 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -147,6 +147,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
147 memset(port->disc.eeds_a, 0, SAS_ADDR_SIZE); 147 memset(port->disc.eeds_a, 0, SAS_ADDR_SIZE);
148 memset(port->disc.eeds_b, 0, SAS_ADDR_SIZE); 148 memset(port->disc.eeds_b, 0, SAS_ADDR_SIZE);
149 port->disc.max_level = 0; 149 port->disc.max_level = 0;
150 sas_device_set_phy(dev, port->port);
150 151
151 dev->rphy = rphy; 152 dev->rphy = rphy;
152 153
@@ -234,6 +235,9 @@ void sas_free_device(struct kref *kref)
234 if (dev->parent) 235 if (dev->parent)
235 sas_put_device(dev->parent); 236 sas_put_device(dev->parent);
236 237
238 sas_port_put_phy(dev->phy);
239 dev->phy = NULL;
240
237 /* remove the phys and ports, everything else should be gone */ 241 /* remove the phys and ports, everything else should be gone */
238 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) 242 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV)
239 kfree(dev->ex_dev.ex_phy); 243 kfree(dev->ex_dev.ex_phy);
@@ -308,6 +312,26 @@ void sas_unregister_domain_devices(struct asd_sas_port *port)
308 312
309} 313}
310 314
315void sas_device_set_phy(struct domain_device *dev, struct sas_port *port)
316{
317 struct sas_ha_struct *ha;
318 struct sas_phy *new_phy;
319
320 if (!dev)
321 return;
322
323 ha = dev->port->ha;
324 new_phy = sas_port_get_phy(port);
325
326 /* pin and record last seen phy */
327 spin_lock_irq(&ha->phy_port_lock);
328 if (new_phy) {
329 sas_port_put_phy(dev->phy);
330 dev->phy = new_phy;
331 }
332 spin_unlock_irq(&ha->phy_port_lock);
333}
334
311/* ---------- Discovery and Revalidation ---------- */ 335/* ---------- Discovery and Revalidation ---------- */
312 336
313/** 337/**