diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-07 13:11:43 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:47 -0400 |
commit | e531381e2f8a68b8737c63c7bb890ad80b2470bd (patch) | |
tree | b3f4deb3286269fa62e5c2ff94338dab4743f2c9 /drivers/scsi/isci/port.c | |
parent | 4b33981ade7cf723f3f32809e34192376c9a10f8 (diff) |
isci: unify port data structures
Make scic_sds_port a member of isci_port and merge their lifetimes which
means removing the port table from scic_sds_controller in favor of the
one at the isci_host level. Merge ihost->sas_ports into ihost->ports.
_
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/port.c')
-rw-r--r-- | drivers/scsi/isci/port.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 5e87fedb5676..35e2e517f671 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -70,29 +70,30 @@ | |||
70 | #include "request.h" | 70 | #include "request.h" |
71 | #include "core/scic_sds_controller.h" | 71 | #include "core/scic_sds_controller.h" |
72 | 72 | ||
73 | static void isci_port_change_state( | 73 | static void isci_port_change_state(struct isci_port *iport, enum isci_status status) |
74 | struct isci_port *isci_port, | 74 | { |
75 | enum isci_status status); | 75 | unsigned long flags; |
76 | 76 | ||
77 | dev_dbg(&iport->isci_host->pdev->dev, | ||
78 | "%s: iport = %p, state = 0x%x\n", | ||
79 | __func__, iport, status); | ||
77 | 80 | ||
81 | /* XXX pointless lock */ | ||
82 | spin_lock_irqsave(&iport->state_lock, flags); | ||
83 | iport->status = status; | ||
84 | spin_unlock_irqrestore(&iport->state_lock, flags); | ||
85 | } | ||
78 | 86 | ||
79 | void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index) | 87 | void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index) |
80 | { | 88 | { |
81 | struct scic_sds_port *sci_port; | ||
82 | |||
83 | INIT_LIST_HEAD(&iport->remote_dev_list); | 89 | INIT_LIST_HEAD(&iport->remote_dev_list); |
84 | INIT_LIST_HEAD(&iport->domain_dev_list); | 90 | INIT_LIST_HEAD(&iport->domain_dev_list); |
85 | spin_lock_init(&iport->state_lock); | 91 | spin_lock_init(&iport->state_lock); |
86 | init_completion(&iport->start_complete); | 92 | init_completion(&iport->start_complete); |
87 | iport->isci_host = ihost; | 93 | iport->isci_host = ihost; |
88 | isci_port_change_state(iport, isci_freed); | 94 | isci_port_change_state(iport, isci_freed); |
89 | |||
90 | sci_port = &ihost->sci.port_table[index]; | ||
91 | iport->sci_port_handle = sci_port; | ||
92 | sci_port->iport = iport; | ||
93 | } | 95 | } |
94 | 96 | ||
95 | |||
96 | /** | 97 | /** |
97 | * isci_port_get_state() - This function gets the status of the port object. | 98 | * isci_port_get_state() - This function gets the status of the port object. |
98 | * @isci_port: This parameter points to the isci_port object | 99 | * @isci_port: This parameter points to the isci_port object |
@@ -105,21 +106,6 @@ enum isci_status isci_port_get_state( | |||
105 | return isci_port->status; | 106 | return isci_port->status; |
106 | } | 107 | } |
107 | 108 | ||
108 | static void isci_port_change_state( | ||
109 | struct isci_port *isci_port, | ||
110 | enum isci_status status) | ||
111 | { | ||
112 | unsigned long flags; | ||
113 | |||
114 | dev_dbg(&isci_port->isci_host->pdev->dev, | ||
115 | "%s: isci_port = %p, state = 0x%x\n", | ||
116 | __func__, isci_port, status); | ||
117 | |||
118 | spin_lock_irqsave(&isci_port->state_lock, flags); | ||
119 | isci_port->status = status; | ||
120 | spin_unlock_irqrestore(&isci_port->state_lock, flags); | ||
121 | } | ||
122 | |||
123 | void isci_port_bc_change_received(struct isci_host *ihost, | 109 | void isci_port_bc_change_received(struct isci_host *ihost, |
124 | struct scic_sds_port *sci_port, | 110 | struct scic_sds_port *sci_port, |
125 | struct scic_sds_phy *sci_phy) | 111 | struct scic_sds_phy *sci_phy) |
@@ -140,7 +126,7 @@ void isci_port_link_up(struct isci_host *isci_host, | |||
140 | unsigned long flags; | 126 | unsigned long flags; |
141 | struct scic_port_properties properties; | 127 | struct scic_port_properties properties; |
142 | struct isci_phy *isci_phy = sci_phy_to_iphy(phy); | 128 | struct isci_phy *isci_phy = sci_phy_to_iphy(phy); |
143 | struct isci_port *isci_port = port->iport; | 129 | struct isci_port *isci_port = sci_port_to_iport(port); |
144 | unsigned long success = true; | 130 | unsigned long success = true; |
145 | 131 | ||
146 | BUG_ON(isci_phy->isci_port != NULL); | 132 | BUG_ON(isci_phy->isci_port != NULL); |
@@ -346,8 +332,7 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor | |||
346 | spin_lock_irqsave(&ihost->scic_lock, flags); | 332 | spin_lock_irqsave(&ihost->scic_lock, flags); |
347 | 333 | ||
348 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT | 334 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT |
349 | status = scic_port_hard_reset(iport->sci_port_handle, | 335 | status = scic_port_hard_reset(&iport->sci, ISCI_PORT_RESET_TIMEOUT); |
350 | ISCI_PORT_RESET_TIMEOUT); | ||
351 | 336 | ||
352 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 337 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
353 | 338 | ||