Skip to content

Commit

Permalink
isci: unify isci_port and scic_sds_port
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Williams committed Jul 3, 2011
1 parent 76802ce commit ffe191c
Show file tree
Hide file tree
Showing 10 changed files with 481 additions and 581 deletions.
32 changes: 16 additions & 16 deletions drivers/scsi/isci/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,9 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic,

/* Start all of the ports on this controller */
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
struct isci_port *iport = &ihost->ports[index];

result = scic_sds_port_start(sci_port);
result = scic_sds_port_start(iport);
if (result)
return result;
}
Expand Down Expand Up @@ -1306,8 +1306,8 @@ void isci_host_deinit(struct isci_host *ihost)

/* Cancel any/all outstanding port timers */
for (i = 0; i < ihost->sci.logical_port_entries; i++) {
struct scic_sds_port *sci_port = &ihost->ports[i].sci;
del_timer_sync(&sci_port->timer.timer);
struct isci_port *iport = &ihost->ports[i];
del_timer_sync(&iport->timer.timer);
}

/* Cancel any/all outstanding phy timers */
Expand Down Expand Up @@ -1552,9 +1552,9 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
struct isci_host *ihost = scic_to_ihost(scic);

for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
struct isci_port *iport = &ihost->ports[index];

port_status = scic_sds_port_stop(sci_port);
port_status = scic_sds_port_stop(iport);

if ((port_status != SCI_SUCCESS) &&
(port_status != SCI_FAILURE_INVALID_STATE)) {
Expand All @@ -1564,7 +1564,7 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
"%s: Controller stop operation failed to "
"stop port %d because of status %d.\n",
__func__,
sci_port->logical_port_index,
iport->logical_port_index,
port_status);
}
}
Expand Down Expand Up @@ -1780,14 +1780,14 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci

/* Construct the ports for this controller */
for (i = 0; i < SCI_MAX_PORTS; i++)
scic_sds_port_construct(&ihost->ports[i].sci, i, scic);
scic_sds_port_construct(&ihost->ports[i].sci, SCIC_SDS_DUMMY_PORT, scic);
scic_sds_port_construct(&ihost->ports[i], i, scic);
scic_sds_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, scic);

/* Construct the phys for this controller */
for (i = 0; i < SCI_MAX_PHYS; i++) {
/* Add all the PHYs to the dummy port */
scic_sds_phy_construct(&ihost->phys[i],
&ihost->ports[SCI_MAX_PORTS].sci, i);
&ihost->ports[SCI_MAX_PORTS], i);
}

scic->invalid_phy_mask = 0;
Expand Down Expand Up @@ -2233,7 +2233,7 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc
}

for (i = 0; i < scic->logical_port_entries; i++) {
result = scic_sds_port_initialize(&ihost->ports[i].sci,
result = scic_sds_port_initialize(&ihost->ports[i],
&scic->scu_registers->peg0.ptsg.port[i],
&scic->scu_registers->peg0.ptsg.protocol_engine,
&scic->scu_registers->peg0.viit[i]);
Expand Down Expand Up @@ -2484,19 +2484,19 @@ int isci_host_init(struct isci_host *isci_host)
}

void scic_sds_controller_link_up(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct isci_phy *iphy)
struct isci_port *iport, struct isci_phy *iphy)
{
switch (scic->sm.current_state_id) {
case SCIC_STARTING:
sci_del_timer(&scic->phy_timer);
scic->phy_startup_timer_pending = false;
scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
scic_sds_controller_start_next_phy(scic);
break;
case SCIC_READY:
scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
break;
default:
dev_dbg(scic_to_dev(scic),
Expand All @@ -2507,13 +2507,13 @@ void scic_sds_controller_link_up(struct scic_sds_controller *scic,
}

void scic_sds_controller_link_down(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct isci_phy *iphy)
struct isci_port *iport, struct isci_phy *iphy)
{
switch (scic->sm.current_state_id) {
case SCIC_STARTING:
case SCIC_READY:
scic->port_agent.link_down_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
break;
default:
dev_dbg(scic_to_dev(scic),
Expand Down
11 changes: 5 additions & 6 deletions drivers/scsi/isci/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct scic_power_control {
struct scic_sds_port_configuration_agent;
typedef void (*port_config_fn)(struct scic_sds_controller *,
struct scic_sds_port_configuration_agent *,
struct scic_sds_port *, struct isci_phy *);
struct isci_port *, struct isci_phy *);

struct scic_sds_port_configuration_agent {
u16 phy_configured_mask;
Expand Down Expand Up @@ -532,9 +532,8 @@ static inline struct device *sciphy_to_dev(struct isci_phy *iphy)
return &iphy->isci_port->isci_host->pdev->dev;
}

static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port)
static inline struct device *sciport_to_dev(struct isci_port *iport)
{
struct isci_port *iport = sci_port_to_iport(sci_port);

if (!iport || !iport->isci_host)
return NULL;
Expand Down Expand Up @@ -613,12 +612,12 @@ void scic_sds_controller_power_control_queue_remove(

void scic_sds_controller_link_up(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);

void scic_sds_controller_link_down(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);

void scic_sds_controller_remote_device_stopped(
Expand Down Expand Up @@ -649,7 +648,7 @@ void isci_host_deinit(

void isci_host_port_link_up(
struct isci_host *,
struct scic_sds_port *,
struct isci_port *,
struct isci_phy *);
int isci_host_dev_found(struct domain_device *);

Expand Down
10 changes: 5 additions & 5 deletions drivers/scsi/isci/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static void phy_sata_timeout(unsigned long data)
* port (i.e. it's contained in the dummy port). !NULL All other
* values indicate a handle/pointer to the port containing the phy.
*/
struct scic_sds_port *phy_get_non_dummy_port(
struct isci_port *phy_get_non_dummy_port(
struct isci_phy *iphy)
{
if (scic_sds_port_get_index(iphy->owning_port) == SCIC_SDS_DUMMY_PORT)
Expand All @@ -304,9 +304,9 @@ struct scic_sds_port *phy_get_non_dummy_port(
*/
void scic_sds_phy_set_port(
struct isci_phy *iphy,
struct scic_sds_port *sci_port)
struct isci_port *iport)
{
iphy->owning_port = sci_port;
iphy->owning_port = iport;

if (iphy->bcn_received_while_port_unassigned) {
iphy->bcn_received_while_port_unassigned = false;
Expand Down Expand Up @@ -1291,12 +1291,12 @@ static const struct sci_base_state scic_sds_phy_state_table[] = {
};

void scic_sds_phy_construct(struct isci_phy *iphy,
struct scic_sds_port *owning_port, u8 phy_index)
struct isci_port *iport, u8 phy_index)
{
sci_init_sm(&iphy->sm, scic_sds_phy_state_table, SCI_PHY_INITIAL);

/* Copy the rest of the input data to our locals */
iphy->owning_port = owning_port;
iphy->owning_port = iport;
iphy->phy_index = phy_index;
iphy->bcn_received_while_port_unassigned = false;
iphy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
Expand Down
10 changes: 5 additions & 5 deletions drivers/scsi/isci/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ enum scic_sds_phy_protocol {
*/
struct isci_phy {
struct sci_base_state_machine sm;
struct scic_sds_port *owning_port;
struct isci_port *owning_port;
enum sas_linkrate max_negotiated_speed;
enum scic_sds_phy_protocol protocol;
u8 phy_index;
Expand Down Expand Up @@ -178,7 +178,7 @@ struct scic_phy_properties {
* supplied phy. This field may be set to NULL
* if the phy is not currently contained in a port.
*/
struct scic_sds_port *owning_port;
struct isci_port *iport;

/**
* This field specifies the link rate at which the phy is
Expand Down Expand Up @@ -459,14 +459,14 @@ enum scic_sds_phy_states {

void scic_sds_phy_construct(
struct isci_phy *iphy,
struct scic_sds_port *owning_port,
struct isci_port *iport,
u8 phy_index);

struct scic_sds_port *phy_get_non_dummy_port(struct isci_phy *iphy);
struct isci_port *phy_get_non_dummy_port(struct isci_phy *iphy);

void scic_sds_phy_set_port(
struct isci_phy *iphy,
struct scic_sds_port *owning_port);
struct isci_port *iport);

enum sci_status scic_sds_phy_initialize(
struct isci_phy *iphy,
Expand Down
Loading

0 comments on commit ffe191c

Please sign in to comment.