diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_port.c')
-rw-r--r-- | drivers/scsi/libsas/sas_port.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 42fd1f25b664..eb19c016d500 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
@@ -104,13 +104,11 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
104 | 104 | ||
105 | /* add the phy to the port */ | 105 | /* add the phy to the port */ |
106 | list_add_tail(&phy->port_phy_el, &port->phy_list); | 106 | list_add_tail(&phy->port_phy_el, &port->phy_list); |
107 | sas_phy_set_target(phy, port->port_dev); | ||
107 | phy->port = port; | 108 | phy->port = port; |
108 | port->num_phys++; | 109 | port->num_phys++; |
109 | port->phy_mask |= (1U << phy->id); | 110 | port->phy_mask |= (1U << phy->id); |
110 | 111 | ||
111 | if (!port->phy) | ||
112 | port->phy = phy->phy; | ||
113 | |||
114 | if (*(u64 *)port->attached_sas_addr == 0) { | 112 | if (*(u64 *)port->attached_sas_addr == 0) { |
115 | port->class = phy->class; | 113 | port->class = phy->class; |
116 | memcpy(port->attached_sas_addr, phy->attached_sas_addr, | 114 | memcpy(port->attached_sas_addr, phy->attached_sas_addr, |
@@ -125,7 +123,7 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
125 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); | 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); |
126 | 124 | ||
127 | if (!port->port) { | 125 | if (!port->port) { |
128 | port->port = sas_port_alloc(phy->phy->dev.parent, port->id); | 126 | port->port = sas_port_alloc(phy->phy->dev.parent, phy->id); |
129 | BUG_ON(!port->port); | 127 | BUG_ON(!port->port); |
130 | sas_port_add(port->port); | 128 | sas_port_add(port->port); |
131 | } | 129 | } |
@@ -170,13 +168,13 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
170 | dev->pathways--; | 168 | dev->pathways--; |
171 | 169 | ||
172 | if (port->num_phys == 1) { | 170 | if (port->num_phys == 1) { |
173 | if (dev && gone) | 171 | sas_unregister_domain_devices(port, gone); |
174 | dev->gone = 1; | ||
175 | sas_unregister_domain_devices(port); | ||
176 | sas_port_delete(port->port); | 172 | sas_port_delete(port->port); |
177 | port->port = NULL; | 173 | port->port = NULL; |
178 | } else | 174 | } else { |
179 | sas_port_delete_phy(port->port, phy->phy); | 175 | sas_port_delete_phy(port->port, phy->phy); |
176 | sas_device_set_phy(dev, port->port); | ||
177 | } | ||
180 | 178 | ||
181 | if (si->dft->lldd_port_deformed) | 179 | if (si->dft->lldd_port_deformed) |
182 | si->dft->lldd_port_deformed(phy); | 180 | si->dft->lldd_port_deformed(phy); |
@@ -185,6 +183,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
185 | spin_lock(&port->phy_list_lock); | 183 | spin_lock(&port->phy_list_lock); |
186 | 184 | ||
187 | list_del_init(&phy->port_phy_el); | 185 | list_del_init(&phy->port_phy_el); |
186 | sas_phy_set_target(phy, NULL); | ||
188 | phy->port = NULL; | 187 | phy->port = NULL; |
189 | port->num_phys--; | 188 | port->num_phys--; |
190 | port->phy_mask &= ~(1U << phy->id); | 189 | port->phy_mask &= ~(1U << phy->id); |
@@ -213,8 +212,7 @@ void sas_porte_bytes_dmaed(struct work_struct *work) | |||
213 | container_of(work, struct asd_sas_event, work); | 212 | container_of(work, struct asd_sas_event, work); |
214 | struct asd_sas_phy *phy = ev->phy; | 213 | struct asd_sas_phy *phy = ev->phy; |
215 | 214 | ||
216 | sas_begin_event(PORTE_BYTES_DMAED, &phy->ha->event_lock, | 215 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); |
217 | &phy->port_events_pending); | ||
218 | 216 | ||
219 | sas_form_port(phy); | 217 | sas_form_port(phy); |
220 | } | 218 | } |
@@ -227,8 +225,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) | |||
227 | unsigned long flags; | 225 | unsigned long flags; |
228 | u32 prim; | 226 | u32 prim; |
229 | 227 | ||
230 | sas_begin_event(PORTE_BROADCAST_RCVD, &phy->ha->event_lock, | 228 | clear_bit(PORTE_BROADCAST_RCVD, &phy->port_events_pending); |
231 | &phy->port_events_pending); | ||
232 | 229 | ||
233 | spin_lock_irqsave(&phy->sas_prim_lock, flags); | 230 | spin_lock_irqsave(&phy->sas_prim_lock, flags); |
234 | prim = phy->sas_prim; | 231 | prim = phy->sas_prim; |
@@ -244,8 +241,7 @@ void sas_porte_link_reset_err(struct work_struct *work) | |||
244 | container_of(work, struct asd_sas_event, work); | 241 | container_of(work, struct asd_sas_event, work); |
245 | struct asd_sas_phy *phy = ev->phy; | 242 | struct asd_sas_phy *phy = ev->phy; |
246 | 243 | ||
247 | sas_begin_event(PORTE_LINK_RESET_ERR, &phy->ha->event_lock, | 244 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); |
248 | &phy->port_events_pending); | ||
249 | 245 | ||
250 | sas_deform_port(phy, 1); | 246 | sas_deform_port(phy, 1); |
251 | } | 247 | } |
@@ -256,8 +252,7 @@ void sas_porte_timer_event(struct work_struct *work) | |||
256 | container_of(work, struct asd_sas_event, work); | 252 | container_of(work, struct asd_sas_event, work); |
257 | struct asd_sas_phy *phy = ev->phy; | 253 | struct asd_sas_phy *phy = ev->phy; |
258 | 254 | ||
259 | sas_begin_event(PORTE_TIMER_EVENT, &phy->ha->event_lock, | 255 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); |
260 | &phy->port_events_pending); | ||
261 | 256 | ||
262 | sas_deform_port(phy, 1); | 257 | sas_deform_port(phy, 1); |
263 | } | 258 | } |
@@ -268,8 +263,7 @@ void sas_porte_hard_reset(struct work_struct *work) | |||
268 | container_of(work, struct asd_sas_event, work); | 263 | container_of(work, struct asd_sas_event, work); |
269 | struct asd_sas_phy *phy = ev->phy; | 264 | struct asd_sas_phy *phy = ev->phy; |
270 | 265 | ||
271 | sas_begin_event(PORTE_HARD_RESET, &phy->ha->event_lock, | 266 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); |
272 | &phy->port_events_pending); | ||
273 | 267 | ||
274 | sas_deform_port(phy, 1); | 268 | sas_deform_port(phy, 1); |
275 | } | 269 | } |
@@ -282,6 +276,8 @@ static void sas_init_port(struct asd_sas_port *port, | |||
282 | memset(port, 0, sizeof(*port)); | 276 | memset(port, 0, sizeof(*port)); |
283 | port->id = i; | 277 | port->id = i; |
284 | INIT_LIST_HEAD(&port->dev_list); | 278 | INIT_LIST_HEAD(&port->dev_list); |
279 | INIT_LIST_HEAD(&port->disco_list); | ||
280 | INIT_LIST_HEAD(&port->destroy_list); | ||
285 | spin_lock_init(&port->phy_list_lock); | 281 | spin_lock_init(&port->phy_list_lock); |
286 | INIT_LIST_HEAD(&port->phy_list); | 282 | INIT_LIST_HEAD(&port->phy_list); |
287 | port->ha = sas_ha; | 283 | port->ha = sas_ha; |