diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-12 09:00:31 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:48 -0400 |
commit | 4f20ef4f57aa52fd3356c143a8f3d2bd18dc61fc (patch) | |
tree | 27c2c01305cad71eb6ebaf96e67ad3ce8d834c30 | |
parent | 5b1d4af25186f5d23dae7a538d8472dacd9486c8 (diff) |
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>
-rw-r--r-- | drivers/scsi/isci/host.c | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.c | 10 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.h | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/port.c | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/port_config.c | 2 |
5 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 675eddd3963e..2ef1c592a16f 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -983,7 +983,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
983 | sci_phy = &ihost->phys[index].sci; | 983 | sci_phy = &ihost->phys[index].sci; |
984 | state = sci_phy->state_machine.current_state_id; | 984 | state = sci_phy->state_machine.current_state_id; |
985 | 985 | ||
986 | if (!scic_sds_phy_get_port(sci_phy)) | 986 | if (!phy_get_non_dummy_port(sci_phy)) |
987 | continue; | 987 | continue; |
988 | 988 | ||
989 | /* The controller start operation is complete iff: | 989 | /* 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 | |||
1014 | sci_phy = &ihost->phys[scic->next_phy_to_start].sci; | 1014 | sci_phy = &ihost->phys[scic->next_phy_to_start].sci; |
1015 | 1015 | ||
1016 | if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { | 1016 | if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { |
1017 | if (scic_sds_phy_get_port(sci_phy) == NULL) { | 1017 | if (phy_get_non_dummy_port(sci_phy) == NULL) { |
1018 | scic->next_phy_to_start++; | 1018 | scic->next_phy_to_start++; |
1019 | 1019 | ||
1020 | /* Caution recursion ahead be forwarned | 1020 | /* Caution recursion ahead be forwarned |
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 9a5ec375f767..8bd1a85f621e 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -287,7 +287,7 @@ static void scic_sds_phy_sata_timeout(void *phy) | |||
287 | * port (i.e. it's contained in the dummy port). !NULL All other | 287 | * port (i.e. it's contained in the dummy port). !NULL All other |
288 | * values indicate a handle/pointer to the port containing the phy. | 288 | * values indicate a handle/pointer to the port containing the phy. |
289 | */ | 289 | */ |
290 | struct scic_sds_port *scic_sds_phy_get_port( | 290 | struct scic_sds_port *phy_get_non_dummy_port( |
291 | struct scic_sds_phy *sci_phy) | 291 | struct scic_sds_phy *sci_phy) |
292 | { | 292 | { |
293 | if (scic_sds_port_get_index(sci_phy->owning_port) == SCIC_SDS_DUMMY_PORT) | 293 | 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, | |||
893 | break; | 893 | break; |
894 | case SCU_EVENT_BROADCAST_CHANGE: | 894 | case SCU_EVENT_BROADCAST_CHANGE: |
895 | /* Broadcast change received. Notify the port. */ | 895 | /* Broadcast change received. Notify the port. */ |
896 | if (scic_sds_phy_get_port(sci_phy) != NULL) | 896 | if (phy_get_non_dummy_port(sci_phy) != NULL) |
897 | scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy); | 897 | scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy); |
898 | else | 898 | else |
899 | sci_phy->bcn_received_while_port_unassigned = true; | 899 | sci_phy->bcn_received_while_port_unassigned = true; |
@@ -1238,7 +1238,7 @@ static void scic_sds_phy_stopped_state_enter(void *object) | |||
1238 | 1238 | ||
1239 | if (sci_phy->state_machine.previous_state_id != SCI_BASE_PHY_STATE_INITIAL) | 1239 | if (sci_phy->state_machine.previous_state_id != SCI_BASE_PHY_STATE_INITIAL) |
1240 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), | 1240 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), |
1241 | scic_sds_phy_get_port(sci_phy), | 1241 | phy_get_non_dummy_port(sci_phy), |
1242 | sci_phy); | 1242 | sci_phy); |
1243 | } | 1243 | } |
1244 | 1244 | ||
@@ -1255,7 +1255,7 @@ static void scic_sds_phy_starting_state_enter(void *object) | |||
1255 | 1255 | ||
1256 | if (sci_phy->state_machine.previous_state_id == SCI_BASE_PHY_STATE_READY) | 1256 | if (sci_phy->state_machine.previous_state_id == SCI_BASE_PHY_STATE_READY) |
1257 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), | 1257 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), |
1258 | scic_sds_phy_get_port(sci_phy), | 1258 | phy_get_non_dummy_port(sci_phy), |
1259 | sci_phy); | 1259 | sci_phy); |
1260 | 1260 | ||
1261 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 1261 | sci_base_state_machine_change_state(&sci_phy->state_machine, |
@@ -1267,7 +1267,7 @@ static void scic_sds_phy_ready_state_enter(void *object) | |||
1267 | struct scic_sds_phy *sci_phy = object; | 1267 | struct scic_sds_phy *sci_phy = object; |
1268 | 1268 | ||
1269 | scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy), | 1269 | scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy), |
1270 | scic_sds_phy_get_port(sci_phy), | 1270 | phy_get_non_dummy_port(sci_phy), |
1271 | sci_phy); | 1271 | sci_phy); |
1272 | 1272 | ||
1273 | } | 1273 | } |
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index 57708550a186..7694ec4d76b5 100644 --- a/drivers/scsi/isci/phy.h +++ b/drivers/scsi/isci/phy.h | |||
@@ -524,8 +524,7 @@ void scic_sds_phy_construct( | |||
524 | struct scic_sds_port *owning_port, | 524 | struct scic_sds_port *owning_port, |
525 | u8 phy_index); | 525 | u8 phy_index); |
526 | 526 | ||
527 | struct scic_sds_port *scic_sds_phy_get_port( | 527 | struct scic_sds_port *phy_get_non_dummy_port(struct scic_sds_phy *sci_phy); |
528 | struct scic_sds_phy *this_phy); | ||
529 | 528 | ||
530 | void scic_sds_phy_set_port( | 529 | void scic_sds_phy_set_port( |
531 | struct scic_sds_phy *this_phy, | 530 | struct scic_sds_phy *this_phy, |
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index dbff28396dd8..6d2633051adc 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -485,7 +485,7 @@ static enum sci_status scic_sds_port_set_phy( | |||
485 | * not already have a phy assinged to the phy index. */ | 485 | * not already have a phy assinged to the phy index. */ |
486 | if ( | 486 | if ( |
487 | (port->phy_table[phy->phy_index] == NULL) | 487 | (port->phy_table[phy->phy_index] == NULL) |
488 | && (scic_sds_phy_get_port(phy) == NULL) | 488 | && (phy_get_non_dummy_port(phy) == NULL) |
489 | && scic_sds_port_is_valid_phy_assignment(port, phy->phy_index) | 489 | && scic_sds_port_is_valid_phy_assignment(port, phy->phy_index) |
490 | ) { | 490 | ) { |
491 | /* | 491 | /* |
@@ -516,7 +516,7 @@ static enum sci_status scic_sds_port_clear_phy( | |||
516 | { | 516 | { |
517 | /* Make sure that this phy is part of this port */ | 517 | /* Make sure that this phy is part of this port */ |
518 | if (port->phy_table[phy->phy_index] == phy && | 518 | if (port->phy_table[phy->phy_index] == phy && |
519 | scic_sds_phy_get_port(phy) == port) { | 519 | phy_get_non_dummy_port(phy) == port) { |
520 | struct scic_sds_controller *scic = port->owning_controller; | 520 | struct scic_sds_controller *scic = port->owning_controller; |
521 | struct isci_host *ihost = scic_to_ihost(scic); | 521 | struct isci_host *ihost = scic_to_ihost(scic); |
522 | 522 | ||
diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c index 028ffa370c90..ca76f493c30d 100644 --- a/drivers/scsi/isci/port_config.c +++ b/drivers/scsi/isci/port_config.c | |||
@@ -353,7 +353,7 @@ static void scic_sds_mpc_agent_timeout_handler(void *object) | |||
353 | 353 | ||
354 | if (configure_phy_mask & (1 << index)) { | 354 | if (configure_phy_mask & (1 << index)) { |
355 | port_agent->link_up_handler(scic, port_agent, | 355 | port_agent->link_up_handler(scic, port_agent, |
356 | scic_sds_phy_get_port(sci_phy), | 356 | phy_get_non_dummy_port(sci_phy), |
357 | sci_phy); | 357 | sci_phy); |
358 | } | 358 | } |
359 | } | 359 | } |