Commit 980fa2f9 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by James Bottomley

[SCSI] libsas: phy port lock needs irq spinlocks

Convert the phy port locks to use irq spinlocks.
Signed-off-by: default avatarDarrick J. Wong <djwong@us.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent e7571c15
...@@ -42,6 +42,7 @@ static void sas_form_port(struct asd_sas_phy *phy) ...@@ -42,6 +42,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
struct asd_sas_port *port = phy->port; struct asd_sas_port *port = phy->port;
struct sas_internal *si = struct sas_internal *si =
to_sas_internal(sas_ha->core.shost->transportt); to_sas_internal(sas_ha->core.shost->transportt);
unsigned long flags;
if (port) { if (port) {
if (memcmp(port->attached_sas_addr, phy->attached_sas_addr, if (memcmp(port->attached_sas_addr, phy->attached_sas_addr,
...@@ -56,7 +57,7 @@ static void sas_form_port(struct asd_sas_phy *phy) ...@@ -56,7 +57,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
} }
/* find a port */ /* find a port */
spin_lock(&sas_ha->phy_port_lock); spin_lock_irqsave(&sas_ha->phy_port_lock, flags);
for (i = 0; i < sas_ha->num_phys; i++) { for (i = 0; i < sas_ha->num_phys; i++) {
port = sas_ha->sas_port[i]; port = sas_ha->sas_port[i];
spin_lock(&port->phy_list_lock); spin_lock(&port->phy_list_lock);
...@@ -78,7 +79,7 @@ static void sas_form_port(struct asd_sas_phy *phy) ...@@ -78,7 +79,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
if (i >= sas_ha->num_phys) { if (i >= sas_ha->num_phys) {
printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n", printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
__FUNCTION__); __FUNCTION__);
spin_unlock(&sas_ha->phy_port_lock); spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
return; return;
} }
...@@ -105,7 +106,7 @@ static void sas_form_port(struct asd_sas_phy *phy) ...@@ -105,7 +106,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
} else } else
port->linkrate = max(port->linkrate, phy->linkrate); port->linkrate = max(port->linkrate, phy->linkrate);
spin_unlock(&port->phy_list_lock); spin_unlock(&port->phy_list_lock);
spin_unlock(&sas_ha->phy_port_lock); spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
if (!port->port) { if (!port->port) {
port->port = sas_port_alloc(phy->phy->dev.parent, port->id); port->port = sas_port_alloc(phy->phy->dev.parent, port->id);
...@@ -137,6 +138,7 @@ void sas_deform_port(struct asd_sas_phy *phy) ...@@ -137,6 +138,7 @@ void sas_deform_port(struct asd_sas_phy *phy)
struct asd_sas_port *port = phy->port; struct asd_sas_port *port = phy->port;
struct sas_internal *si = struct sas_internal *si =
to_sas_internal(sas_ha->core.shost->transportt); to_sas_internal(sas_ha->core.shost->transportt);
unsigned long flags;
if (!port) if (!port)
return; /* done by a phy event */ return; /* done by a phy event */
...@@ -155,7 +157,7 @@ void sas_deform_port(struct asd_sas_phy *phy) ...@@ -155,7 +157,7 @@ void sas_deform_port(struct asd_sas_phy *phy)
if (si->dft->lldd_port_deformed) if (si->dft->lldd_port_deformed)
si->dft->lldd_port_deformed(phy); si->dft->lldd_port_deformed(phy);
spin_lock(&sas_ha->phy_port_lock); spin_lock_irqsave(&sas_ha->phy_port_lock, flags);
spin_lock(&port->phy_list_lock); spin_lock(&port->phy_list_lock);
list_del_init(&phy->port_phy_el); list_del_init(&phy->port_phy_el);
...@@ -174,7 +176,7 @@ void sas_deform_port(struct asd_sas_phy *phy) ...@@ -174,7 +176,7 @@ void sas_deform_port(struct asd_sas_phy *phy)
port->phy_mask = 0; port->phy_mask = 0;
} }
spin_unlock(&port->phy_list_lock); spin_unlock(&port->phy_list_lock);
spin_unlock(&sas_ha->phy_port_lock); spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
return; return;
} }
......
...@@ -589,8 +589,9 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy) ...@@ -589,8 +589,9 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy)
struct sas_ha_struct *ha = SHOST_TO_SAS_HA(shost); struct sas_ha_struct *ha = SHOST_TO_SAS_HA(shost);
struct domain_device *found_dev = NULL; struct domain_device *found_dev = NULL;
int i; int i;
unsigned long flags;
spin_lock(&ha->phy_port_lock); spin_lock_irqsave(&ha->phy_port_lock, flags);
for (i = 0; i < ha->num_phys; i++) { for (i = 0; i < ha->num_phys; i++) {
struct asd_sas_port *port = ha->sas_port[i]; struct asd_sas_port *port = ha->sas_port[i];
struct domain_device *dev; struct domain_device *dev;
...@@ -606,7 +607,7 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy) ...@@ -606,7 +607,7 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy)
spin_unlock(&port->dev_list_lock); spin_unlock(&port->dev_list_lock);
} }
found: found:
spin_unlock(&ha->phy_port_lock); spin_unlock_irqrestore(&ha->phy_port_lock, flags);
return found_dev; return found_dev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment