diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_port.c')
-rw-r--r-- | drivers/scsi/libsas/sas_port.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 971c37ceecb4..e1e2d085c920 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
@@ -42,10 +42,11 @@ 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, |
48 | SAS_ADDR_SIZE) == 0) | 49 | SAS_ADDR_SIZE) != 0) |
49 | sas_deform_port(phy); | 50 | sas_deform_port(phy); |
50 | else { | 51 | else { |
51 | SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n", | 52 | SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n", |
@@ -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 | } |