Commit fca4ecbd authored by Dan Williams's avatar Dan Williams Committed by James Bottomley

[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: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent c132f692
...@@ -75,20 +75,6 @@ static struct device *sciport_to_dev(struct isci_port *iport) ...@@ -75,20 +75,6 @@ static struct device *sciport_to_dev(struct isci_port *iport)
return &ihost->pdev->dev; return &ihost->pdev->dev;
} }
static void isci_port_change_state(struct isci_port *iport, enum isci_status status)
{
unsigned long flags;
dev_dbg(&iport->isci_host->pdev->dev,
"%s: iport = %p, state = 0x%x\n",
__func__, iport, status);
/* XXX pointless lock */
spin_lock_irqsave(&iport->state_lock, flags);
iport->status = status;
spin_unlock_irqrestore(&iport->state_lock, flags);
}
static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto) static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto)
{ {
u8 index; u8 index;
...@@ -186,8 +172,6 @@ static void isci_port_link_up(struct isci_host *isci_host, ...@@ -186,8 +172,6 @@ static void isci_port_link_up(struct isci_host *isci_host,
spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags);
isci_port_change_state(iport, isci_starting);
sci_port_get_properties(iport, &properties); sci_port_get_properties(iport, &properties);
if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
...@@ -269,7 +253,6 @@ static void isci_port_link_down(struct isci_host *isci_host, ...@@ -269,7 +253,6 @@ static void isci_port_link_down(struct isci_host *isci_host,
__func__, isci_device); __func__, isci_device);
set_bit(IDEV_GONE, &isci_device->flags); set_bit(IDEV_GONE, &isci_device->flags);
} }
isci_port_change_state(isci_port, isci_stopping);
} }
} }
...@@ -284,45 +267,6 @@ static void isci_port_link_down(struct isci_host *isci_host, ...@@ -284,45 +267,6 @@ static void isci_port_link_down(struct isci_host *isci_host,
"%s: isci_port = %p - Done\n", __func__, isci_port); "%s: isci_port = %p - Done\n", __func__, isci_port);
} }
/**
* isci_port_ready() - This function is called by the sci core when a link
* becomes ready.
* @isci_host: This parameter specifies the isci host object.
* @port: This parameter specifies the sci port with the active link.
*
*/
static void isci_port_ready(struct isci_host *isci_host, struct isci_port *isci_port)
{
dev_dbg(&isci_host->pdev->dev,
"%s: isci_port = %p\n", __func__, isci_port);
isci_port_change_state(isci_port, isci_ready);
return;
}
/**
* isci_port_not_ready() - This function is called by the sci core when a link
* is not ready. All remote devices on this link will be removed if they are
* in the stopping state.
* @isci_host: This parameter specifies the isci host object.
* @port: This parameter specifies the sci port with the active link.
*
*/
static void isci_port_not_ready(struct isci_host *isci_host, struct isci_port *isci_port)
{
dev_dbg(&isci_host->pdev->dev,
"%s: isci_port = %p\n", __func__, isci_port);
}
static void isci_port_stop_complete(struct isci_host *ihost,
struct isci_port *iport,
enum sci_status completion_status)
{
dev_dbg(&ihost->pdev->dev, "Port stop complete\n");
}
static bool is_port_ready_state(enum sci_port_states state) static bool is_port_ready_state(enum sci_port_states state)
{ {
switch (state) { switch (state) {
...@@ -843,10 +787,9 @@ static void port_timeout(unsigned long data) ...@@ -843,10 +787,9 @@ static void port_timeout(unsigned long data)
__func__, __func__,
iport); iport);
} else if (current_state == SCI_PORT_STOPPING) { } else if (current_state == SCI_PORT_STOPPING) {
/* if the port is still stopping then the stop has not completed */ dev_dbg(sciport_to_dev(iport),
isci_port_stop_complete(iport->owning_controller, "%s: port%d: stop complete timeout\n",
iport, __func__, iport->physical_port_index);
SCI_FAILURE_TIMEOUT);
} else { } else {
/* The port is in the ready state and we have a timer /* The port is in the ready state and we have a timer
* reporting a timeout this should not happen. * 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,7 +954,8 @@ static void sci_port_ready_substate_operational_enter(struct sci_base_state_mach
struct isci_port *iport = container_of(sm, typeof(*iport), sm); struct isci_port *iport = container_of(sm, typeof(*iport), sm);
struct isci_host *ihost = iport->owning_controller; struct isci_host *ihost = iport->owning_controller;
isci_port_ready(ihost, iport); dev_dbg(&ihost->pdev->dev, "%s: port%d ready\n",
__func__, iport->physical_port_index);
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (iport->phy_table[index]) { if (iport->phy_table[index]) {
...@@ -1077,7 +1021,8 @@ static void sci_port_ready_substate_operational_exit(struct sci_base_state_machi ...@@ -1077,7 +1021,8 @@ static void sci_port_ready_substate_operational_exit(struct sci_base_state_machi
*/ */
sci_port_abort_dummy_request(iport); sci_port_abort_dummy_request(iport);
isci_port_not_ready(ihost, iport); dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
__func__, iport->physical_port_index);
if (iport->ready_exit) if (iport->ready_exit)
sci_port_invalidate_dummy_remote_node(iport); 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,7 +1034,8 @@ static void sci_port_ready_substate_configuring_enter(struct sci_base_state_mach
struct isci_host *ihost = iport->owning_controller; struct isci_host *ihost = iport->owning_controller;
if (iport->active_phy_mask == 0) { if (iport->active_phy_mask == 0) {
isci_port_not_ready(ihost, iport); dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
__func__, iport->physical_port_index);
port_state_machine_change(iport, SCI_PORT_SUB_WAITING); port_state_machine_change(iport, SCI_PORT_SUB_WAITING);
} else } else
...@@ -1555,7 +1501,8 @@ static void sci_port_ready_state_enter(struct sci_base_state_machine *sm) ...@@ -1555,7 +1501,8 @@ static void sci_port_ready_state_enter(struct sci_base_state_machine *sm)
if (prev_state == SCI_PORT_RESETTING) if (prev_state == SCI_PORT_RESETTING)
isci_port_hard_reset_complete(iport, SCI_SUCCESS); isci_port_hard_reset_complete(iport, SCI_SUCCESS);
else else
isci_port_not_ready(ihost, iport); dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n",
__func__, iport->physical_port_index);
/* Post and suspend the dummy remote node context for this port. */ /* Post and suspend the dummy remote node context for this port. */
sci_port_post_dummy_remote_node(iport); 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,21 +1599,7 @@ void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index)
{ {
INIT_LIST_HEAD(&iport->remote_dev_list); INIT_LIST_HEAD(&iport->remote_dev_list);
INIT_LIST_HEAD(&iport->domain_dev_list); INIT_LIST_HEAD(&iport->domain_dev_list);
spin_lock_init(&iport->state_lock);
iport->isci_host = ihost; iport->isci_host = ihost;
isci_port_change_state(iport, isci_freed);
}
/**
* isci_port_get_state() - This function gets the status of the port object.
* @isci_port: This parameter points to the isci_port object
*
* status of the object as a isci_status enum.
*/
enum isci_status isci_port_get_state(
struct isci_port *isci_port)
{
return isci_port->status;
} }
void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy)
......
...@@ -95,10 +95,8 @@ enum isci_status { ...@@ -95,10 +95,8 @@ enum isci_status {
* @timer: timeout start/stop operations * @timer: timeout start/stop operations
*/ */
struct isci_port { struct isci_port {
enum isci_status status;
struct isci_host *isci_host; struct isci_host *isci_host;
struct list_head remote_dev_list; struct list_head remote_dev_list;
spinlock_t state_lock;
struct list_head domain_dev_list; struct list_head domain_dev_list;
struct completion hard_reset_complete; struct completion hard_reset_complete;
enum sci_status hard_reset_status; enum sci_status hard_reset_status;
...@@ -294,9 +292,6 @@ void sci_port_get_attached_sas_address( ...@@ -294,9 +292,6 @@ void sci_port_get_attached_sas_address(
struct isci_port *iport, struct isci_port *iport,
struct sci_sas_address *sas_address); struct sci_sas_address *sas_address);
enum isci_status isci_port_get_state(
struct isci_port *isci_port);
void isci_port_formed(struct asd_sas_phy *); void isci_port_formed(struct asd_sas_phy *);
void isci_port_deformed(struct asd_sas_phy *); void isci_port_deformed(struct asd_sas_phy *);
......
...@@ -1394,10 +1394,6 @@ int isci_remote_device_found(struct domain_device *dev) ...@@ -1394,10 +1394,6 @@ int isci_remote_device_found(struct domain_device *dev)
if (!isci_port) if (!isci_port)
return -ENODEV; return -ENODEV;
if ((isci_stopping == isci_port_get_state(isci_port)) ||
(isci_stopped == isci_port_get_state(isci_port)))
return -ENODEV;
isci_device = isci_remote_device_alloc(isci_host, isci_port); isci_device = isci_remote_device_alloc(isci_host, isci_port);
if (!isci_device) if (!isci_device)
return -ENODEV; return -ENODEV;
......
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