aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_lport.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:01:44 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:46 -0400
commitb5cbf083736e14911c32fca2a93c540a92e8413d (patch)
tree7495e2e08d2d7ee71abfb674700c9a631a478c54 /drivers/scsi/libfc/fc_lport.c
parentcdbe6dfece038e75214735d56cd06319b9a6df46 (diff)
[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: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc/fc_lport.c')
-rw-r--r--drivers/scsi/libfc/fc_lport.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 016f771ebe69..22c0f7bc004f 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -146,44 +146,31 @@ static void fc_lport_rport_callback(struct fc_lport *lport,
146 FC_LPORT_DBG(lport, "Received a %d event for port (%6x)\n", event, 146 FC_LPORT_DBG(lport, "Received a %d event for port (%6x)\n", event,
147 rdata->ids.port_id); 147 rdata->ids.port_id);
148 148
149 mutex_lock(&lport->lp_mutex);
149 switch (event) { 150 switch (event) {
150 case RPORT_EV_READY: 151 case RPORT_EV_READY:
151 if (rdata->ids.port_id == FC_FID_DIR_SERV) { 152 if (lport->state == LPORT_ST_DNS) {
152 mutex_lock(&lport->lp_mutex); 153 lport->dns_rp = rdata;
153 if (lport->state == LPORT_ST_DNS) { 154 fc_lport_enter_rpn_id(lport);
154 lport->dns_rp = rdata; 155 } else {
155 fc_lport_enter_rpn_id(lport); 156 FC_LPORT_DBG(lport, "Received an READY event "
156 } else { 157 "on port (%6x) for the directory "
157 FC_LPORT_DBG(lport, "Received an READY event " 158 "server, but the lport is not "
158 "on port (%6x) for the directory " 159 "in the DNS state, it's in the "
159 "server, but the lport is not " 160 "%d state", rdata->ids.port_id,
160 "in the DNS state, it's in the " 161 lport->state);
161 "%d state", rdata->ids.port_id, 162 lport->tt.rport_logoff(rdata);
162 lport->state); 163 }
163 lport->tt.rport_logoff(rdata);
164 }
165 mutex_unlock(&lport->lp_mutex);
166 } else
167 FC_LPORT_DBG(lport, "Received an event for port (%6x) "
168 "which is not the directory server\n",
169 rdata->ids.port_id);
170 break; 164 break;
171 case RPORT_EV_LOGO: 165 case RPORT_EV_LOGO:
172 case RPORT_EV_FAILED: 166 case RPORT_EV_FAILED:
173 case RPORT_EV_STOP: 167 case RPORT_EV_STOP:
174 if (rdata->ids.port_id == FC_FID_DIR_SERV) { 168 lport->dns_rp = NULL;
175 mutex_lock(&lport->lp_mutex);
176 lport->dns_rp = NULL;
177 mutex_unlock(&lport->lp_mutex);
178
179 } else
180 FC_LPORT_DBG(lport, "Received an event for port (%6x) "
181 "which is not the directory server\n",
182 rdata->ids.port_id);
183 break; 169 break;
184 case RPORT_EV_NONE: 170 case RPORT_EV_NONE:
185 break; 171 break;
186 } 172 }
173 mutex_unlock(&lport->lp_mutex);
187} 174}
188 175
189/** 176/**