diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-06-29 16:09:25 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:52 -0400 |
commit | ffe191c92ff195d73f9130b1490045ca2dd4c5e0 (patch) | |
tree | c14a78903734b7f5e662e7cf49db4d7fd24e4d71 /drivers/scsi/isci/remote_device.c | |
parent | 76802ce6756d605fbd7a9a43c196e9a471b3e57c (diff) |
isci: unify isci_port and scic_sds_port
Remove the distinction between these two implementations and unify on
isci_port (local instances named iport). The duplicate '->owning_port' and
'->isci_port' in both isci_phy and isci_remote_device will be fixed in a later
patch... this is just the straightforward rename/unification.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 71ab9081fe2..627cf731bad 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -450,11 +450,11 @@ static void scic_sds_remote_device_start_request(struct scic_sds_remote_device * | |||
450 | struct isci_request *ireq, | 450 | struct isci_request *ireq, |
451 | enum sci_status status) | 451 | enum sci_status status) |
452 | { | 452 | { |
453 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 453 | struct isci_port *iport = sci_dev->owning_port; |
454 | 454 | ||
455 | /* cleanup requests that failed after starting on the port */ | 455 | /* cleanup requests that failed after starting on the port */ |
456 | if (status != SCI_SUCCESS) | 456 | if (status != SCI_SUCCESS) |
457 | scic_sds_port_complete_io(sci_port, sci_dev, ireq); | 457 | scic_sds_port_complete_io(iport, sci_dev, ireq); |
458 | else { | 458 | else { |
459 | kref_get(&sci_dev_to_idev(sci_dev)->kref); | 459 | kref_get(&sci_dev_to_idev(sci_dev)->kref); |
460 | scic_sds_remote_device_increment_request_count(sci_dev); | 460 | scic_sds_remote_device_increment_request_count(sci_dev); |
@@ -467,7 +467,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
467 | { | 467 | { |
468 | struct sci_base_state_machine *sm = &sci_dev->sm; | 468 | struct sci_base_state_machine *sm = &sci_dev->sm; |
469 | enum scic_sds_remote_device_states state = sm->current_state_id; | 469 | enum scic_sds_remote_device_states state = sm->current_state_id; |
470 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 470 | struct isci_port *iport = sci_dev->owning_port; |
471 | enum sci_status status; | 471 | enum sci_status status; |
472 | 472 | ||
473 | switch (state) { | 473 | switch (state) { |
@@ -489,7 +489,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
489 | * successful it will start the request for the port object then | 489 | * successful it will start the request for the port object then |
490 | * increment its own request count. | 490 | * increment its own request count. |
491 | */ | 491 | */ |
492 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 492 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
493 | if (status != SCI_SUCCESS) | 493 | if (status != SCI_SUCCESS) |
494 | return status; | 494 | return status; |
495 | 495 | ||
@@ -511,7 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
511 | enum scic_sds_remote_device_states new_state; | 511 | enum scic_sds_remote_device_states new_state; |
512 | struct sas_task *task = isci_request_access_task(ireq); | 512 | struct sas_task *task = isci_request_access_task(ireq); |
513 | 513 | ||
514 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 514 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
515 | if (status != SCI_SUCCESS) | 515 | if (status != SCI_SUCCESS) |
516 | return status; | 516 | return status; |
517 | 517 | ||
@@ -536,7 +536,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
536 | struct sas_task *task = isci_request_access_task(ireq); | 536 | struct sas_task *task = isci_request_access_task(ireq); |
537 | 537 | ||
538 | if (task->ata_task.use_ncq) { | 538 | if (task->ata_task.use_ncq) { |
539 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 539 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
540 | if (status != SCI_SUCCESS) | 540 | if (status != SCI_SUCCESS) |
541 | return status; | 541 | return status; |
542 | 542 | ||
@@ -552,7 +552,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
552 | case SCI_STP_DEV_AWAIT_RESET: | 552 | case SCI_STP_DEV_AWAIT_RESET: |
553 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 553 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
554 | case SCI_SMP_DEV_IDLE: | 554 | case SCI_SMP_DEV_IDLE: |
555 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 555 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
556 | if (status != SCI_SUCCESS) | 556 | if (status != SCI_SUCCESS) |
557 | return status; | 557 | return status; |
558 | 558 | ||
@@ -579,7 +579,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
579 | return status; | 579 | return status; |
580 | } | 580 | } |
581 | 581 | ||
582 | static enum sci_status common_complete_io(struct scic_sds_port *sci_port, | 582 | static enum sci_status common_complete_io(struct isci_port *iport, |
583 | struct scic_sds_remote_device *sci_dev, | 583 | struct scic_sds_remote_device *sci_dev, |
584 | struct isci_request *ireq) | 584 | struct isci_request *ireq) |
585 | { | 585 | { |
@@ -589,7 +589,7 @@ static enum sci_status common_complete_io(struct scic_sds_port *sci_port, | |||
589 | if (status != SCI_SUCCESS) | 589 | if (status != SCI_SUCCESS) |
590 | return status; | 590 | return status; |
591 | 591 | ||
592 | status = scic_sds_port_complete_io(sci_port, sci_dev, ireq); | 592 | status = scic_sds_port_complete_io(iport, sci_dev, ireq); |
593 | if (status != SCI_SUCCESS) | 593 | if (status != SCI_SUCCESS) |
594 | return status; | 594 | return status; |
595 | 595 | ||
@@ -603,7 +603,7 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
603 | { | 603 | { |
604 | struct sci_base_state_machine *sm = &sci_dev->sm; | 604 | struct sci_base_state_machine *sm = &sci_dev->sm; |
605 | enum scic_sds_remote_device_states state = sm->current_state_id; | 605 | enum scic_sds_remote_device_states state = sm->current_state_id; |
606 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 606 | struct isci_port *iport = sci_dev->owning_port; |
607 | enum sci_status status; | 607 | enum sci_status status; |
608 | 608 | ||
609 | switch (state) { | 609 | switch (state) { |
@@ -621,12 +621,12 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
621 | case SCI_DEV_READY: | 621 | case SCI_DEV_READY: |
622 | case SCI_STP_DEV_AWAIT_RESET: | 622 | case SCI_STP_DEV_AWAIT_RESET: |
623 | case SCI_DEV_RESETTING: | 623 | case SCI_DEV_RESETTING: |
624 | status = common_complete_io(sci_port, sci_dev, ireq); | 624 | status = common_complete_io(iport, sci_dev, ireq); |
625 | break; | 625 | break; |
626 | case SCI_STP_DEV_CMD: | 626 | case SCI_STP_DEV_CMD: |
627 | case SCI_STP_DEV_NCQ: | 627 | case SCI_STP_DEV_NCQ: |
628 | case SCI_STP_DEV_NCQ_ERROR: | 628 | case SCI_STP_DEV_NCQ_ERROR: |
629 | status = common_complete_io(sci_port, sci_dev, ireq); | 629 | status = common_complete_io(iport, sci_dev, ireq); |
630 | if (status != SCI_SUCCESS) | 630 | if (status != SCI_SUCCESS) |
631 | break; | 631 | break; |
632 | 632 | ||
@@ -641,13 +641,13 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
641 | sci_change_state(sm, SCI_STP_DEV_IDLE); | 641 | sci_change_state(sm, SCI_STP_DEV_IDLE); |
642 | break; | 642 | break; |
643 | case SCI_SMP_DEV_CMD: | 643 | case SCI_SMP_DEV_CMD: |
644 | status = common_complete_io(sci_port, sci_dev, ireq); | 644 | status = common_complete_io(iport, sci_dev, ireq); |
645 | if (status != SCI_SUCCESS) | 645 | if (status != SCI_SUCCESS) |
646 | break; | 646 | break; |
647 | sci_change_state(sm, SCI_SMP_DEV_IDLE); | 647 | sci_change_state(sm, SCI_SMP_DEV_IDLE); |
648 | break; | 648 | break; |
649 | case SCI_DEV_STOPPING: | 649 | case SCI_DEV_STOPPING: |
650 | status = common_complete_io(sci_port, sci_dev, ireq); | 650 | status = common_complete_io(iport, sci_dev, ireq); |
651 | if (status != SCI_SUCCESS) | 651 | if (status != SCI_SUCCESS) |
652 | break; | 652 | break; |
653 | 653 | ||
@@ -661,7 +661,7 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
661 | if (status != SCI_SUCCESS) | 661 | if (status != SCI_SUCCESS) |
662 | dev_err(scirdev_to_dev(sci_dev), | 662 | dev_err(scirdev_to_dev(sci_dev), |
663 | "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " | 663 | "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " |
664 | "could not complete\n", __func__, sci_port, | 664 | "could not complete\n", __func__, iport, |
665 | sci_dev, ireq, status); | 665 | sci_dev, ireq, status); |
666 | else | 666 | else |
667 | isci_put_device(sci_dev_to_idev(sci_dev)); | 667 | isci_put_device(sci_dev_to_idev(sci_dev)); |
@@ -684,7 +684,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
684 | { | 684 | { |
685 | struct sci_base_state_machine *sm = &sci_dev->sm; | 685 | struct sci_base_state_machine *sm = &sci_dev->sm; |
686 | enum scic_sds_remote_device_states state = sm->current_state_id; | 686 | enum scic_sds_remote_device_states state = sm->current_state_id; |
687 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 687 | struct isci_port *iport = sci_dev->owning_port; |
688 | enum sci_status status; | 688 | enum sci_status status; |
689 | 689 | ||
690 | switch (state) { | 690 | switch (state) { |
@@ -706,7 +706,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
706 | case SCI_STP_DEV_NCQ: | 706 | case SCI_STP_DEV_NCQ: |
707 | case SCI_STP_DEV_NCQ_ERROR: | 707 | case SCI_STP_DEV_NCQ_ERROR: |
708 | case SCI_STP_DEV_AWAIT_RESET: | 708 | case SCI_STP_DEV_AWAIT_RESET: |
709 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 709 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
710 | if (status != SCI_SUCCESS) | 710 | if (status != SCI_SUCCESS) |
711 | return status; | 711 | return status; |
712 | 712 | ||
@@ -746,7 +746,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
746 | */ | 746 | */ |
747 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; | 747 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; |
748 | case SCI_DEV_READY: | 748 | case SCI_DEV_READY: |
749 | status = scic_sds_port_start_io(sci_port, sci_dev, ireq); | 749 | status = scic_sds_port_start_io(iport, sci_dev, ireq); |
750 | if (status != SCI_SUCCESS) | 750 | if (status != SCI_SUCCESS) |
751 | return status; | 751 | return status; |
752 | 752 | ||
@@ -1064,10 +1064,10 @@ static const struct sci_base_state scic_sds_remote_device_state_table[] = { | |||
1064 | * scic_remote_device_[de]a_construct(). scic_remote_device_destruct() | 1064 | * scic_remote_device_[de]a_construct(). scic_remote_device_destruct() |
1065 | * frees the remote_node_context(s) for the device. | 1065 | * frees the remote_node_context(s) for the device. |
1066 | */ | 1066 | */ |
1067 | static void scic_remote_device_construct(struct scic_sds_port *sci_port, | 1067 | static void scic_remote_device_construct(struct isci_port *iport, |
1068 | struct scic_sds_remote_device *sci_dev) | 1068 | struct scic_sds_remote_device *sci_dev) |
1069 | { | 1069 | { |
1070 | sci_dev->owning_port = sci_port; | 1070 | sci_dev->owning_port = iport; |
1071 | sci_dev->started_request_count = 0; | 1071 | sci_dev->started_request_count = 0; |
1072 | 1072 | ||
1073 | sci_init_sm(&sci_dev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL); | 1073 | sci_init_sm(&sci_dev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL); |
@@ -1090,20 +1090,20 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port, | |||
1090 | * sata-only controller instance. | 1090 | * sata-only controller instance. |
1091 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. | 1091 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. |
1092 | */ | 1092 | */ |
1093 | static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci_port, | 1093 | static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, |
1094 | struct scic_sds_remote_device *sci_dev) | 1094 | struct scic_sds_remote_device *sci_dev) |
1095 | { | 1095 | { |
1096 | enum sci_status status; | 1096 | enum sci_status status; |
1097 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1097 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
1098 | 1098 | ||
1099 | scic_remote_device_construct(sci_port, sci_dev); | 1099 | scic_remote_device_construct(iport, sci_dev); |
1100 | 1100 | ||
1101 | /* | 1101 | /* |
1102 | * This information is request to determine how many remote node context | 1102 | * This information is request to determine how many remote node context |
1103 | * entries will be needed to store the remote node. | 1103 | * entries will be needed to store the remote node. |
1104 | */ | 1104 | */ |
1105 | sci_dev->is_direct_attached = true; | 1105 | sci_dev->is_direct_attached = true; |
1106 | status = scic_sds_controller_allocate_remote_node_context(sci_port->owning_controller, | 1106 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, |
1107 | sci_dev, | 1107 | sci_dev, |
1108 | &sci_dev->rnc.remote_node_index); | 1108 | &sci_dev->rnc.remote_node_index); |
1109 | 1109 | ||
@@ -1116,7 +1116,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci | |||
1116 | else | 1116 | else |
1117 | return SCI_FAILURE_UNSUPPORTED_PROTOCOL; | 1117 | return SCI_FAILURE_UNSUPPORTED_PROTOCOL; |
1118 | 1118 | ||
1119 | sci_dev->connection_rate = scic_sds_port_get_max_allowed_speed(sci_port); | 1119 | sci_dev->connection_rate = scic_sds_port_get_max_allowed_speed(iport); |
1120 | 1120 | ||
1121 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ | 1121 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ |
1122 | sci_dev->device_port_width = 1; | 1122 | sci_dev->device_port_width = 1; |
@@ -1136,15 +1136,15 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci | |||
1136 | * sata-only controller instance. | 1136 | * sata-only controller instance. |
1137 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. | 1137 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. |
1138 | */ | 1138 | */ |
1139 | static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci_port, | 1139 | static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, |
1140 | struct scic_sds_remote_device *sci_dev) | 1140 | struct scic_sds_remote_device *sci_dev) |
1141 | { | 1141 | { |
1142 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1142 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
1143 | enum sci_status status; | 1143 | enum sci_status status; |
1144 | 1144 | ||
1145 | scic_remote_device_construct(sci_port, sci_dev); | 1145 | scic_remote_device_construct(iport, sci_dev); |
1146 | 1146 | ||
1147 | status = scic_sds_controller_allocate_remote_node_context(sci_port->owning_controller, | 1147 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, |
1148 | sci_dev, | 1148 | sci_dev, |
1149 | &sci_dev->rnc.remote_node_index); | 1149 | &sci_dev->rnc.remote_node_index); |
1150 | if (status != SCI_SUCCESS) | 1150 | if (status != SCI_SUCCESS) |
@@ -1163,7 +1163,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci | |||
1163 | * connection the logical link rate is that same as the | 1163 | * connection the logical link rate is that same as the |
1164 | * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay | 1164 | * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay |
1165 | * one another, so this code works for both situations. */ | 1165 | * one another, so this code works for both situations. */ |
1166 | sci_dev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(sci_port), | 1166 | sci_dev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(iport), |
1167 | dev->linkrate); | 1167 | dev->linkrate); |
1168 | 1168 | ||
1169 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ | 1169 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ |
@@ -1212,15 +1212,14 @@ static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *s | |||
1212 | static enum sci_status isci_remote_device_construct(struct isci_port *iport, | 1212 | static enum sci_status isci_remote_device_construct(struct isci_port *iport, |
1213 | struct isci_remote_device *idev) | 1213 | struct isci_remote_device *idev) |
1214 | { | 1214 | { |
1215 | struct scic_sds_port *sci_port = &iport->sci; | ||
1216 | struct isci_host *ihost = iport->isci_host; | 1215 | struct isci_host *ihost = iport->isci_host; |
1217 | struct domain_device *dev = idev->domain_dev; | 1216 | struct domain_device *dev = idev->domain_dev; |
1218 | enum sci_status status; | 1217 | enum sci_status status; |
1219 | 1218 | ||
1220 | if (dev->parent && dev_is_expander(dev->parent)) | 1219 | if (dev->parent && dev_is_expander(dev->parent)) |
1221 | status = scic_remote_device_ea_construct(sci_port, &idev->sci); | 1220 | status = scic_remote_device_ea_construct(iport, &idev->sci); |
1222 | else | 1221 | else |
1223 | status = scic_remote_device_da_construct(sci_port, &idev->sci); | 1222 | status = scic_remote_device_da_construct(iport, &idev->sci); |
1224 | 1223 | ||
1225 | if (status != SCI_SUCCESS) { | 1224 | if (status != SCI_SUCCESS) { |
1226 | dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n", | 1225 | dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n", |