Commit b5cbf083 authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley

[SCSI] libfc: simplify fc_lport_rport_callback

The lport rport callback can only be called for the dNS rport,
since its the only rport who's ops point to that function.

Remove unnecessary checking and debug messages.
Put the locking outside the switch statement as a simplification.
Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent cdbe6dfe
...@@ -146,44 +146,31 @@ static void fc_lport_rport_callback(struct fc_lport *lport, ...@@ -146,44 +146,31 @@ static void fc_lport_rport_callback(struct fc_lport *lport,
FC_LPORT_DBG(lport, "Received a %d event for port (%6x)\n", event, FC_LPORT_DBG(lport, "Received a %d event for port (%6x)\n", event,
rdata->ids.port_id); rdata->ids.port_id);
mutex_lock(&lport->lp_mutex);
switch (event) { switch (event) {
case RPORT_EV_READY: case RPORT_EV_READY:
if (rdata->ids.port_id == FC_FID_DIR_SERV) { if (lport->state == LPORT_ST_DNS) {
mutex_lock(&lport->lp_mutex); lport->dns_rp = rdata;
if (lport->state == LPORT_ST_DNS) { fc_lport_enter_rpn_id(lport);
lport->dns_rp = rdata; } else {
fc_lport_enter_rpn_id(lport); FC_LPORT_DBG(lport, "Received an READY event "
} else { "on port (%6x) for the directory "
FC_LPORT_DBG(lport, "Received an READY event " "server, but the lport is not "
"on port (%6x) for the directory " "in the DNS state, it's in the "
"server, but the lport is not " "%d state", rdata->ids.port_id,
"in the DNS state, it's in the " lport->state);
"%d state", rdata->ids.port_id, lport->tt.rport_logoff(rdata);
lport->state); }
lport->tt.rport_logoff(rdata);
}
mutex_unlock(&lport->lp_mutex);
} else
FC_LPORT_DBG(lport, "Received an event for port (%6x) "
"which is not the directory server\n",
rdata->ids.port_id);
break; break;
case RPORT_EV_LOGO: case RPORT_EV_LOGO:
case RPORT_EV_FAILED: case RPORT_EV_FAILED:
case RPORT_EV_STOP: case RPORT_EV_STOP:
if (rdata->ids.port_id == FC_FID_DIR_SERV) { lport->dns_rp = NULL;
mutex_lock(&lport->lp_mutex);
lport->dns_rp = NULL;
mutex_unlock(&lport->lp_mutex);
} else
FC_LPORT_DBG(lport, "Received an event for port (%6x) "
"which is not the directory server\n",
rdata->ids.port_id);
break; break;
case RPORT_EV_NONE: case RPORT_EV_NONE:
break; break;
} }
mutex_unlock(&lport->lp_mutex);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment