aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_port.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2007-01-11 17:15:40 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-01-13 17:20:46 -0500
commit980fa2f9d64b9be96107c89e165953ace311af54 (patch)
tree595956edd5b62cfa618e51bee5deeefd1710310a /drivers/scsi/libsas/sas_port.c
parente7571c152dea576f8c80ca240befc93d4f16551d (diff)
[SCSI] libsas: phy port lock needs irq spinlocks
Convert the phy port locks to use irq spinlocks. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_port.c')
-rw-r--r--drivers/scsi/libsas/sas_port.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index 971c37ceecb..a796ae31430 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -42,6 +42,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
42 struct asd_sas_port *port = phy->port; 42 struct asd_sas_port *port = phy->port;
43 struct sas_internal *si = 43 struct sas_internal *si =
44 to_sas_internal(sas_ha->core.shost->transportt); 44 to_sas_internal(sas_ha->core.shost->transportt);
45 unsigned long flags;
45 46
46 if (port) { 47 if (port) {
47 if (memcmp(port->attached_sas_addr, phy->attached_sas_addr, 48 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 } 57 }
57 58
58 /* find a port */ 59 /* find a port */
59 spin_lock(&sas_ha->phy_port_lock); 60 spin_lock_irqsave(&sas_ha->phy_port_lock, flags);
60 for (i = 0; i < sas_ha->num_phys; i++) { 61 for (i = 0; i < sas_ha->num_phys; i++) {
61 port = sas_ha->sas_port[i]; 62 port = sas_ha->sas_port[i];
62 spin_lock(&port->phy_list_lock); 63 spin_lock(&port->phy_list_lock);
@@ -78,7 +79,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
78 if (i >= sas_ha->num_phys) { 79 if (i >= sas_ha->num_phys) {
79 printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n", 80 printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
80 __FUNCTION__); 81 __FUNCTION__);
81 spin_unlock(&sas_ha->phy_port_lock); 82 spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
82 return; 83 return;
83 } 84 }
84 85
@@ -105,7 +106,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
105 } else 106 } else
106 port->linkrate = max(port->linkrate, phy->linkrate); 107 port->linkrate = max(port->linkrate, phy->linkrate);
107 spin_unlock(&port->phy_list_lock); 108 spin_unlock(&port->phy_list_lock);
108 spin_unlock(&sas_ha->phy_port_lock); 109 spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
109 110
110 if (!port->port) { 111 if (!port->port) {
111 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); 112 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 struct asd_sas_port *port = phy->port; 138 struct asd_sas_port *port = phy->port;
138 struct sas_internal *si = 139 struct sas_internal *si =
139 to_sas_internal(sas_ha->core.shost->transportt); 140 to_sas_internal(sas_ha->core.shost->transportt);
141 unsigned long flags;
140 142
141 if (!port) 143 if (!port)
142 return; /* done by a phy event */ 144 return; /* done by a phy event */
@@ -155,7 +157,7 @@ void sas_deform_port(struct asd_sas_phy *phy)
155 if (si->dft->lldd_port_deformed) 157 if (si->dft->lldd_port_deformed)
156 si->dft->lldd_port_deformed(phy); 158 si->dft->lldd_port_deformed(phy);
157 159
158 spin_lock(&sas_ha->phy_port_lock); 160 spin_lock_irqsave(&sas_ha->phy_port_lock, flags);
159 spin_lock(&port->phy_list_lock); 161 spin_lock(&port->phy_list_lock);
160 162
161 list_del_init(&phy->port_phy_el); 163 list_del_init(&phy->port_phy_el);
@@ -174,7 +176,7 @@ void sas_deform_port(struct asd_sas_phy *phy)
174 port->phy_mask = 0; 176 port->phy_mask = 0;
175 } 177 }
176 spin_unlock(&port->phy_list_lock); 178 spin_unlock(&port->phy_list_lock);
177 spin_unlock(&sas_ha->phy_port_lock); 179 spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
178 180
179 return; 181 return;
180} 182}