isci: clarify phy to port lookups
While cleaning up the driver it is very tempting to convert scic_sds_get_* macros to their open coded equivalent. They are all just pointer dereferences *except* scic_sds_phy_get_port() which returns NULL if the phy is assigned to the dummy port. Clarify this by renaming it to phy_get_non_dummy_port(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -983,7 +983,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
|
|||||||
sci_phy = &ihost->phys[index].sci;
|
sci_phy = &ihost->phys[index].sci;
|
||||||
state = sci_phy->state_machine.current_state_id;
|
state = sci_phy->state_machine.current_state_id;
|
||||||
|
|
||||||
if (!scic_sds_phy_get_port(sci_phy))
|
if (!phy_get_non_dummy_port(sci_phy))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* The controller start operation is complete iff:
|
/* The controller start operation is complete iff:
|
||||||
@@ -1014,7 +1014,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
|
|||||||
sci_phy = &ihost->phys[scic->next_phy_to_start].sci;
|
sci_phy = &ihost->phys[scic->next_phy_to_start].sci;
|
||||||
|
|
||||||
if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
|
if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
|
||||||
if (scic_sds_phy_get_port(sci_phy) == NULL) {
|
if (phy_get_non_dummy_port(sci_phy) == NULL) {
|
||||||
scic->next_phy_to_start++;
|
scic->next_phy_to_start++;
|
||||||
|
|
||||||
/* Caution recursion ahead be forwarned
|
/* Caution recursion ahead be forwarned
|
||||||
|
@@ -287,7 +287,7 @@ static void scic_sds_phy_sata_timeout(void *phy)
|
|||||||
* port (i.e. it's contained in the dummy port). !NULL All other
|
* port (i.e. it's contained in the dummy port). !NULL All other
|
||||||
* values indicate a handle/pointer to the port containing the phy.
|
* values indicate a handle/pointer to the port containing the phy.
|
||||||
*/
|
*/
|
||||||
struct scic_sds_port *scic_sds_phy_get_port(
|
struct scic_sds_port *phy_get_non_dummy_port(
|
||||||
struct scic_sds_phy *sci_phy)
|
struct scic_sds_phy *sci_phy)
|
||||||
{
|
{
|
||||||
if (scic_sds_port_get_index(sci_phy->owning_port) == SCIC_SDS_DUMMY_PORT)
|
if (scic_sds_port_get_index(sci_phy->owning_port) == SCIC_SDS_DUMMY_PORT)
|
||||||
@@ -893,7 +893,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy,
|
|||||||
break;
|
break;
|
||||||
case SCU_EVENT_BROADCAST_CHANGE:
|
case SCU_EVENT_BROADCAST_CHANGE:
|
||||||
/* Broadcast change received. Notify the port. */
|
/* Broadcast change received. Notify the port. */
|
||||||
if (scic_sds_phy_get_port(sci_phy) != NULL)
|
if (phy_get_non_dummy_port(sci_phy) != NULL)
|
||||||
scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy);
|
scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy);
|
||||||
else
|
else
|
||||||
sci_phy->bcn_received_while_port_unassigned = true;
|
sci_phy->bcn_received_while_port_unassigned = true;
|
||||||
@@ -1238,7 +1238,7 @@ static void scic_sds_phy_stopped_state_enter(void *object)
|
|||||||
|
|
||||||
if (sci_phy->state_machine.previous_state_id != SCI_BASE_PHY_STATE_INITIAL)
|
if (sci_phy->state_machine.previous_state_id != SCI_BASE_PHY_STATE_INITIAL)
|
||||||
scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy),
|
scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy),
|
||||||
scic_sds_phy_get_port(sci_phy),
|
phy_get_non_dummy_port(sci_phy),
|
||||||
sci_phy);
|
sci_phy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1255,7 +1255,7 @@ static void scic_sds_phy_starting_state_enter(void *object)
|
|||||||
|
|
||||||
if (sci_phy->state_machine.previous_state_id == SCI_BASE_PHY_STATE_READY)
|
if (sci_phy->state_machine.previous_state_id == SCI_BASE_PHY_STATE_READY)
|
||||||
scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy),
|
scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy),
|
||||||
scic_sds_phy_get_port(sci_phy),
|
phy_get_non_dummy_port(sci_phy),
|
||||||
sci_phy);
|
sci_phy);
|
||||||
|
|
||||||
sci_base_state_machine_change_state(&sci_phy->state_machine,
|
sci_base_state_machine_change_state(&sci_phy->state_machine,
|
||||||
@@ -1267,7 +1267,7 @@ static void scic_sds_phy_ready_state_enter(void *object)
|
|||||||
struct scic_sds_phy *sci_phy = object;
|
struct scic_sds_phy *sci_phy = object;
|
||||||
|
|
||||||
scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy),
|
scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy),
|
||||||
scic_sds_phy_get_port(sci_phy),
|
phy_get_non_dummy_port(sci_phy),
|
||||||
sci_phy);
|
sci_phy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -524,8 +524,7 @@ void scic_sds_phy_construct(
|
|||||||
struct scic_sds_port *owning_port,
|
struct scic_sds_port *owning_port,
|
||||||
u8 phy_index);
|
u8 phy_index);
|
||||||
|
|
||||||
struct scic_sds_port *scic_sds_phy_get_port(
|
struct scic_sds_port *phy_get_non_dummy_port(struct scic_sds_phy *sci_phy);
|
||||||
struct scic_sds_phy *this_phy);
|
|
||||||
|
|
||||||
void scic_sds_phy_set_port(
|
void scic_sds_phy_set_port(
|
||||||
struct scic_sds_phy *this_phy,
|
struct scic_sds_phy *this_phy,
|
||||||
|
@@ -485,7 +485,7 @@ static enum sci_status scic_sds_port_set_phy(
|
|||||||
* not already have a phy assinged to the phy index. */
|
* not already have a phy assinged to the phy index. */
|
||||||
if (
|
if (
|
||||||
(port->phy_table[phy->phy_index] == NULL)
|
(port->phy_table[phy->phy_index] == NULL)
|
||||||
&& (scic_sds_phy_get_port(phy) == NULL)
|
&& (phy_get_non_dummy_port(phy) == NULL)
|
||||||
&& scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)
|
&& scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)
|
||||||
) {
|
) {
|
||||||
/*
|
/*
|
||||||
@@ -516,7 +516,7 @@ static enum sci_status scic_sds_port_clear_phy(
|
|||||||
{
|
{
|
||||||
/* Make sure that this phy is part of this port */
|
/* Make sure that this phy is part of this port */
|
||||||
if (port->phy_table[phy->phy_index] == phy &&
|
if (port->phy_table[phy->phy_index] == phy &&
|
||||||
scic_sds_phy_get_port(phy) == port) {
|
phy_get_non_dummy_port(phy) == port) {
|
||||||
struct scic_sds_controller *scic = port->owning_controller;
|
struct scic_sds_controller *scic = port->owning_controller;
|
||||||
struct isci_host *ihost = scic_to_ihost(scic);
|
struct isci_host *ihost = scic_to_ihost(scic);
|
||||||
|
|
||||||
|
@@ -353,7 +353,7 @@ static void scic_sds_mpc_agent_timeout_handler(void *object)
|
|||||||
|
|
||||||
if (configure_phy_mask & (1 << index)) {
|
if (configure_phy_mask & (1 << index)) {
|
||||||
port_agent->link_up_handler(scic, port_agent,
|
port_agent->link_up_handler(scic, port_agent,
|
||||||
scic_sds_phy_get_port(sci_phy),
|
phy_get_non_dummy_port(sci_phy),
|
||||||
sci_phy);
|
sci_phy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user