aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-01-04 02:26:15 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-29 16:11:19 -0500
commitfca4ecbdc440337b3c257b38c2f4cc8d0ca0286c (patch)
tree4b1af31866accd76f16056a842c5a25de182e838 /drivers/scsi/isci
parentc132f692085ac624d7c8123df781846c8dcb3166 (diff)
[SCSI] isci: kill isci_port->status
It only tracks whether the port is stopping in order to gate new devices being discovered while the port is stopping. However, since the check and subsequent handling is unlocked there is nothing to stop the port from going down immediately after the check. Driver is already prepared to handle devices arriving on stale ports, and those will be cleaned up by an eventual ->lldd_dev_gone() notification. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/port.c89
-rw-r--r--drivers/scsi/isci/port.h5
-rw-r--r--drivers/scsi/isci/remote_device.c4
3 files changed, 11 insertions, 87 deletions
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index a28c9e6e2806..f9d20c1e63ca 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -75,20 +75,6 @@ static struct device *sciport_to_dev(struct isci_port *iport)
75 return &ihost->pdev->dev; 75 return &ihost->pdev->dev;
76} 76}
77 77
78static void isci_port_change_state(struct isci_port *iport, enum isci_status status)
79{
80 unsigned long flags;
81
82 dev_dbg(&iport->isci_host->pdev->dev,
83 "%s: iport = %p, state = 0x%x\n",
84 __func__, iport, status);
85
86 /* XXX pointless lock */
87 spin_lock_irqsave(&iport->state_lock, flags);
88 iport->status = status;
89 spin_unlock_irqrestore(&iport->state_lock, flags);
90}
91
92static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto) 78static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto)
93{ 79{
94 u8 index; 80 u8 index;
@@ -186,8 +172,6 @@ static void isci_port_link_up(struct isci_host *isci_host,
186 172
187 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); 173 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags);
188 174
189 isci_port_change_state(iport, isci_starting);
190
191 sci_port_get_properties(iport, &properties); 175 sci_port_get_properties(iport, &properties);
192 176
193 if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { 177 if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
@@ -269,7 +253,6 @@ static void isci_port_link_down(struct isci_host *isci_host,
269 __func__, isci_device); 253 __func__, isci_device);
270 set_bit(IDEV_GONE, &isci_device->flags); 254 set_bit(IDEV_GONE, &isci_device->flags);
271 } 255 }
272 isci_port_change_state(isci_port, isci_stopping);
273 } 256 }
274 } 257 }
275 258
@@ -284,45 +267,6 @@ static void isci_port_link_down(struct isci_host *isci_host,
284 "%s: isci_port = %p - Done\n", __func__, isci_port); 267 "%s: isci_port = %p - Done\n", __func__, isci_port);
285} 268}
286 269
287
288/**
289 * isci_port_ready() - This function is called by the sci core when a link
290 * becomes ready.
291 * @isci_host: This parameter specifies the isci host object.
292 * @port: This parameter specifies the sci port with the active link.
293 *
294 */
295static void isci_port_ready(struct isci_host *isci_host, struct isci_port *isci_port)
296{
297 dev_dbg(&isci_host->pdev->dev,
298 "%s: isci_port = %p\n", __func__, isci_port);
299
300 isci_port_change_state(isci_port, isci_ready);
301 return;
302}
303
304/**
305 * isci_port_not_ready() - This function is called by the sci core when a link
306 * is not ready. All remote devices on this link will be removed if they are
307 * in the stopping state.
308 * @isci_host: This parameter specifies the isci host object.
309 * @port: This parameter specifies the sci port with the active link.
310 *
311 */
312static void isci_port_not_ready(struct isci_host *isci_host, struct isci_port *isci_port)
313{
314 dev_dbg(&isci_host->pdev->dev,
315 "%s: isci_port = %p\n", __func__, isci_port);
316}
317
318static void isci_port_stop_complete(struct isci_host *ihost,
319 struct isci_port *iport,
320 enum sci_status completion_status)
321{
322 dev_dbg(&ihost->pdev->dev, "Port stop complete\n");
323}
324
325
326static bool is_port_ready_state(enum sci_port_states state) 270static bool is_port_ready_state(enum sci_port_states state)
327{ 271{
328 switch (state) { 272 switch (state) {
@@ -843,10 +787,9 @@ static void port_timeout(unsigned long data)
843 __func__, 787 __func__,
844 iport); 788 iport);
845 } else if (current_state == SCI_PORT_STOPPING) { 789 } else if (current_state == SCI_PORT_STOPPING) {
846 /* if the port is still stopping then the stop has not completed */ 790 dev_dbg(sciport_to_dev(iport),
847 isci_port_stop_complete(iport->owning_controller, 791 "%s: port%d: stop complete timeout\n",
848 iport, 792 __func__, iport->physical_port_index);
849 SCI_FAILURE_TIMEOUT);
850 } else { 793 } else {
851 /* The port is in the ready state and we have a timer 794 /* The port is in the ready state and we have a timer
852 * reporting a timeout this should not happen. 795 * reporting a timeout this should not happen.
@@ -1011,7 +954,8 @@ static void sci_port_ready_substate_operational_enter(struct sci_base_state_mach
1011 struct isci_port *iport = container_of(sm, typeof(*iport), sm); 954 struct isci_port *iport = container_of(sm, typeof(*iport), sm);
1012 struct isci_host *ihost = iport->owning_controller; 955 struct isci_host *ihost = iport->owning_controller;
1013 956
1014 isci_port_ready(ihost, iport); 957 dev_dbg(&ihost->pdev->dev, "%s: port%d ready\n",
958 __func__, iport->physical_port_index);
1015 959
1016 for (index = 0; index < SCI_MAX_PHYS; index++) { 960 for (index = 0; index < SCI_MAX_PHYS; index++) {
1017 if (iport->phy_table[index]) { 961 if (iport->phy_table[index]) {
@@ -1077,7 +1021,8 @@ static void sci_port_ready_substate_operational_exit(struct sci_base_state_machi
1077 */ 1021 */
1078 sci_port_abort_dummy_request(iport); 1022 sci_port_abort_dummy_request(iport);
1079 1023
1080 isci_port_not_ready(ihost, iport); 1024 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
1025 __func__, iport->physical_port_index);
1081 1026
1082 if (iport->ready_exit) 1027 if (iport->ready_exit)
1083 sci_port_invalidate_dummy_remote_node(iport); 1028 sci_port_invalidate_dummy_remote_node(iport);
@@ -1089,7 +1034,8 @@ static void sci_port_ready_substate_configuring_enter(struct sci_base_state_mach
1089 struct isci_host *ihost = iport->owning_controller; 1034 struct isci_host *ihost = iport->owning_controller;
1090 1035
1091 if (iport->active_phy_mask == 0) { 1036 if (iport->active_phy_mask == 0) {
1092 isci_port_not_ready(ihost, iport); 1037 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
1038 __func__, iport->physical_port_index);
1093 1039
1094 port_state_machine_change(iport, SCI_PORT_SUB_WAITING); 1040 port_state_machine_change(iport, SCI_PORT_SUB_WAITING);
1095 } else 1041 } else
@@ -1555,7 +1501,8 @@ static void sci_port_ready_state_enter(struct sci_base_state_machine *sm)
1555 if (prev_state == SCI_PORT_RESETTING) 1501 if (prev_state == SCI_PORT_RESETTING)
1556 isci_port_hard_reset_complete(iport, SCI_SUCCESS); 1502 isci_port_hard_reset_complete(iport, SCI_SUCCESS);
1557 else 1503 else
1558 isci_port_not_ready(ihost, iport); 1504 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
1505 __func__, iport->physical_port_index);
1559 1506
1560 /* Post and suspend the dummy remote node context for this port. */ 1507 /* Post and suspend the dummy remote node context for this port. */
1561 sci_port_post_dummy_remote_node(iport); 1508 sci_port_post_dummy_remote_node(iport);
@@ -1652,21 +1599,7 @@ void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index)
1652{ 1599{
1653 INIT_LIST_HEAD(&iport->remote_dev_list); 1600 INIT_LIST_HEAD(&iport->remote_dev_list);
1654 INIT_LIST_HEAD(&iport->domain_dev_list); 1601 INIT_LIST_HEAD(&iport->domain_dev_list);
1655 spin_lock_init(&iport->state_lock);
1656 iport->isci_host = ihost; 1602 iport->isci_host = ihost;
1657 isci_port_change_state(iport, isci_freed);
1658}
1659
1660/**
1661 * isci_port_get_state() - This function gets the status of the port object.
1662 * @isci_port: This parameter points to the isci_port object
1663 *
1664 * status of the object as a isci_status enum.
1665 */
1666enum isci_status isci_port_get_state(
1667 struct isci_port *isci_port)
1668{
1669 return isci_port->status;
1670} 1603}
1671 1604
1672void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) 1605void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy)
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h
index 6b42e84b6955..265972939e3a 100644
--- a/drivers/scsi/isci/port.h
+++ b/drivers/scsi/isci/port.h
@@ -95,10 +95,8 @@ enum isci_status {
95 * @timer: timeout start/stop operations 95 * @timer: timeout start/stop operations
96 */ 96 */
97struct isci_port { 97struct isci_port {
98 enum isci_status status;
99 struct isci_host *isci_host; 98 struct isci_host *isci_host;
100 struct list_head remote_dev_list; 99 struct list_head remote_dev_list;
101 spinlock_t state_lock;
102 struct list_head domain_dev_list; 100 struct list_head domain_dev_list;
103 struct completion hard_reset_complete; 101 struct completion hard_reset_complete;
104 enum sci_status hard_reset_status; 102 enum sci_status hard_reset_status;
@@ -294,9 +292,6 @@ void sci_port_get_attached_sas_address(
294 struct isci_port *iport, 292 struct isci_port *iport,
295 struct sci_sas_address *sas_address); 293 struct sci_sas_address *sas_address);
296 294
297enum isci_status isci_port_get_state(
298 struct isci_port *isci_port);
299
300void isci_port_formed(struct asd_sas_phy *); 295void isci_port_formed(struct asd_sas_phy *);
301void isci_port_deformed(struct asd_sas_phy *); 296void isci_port_deformed(struct asd_sas_phy *);
302 297
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index cff684fc1efc..108238d4510d 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1394,10 +1394,6 @@ int isci_remote_device_found(struct domain_device *dev)
1394 if (!isci_port) 1394 if (!isci_port)
1395 return -ENODEV; 1395 return -ENODEV;
1396 1396
1397 if ((isci_stopping == isci_port_get_state(isci_port)) ||
1398 (isci_stopped == isci_port_get_state(isci_port)))
1399 return -ENODEV;
1400
1401 isci_device = isci_remote_device_alloc(isci_host, isci_port); 1397 isci_device = isci_remote_device_alloc(isci_host, isci_port);
1402 if (!isci_device) 1398 if (!isci_device)
1403 return -ENODEV; 1399 return -ENODEV;