aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorPiotr Sawicki <piotr.sawicki@intel.com>2011-05-11 19:52:31 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:49 -0400
commit8bc80d303063d9540493be623df1c9a8dee9ccb8 (patch)
treed19b14ebb64cc8e6afb05fbaeb1e3626494728f4 /drivers/scsi/isci
parentd76f71d988ef48384593ad97ebc762d9257d96a8 (diff)
isci: unify port stop handlers
Implement the stop handlers directly in scic_sds_port_stop() Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/host.c4
-rw-r--r--drivers/scsi/isci/port.c75
-rw-r--r--drivers/scsi/isci/port.h7
3 files changed, 24 insertions, 62 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 7abfb663ca94..a942384f2798 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1591,10 +1591,8 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
1591 1591
1592 for (index = 0; index < scic->logical_port_entries; index++) { 1592 for (index = 0; index < scic->logical_port_entries; index++) {
1593 struct scic_sds_port *sci_port = &ihost->ports[index].sci; 1593 struct scic_sds_port *sci_port = &ihost->ports[index].sci;
1594 scic_sds_port_handler_t stop;
1595 1594
1596 stop = sci_port->state_handlers->stop_handler; 1595 port_status = scic_sds_port_stop(sci_port);
1597 port_status = stop(sci_port);
1598 1596
1599 if ((port_status != SCI_SUCCESS) && 1597 if ((port_status != SCI_SUCCESS) &&
1600 (port_status != SCI_FAILURE_INVALID_STATE)) { 1598 (port_status != SCI_FAILURE_INVALID_STATE)) {
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 64559e8e568d..62e9785acfb0 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -1179,17 +1179,6 @@ static void scic_port_enable_broadcast_change_notification(struct scic_sds_port
1179 * **************************************************************************** */ 1179 * **************************************************************************** */
1180 1180
1181/* 1181/*
1182 * This method is the general ready state stop handler for the struct scic_sds_port
1183 * object. This function will transition the ready substate machine to its
1184 * final state. enum sci_status SCI_SUCCESS
1185 */
1186static enum sci_status scic_sds_port_ready_substate_stop_handler(struct scic_sds_port *sci_port)
1187{
1188 port_state_machine_change(sci_port, SCI_BASE_PORT_STATE_STOPPING);
1189 return SCI_SUCCESS;
1190}
1191
1192/*
1193 * This method is the general ready substate complete io handler for the 1182 * This method is the general ready substate complete io handler for the
1194 * struct scic_sds_port object. This function decrments the outstanding request count 1183 * struct scic_sds_port object. This function decrments the outstanding request count
1195 * for this port object. enum sci_status SCI_SUCCESS 1184 * for this port object. enum sci_status SCI_SUCCESS
@@ -1480,12 +1469,6 @@ static enum sci_status default_port_handler(struct scic_sds_port *sci_port,
1480} 1469}
1481 1470
1482static enum sci_status 1471static enum sci_status
1483scic_sds_port_default_stop_handler(struct scic_sds_port *sci_port)
1484{
1485 return default_port_handler(sci_port, __func__);
1486}
1487
1488static enum sci_status
1489scic_sds_port_default_destruct_handler(struct scic_sds_port *sci_port) 1472scic_sds_port_default_destruct_handler(struct scic_sds_port *sci_port)
1490{ 1473{
1491 return default_port_handler(sci_port, __func__); 1474 return default_port_handler(sci_port, __func__);
@@ -1848,18 +1831,6 @@ static enum sci_status scic_sds_port_general_complete_io_handler(
1848} 1831}
1849 1832
1850/* 1833/*
1851 * This method takes the struct scic_sds_port that is in a stopped state and handles a
1852 * stop request. This function takes no action. enum sci_status SCI_SUCCESS the
1853 * stop request is successful as the struct scic_sds_port object is already stopped.
1854 */
1855static enum sci_status scic_sds_port_stopped_state_stop_handler(
1856 struct scic_sds_port *port)
1857{
1858 /* We are already stopped so there is nothing to do here */
1859 return SCI_SUCCESS;
1860}
1861
1862/*
1863 * This method takes the struct scic_sds_port that is in a stopped state and handles 1834 * This method takes the struct scic_sds_port that is in a stopped state and handles
1864 * the destruct request. The stopped state is the only state in which the 1835 * the destruct request. The stopped state is the only state in which the
1865 * struct scic_sds_port can be destroyed. This function causes the port object to 1836 * struct scic_sds_port can be destroyed. This function causes the port object to
@@ -1960,22 +1931,6 @@ static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
1960 * * RESETTING STATE HANDLERS 1931 * * RESETTING STATE HANDLERS
1961 * **************************************************************************** */ 1932 * **************************************************************************** */
1962 1933
1963/**
1964 *
1965 * @port: This is the port object which is being requested to stop.
1966 *
1967 * This method will stop a failed port. This causes a transition to the
1968 * stopping state. enum sci_status SCI_SUCCESS
1969 */
1970static enum sci_status scic_sds_port_reset_state_stop_handler(
1971 struct scic_sds_port *port)
1972{
1973 port_state_machine_change(port,
1974 SCI_BASE_PORT_STATE_STOPPING);
1975
1976 return SCI_SUCCESS;
1977}
1978
1979/* 1934/*
1980 * This method will transition a failed port to its ready state. The port 1935 * This method will transition a failed port to its ready state. The port
1981 * failed because a hard reset request timed out but at some time later one or 1936 * failed because a hard reset request timed out but at some time later one or
@@ -2093,9 +2048,30 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port)
2093 return status; 2048 return status;
2094} 2049}
2095 2050
2051enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port)
2052{
2053 enum scic_sds_port_states state;
2054
2055 state = sci_port->state_machine.current_state_id;
2056 switch (state) {
2057 case SCI_BASE_PORT_STATE_STOPPED:
2058 return SCI_SUCCESS;
2059 case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
2060 case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
2061 case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING:
2062 case SCI_BASE_PORT_STATE_RESETTING:
2063 port_state_machine_change(sci_port,
2064 SCI_BASE_PORT_STATE_STOPPING);
2065 return SCI_SUCCESS;
2066 default:
2067 dev_warn(sciport_to_dev(sci_port),
2068 "%s: in wrong state: %d\n", __func__, state);
2069 return SCI_FAILURE_INVALID_STATE;
2070 }
2071}
2072
2096static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] = { 2073static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] = {
2097 [SCI_BASE_PORT_STATE_STOPPED] = { 2074 [SCI_BASE_PORT_STATE_STOPPED] = {
2098 .stop_handler = scic_sds_port_stopped_state_stop_handler,
2099 .destruct_handler = scic_sds_port_stopped_state_destruct_handler, 2075 .destruct_handler = scic_sds_port_stopped_state_destruct_handler,
2100 .reset_handler = scic_sds_port_default_reset_handler, 2076 .reset_handler = scic_sds_port_default_reset_handler,
2101 .add_phy_handler = scic_sds_port_stopped_state_add_phy_handler, 2077 .add_phy_handler = scic_sds_port_stopped_state_add_phy_handler,
@@ -2108,7 +2084,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2108 .complete_io_handler = scic_sds_port_default_complete_io_handler 2084 .complete_io_handler = scic_sds_port_default_complete_io_handler
2109 }, 2085 },
2110 [SCI_BASE_PORT_STATE_STOPPING] = { 2086 [SCI_BASE_PORT_STATE_STOPPING] = {
2111 .stop_handler = scic_sds_port_default_stop_handler,
2112 .destruct_handler = scic_sds_port_default_destruct_handler, 2087 .destruct_handler = scic_sds_port_default_destruct_handler,
2113 .reset_handler = scic_sds_port_default_reset_handler, 2088 .reset_handler = scic_sds_port_default_reset_handler,
2114 .add_phy_handler = scic_sds_port_default_add_phy_handler, 2089 .add_phy_handler = scic_sds_port_default_add_phy_handler,
@@ -2121,7 +2096,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2121 .complete_io_handler = scic_sds_port_stopping_state_complete_io_handler 2096 .complete_io_handler = scic_sds_port_stopping_state_complete_io_handler
2122 }, 2097 },
2123 [SCI_BASE_PORT_STATE_READY] = { 2098 [SCI_BASE_PORT_STATE_READY] = {
2124 .stop_handler = scic_sds_port_default_stop_handler,
2125 .destruct_handler = scic_sds_port_default_destruct_handler, 2099 .destruct_handler = scic_sds_port_default_destruct_handler,
2126 .reset_handler = scic_sds_port_default_reset_handler, 2100 .reset_handler = scic_sds_port_default_reset_handler,
2127 .add_phy_handler = scic_sds_port_default_add_phy_handler, 2101 .add_phy_handler = scic_sds_port_default_add_phy_handler,
@@ -2134,7 +2108,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2134 .complete_io_handler = scic_sds_port_general_complete_io_handler 2108 .complete_io_handler = scic_sds_port_general_complete_io_handler
2135 }, 2109 },
2136 [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = { 2110 [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = {
2137 .stop_handler = scic_sds_port_ready_substate_stop_handler,
2138 .destruct_handler = scic_sds_port_default_destruct_handler, 2111 .destruct_handler = scic_sds_port_default_destruct_handler,
2139 .reset_handler = scic_sds_port_default_reset_handler, 2112 .reset_handler = scic_sds_port_default_reset_handler,
2140 .add_phy_handler = scic_sds_port_ready_substate_add_phy_handler, 2113 .add_phy_handler = scic_sds_port_ready_substate_add_phy_handler,
@@ -2147,7 +2120,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2147 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler, 2120 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler,
2148 }, 2121 },
2149 [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = { 2122 [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = {
2150 .stop_handler = scic_sds_port_ready_substate_stop_handler,
2151 .destruct_handler = scic_sds_port_default_destruct_handler, 2123 .destruct_handler = scic_sds_port_default_destruct_handler,
2152 .reset_handler = scic_sds_port_ready_operational_substate_reset_handler, 2124 .reset_handler = scic_sds_port_ready_operational_substate_reset_handler,
2153 .add_phy_handler = scic_sds_port_ready_substate_add_phy_handler, 2125 .add_phy_handler = scic_sds_port_ready_substate_add_phy_handler,
@@ -2160,7 +2132,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2160 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler, 2132 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler,
2161 }, 2133 },
2162 [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = { 2134 [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = {
2163 .stop_handler = scic_sds_port_ready_substate_stop_handler,
2164 .destruct_handler = scic_sds_port_default_destruct_handler, 2135 .destruct_handler = scic_sds_port_default_destruct_handler,
2165 .reset_handler = scic_sds_port_default_reset_handler, 2136 .reset_handler = scic_sds_port_default_reset_handler,
2166 .add_phy_handler = scic_sds_port_ready_configuring_substate_add_phy_handler, 2137 .add_phy_handler = scic_sds_port_ready_configuring_substate_add_phy_handler,
@@ -2173,7 +2144,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2173 .complete_io_handler = scic_sds_port_ready_configuring_substate_complete_io_handler 2144 .complete_io_handler = scic_sds_port_ready_configuring_substate_complete_io_handler
2174 }, 2145 },
2175 [SCI_BASE_PORT_STATE_RESETTING] = { 2146 [SCI_BASE_PORT_STATE_RESETTING] = {
2176 .stop_handler = scic_sds_port_reset_state_stop_handler,
2177 .destruct_handler = scic_sds_port_default_destruct_handler, 2147 .destruct_handler = scic_sds_port_default_destruct_handler,
2178 .reset_handler = scic_sds_port_default_reset_handler, 2148 .reset_handler = scic_sds_port_default_reset_handler,
2179 .add_phy_handler = scic_sds_port_default_add_phy_handler, 2149 .add_phy_handler = scic_sds_port_default_add_phy_handler,
@@ -2186,7 +2156,6 @@ static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] =
2186 .complete_io_handler = scic_sds_port_general_complete_io_handler 2156 .complete_io_handler = scic_sds_port_general_complete_io_handler
2187 }, 2157 },
2188 [SCI_BASE_PORT_STATE_FAILED] = { 2158 [SCI_BASE_PORT_STATE_FAILED] = {
2189 .stop_handler = scic_sds_port_default_stop_handler,
2190 .destruct_handler = scic_sds_port_default_destruct_handler, 2159 .destruct_handler = scic_sds_port_default_destruct_handler,
2191 .reset_handler = scic_sds_port_default_reset_handler, 2160 .reset_handler = scic_sds_port_default_reset_handler,
2192 .add_phy_handler = scic_sds_port_default_add_phy_handler, 2161 .add_phy_handler = scic_sds_port_default_add_phy_handler,
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h
index 2ad205100f25..843eb62a3090 100644
--- a/drivers/scsi/isci/port.h
+++ b/drivers/scsi/isci/port.h
@@ -313,12 +313,6 @@ typedef enum sci_status (*scic_sds_port_io_request_handler_t)(struct scic_sds_po
313 313
314struct scic_sds_port_state_handler { 314struct scic_sds_port_state_handler {
315 /** 315 /**
316 * The stop_handler specifies the method invoked when a user
317 * attempts to stop a port.
318 */
319 scic_sds_port_handler_t stop_handler;
320
321 /**
322 * The destruct_handler specifies the method invoked when attempting to 316 * The destruct_handler specifies the method invoked when attempting to
323 * destruct a port. 317 * destruct a port.
324 */ 318 */
@@ -412,6 +406,7 @@ enum sci_status scic_sds_port_initialize(
412 void __iomem *viit_registers); 406 void __iomem *viit_registers);
413 407
414enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port); 408enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port);
409enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port);
415 410
416enum sci_status scic_sds_port_add_phy( 411enum sci_status scic_sds_port_add_phy(
417 struct scic_sds_port *sci_port, 412 struct scic_sds_port *sci_port,