diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2009-08-25 17:01:06 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 13:07:42 -0400 |
commit | 629f44279d169f29b084d406e9f1c33314f220fa (patch) | |
tree | 674698651f1a7be955334de72f186f16f4def97d /drivers/scsi/libfc | |
parent | f211fa514a07326c0f9364c0e6ed17e38860172f (diff) |
[SCSI] libfc: rearrange code in fc_rport_work
This is a cleanup without semantic changes to use a switch
statement instead of a series of if-statements in fc_rport_work(),
and to move some declarations up to the top.
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')
-rw-r--r-- | drivers/scsi/libfc/fc_rport.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 69f6e588d37b..d0a45425cc3f 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -233,6 +233,9 @@ static void fc_rport_work(struct work_struct *work) | |||
233 | enum fc_rport_trans_state trans_state; | 233 | enum fc_rport_trans_state trans_state; |
234 | struct fc_lport *lport = rdata->local_port; | 234 | struct fc_lport *lport = rdata->local_port; |
235 | struct fc_rport_operations *rport_ops; | 235 | struct fc_rport_operations *rport_ops; |
236 | struct fc_rport *new_rport; | ||
237 | struct fc_rport_priv *new_rdata; | ||
238 | struct fc_rport_identifiers ids; | ||
236 | struct fc_rport *rport; | 239 | struct fc_rport *rport; |
237 | 240 | ||
238 | mutex_lock(&rdata->rp_mutex); | 241 | mutex_lock(&rdata->rp_mutex); |
@@ -240,11 +243,8 @@ static void fc_rport_work(struct work_struct *work) | |||
240 | rport_ops = rdata->ops; | 243 | rport_ops = rdata->ops; |
241 | rport = rdata->rport; | 244 | rport = rdata->rport; |
242 | 245 | ||
243 | if (event == RPORT_EV_CREATED) { | 246 | switch (event) { |
244 | struct fc_rport *new_rport; | 247 | case RPORT_EV_CREATED: |
245 | struct fc_rport_priv *new_rdata; | ||
246 | struct fc_rport_identifiers ids; | ||
247 | |||
248 | ids = rdata->ids; | 248 | ids = rdata->ids; |
249 | rdata->event = RPORT_EV_NONE; | 249 | rdata->event = RPORT_EV_NONE; |
250 | mutex_unlock(&rdata->rp_mutex); | 250 | mutex_unlock(&rdata->rp_mutex); |
@@ -289,9 +289,11 @@ static void fc_rport_work(struct work_struct *work) | |||
289 | rdata = new_rport->dd_data; | 289 | rdata = new_rport->dd_data; |
290 | if (rport_ops->event_callback) | 290 | if (rport_ops->event_callback) |
291 | rport_ops->event_callback(lport, rdata, event); | 291 | rport_ops->event_callback(lport, rdata, event); |
292 | } else if ((event == RPORT_EV_FAILED) || | 292 | break; |
293 | (event == RPORT_EV_LOGO) || | 293 | |
294 | (event == RPORT_EV_STOP)) { | 294 | case RPORT_EV_FAILED: |
295 | case RPORT_EV_LOGO: | ||
296 | case RPORT_EV_STOP: | ||
295 | trans_state = rdata->trans_state; | 297 | trans_state = rdata->trans_state; |
296 | mutex_unlock(&rdata->rp_mutex); | 298 | mutex_unlock(&rdata->rp_mutex); |
297 | if (rport_ops->event_callback) | 299 | if (rport_ops->event_callback) |
@@ -305,8 +307,12 @@ static void fc_rport_work(struct work_struct *work) | |||
305 | lport->tt.exch_mgr_reset(lport, 0, port_id); | 307 | lport->tt.exch_mgr_reset(lport, 0, port_id); |
306 | lport->tt.exch_mgr_reset(lport, port_id, 0); | 308 | lport->tt.exch_mgr_reset(lport, port_id, 0); |
307 | } | 309 | } |
308 | } else | 310 | break; |
311 | |||
312 | default: | ||
309 | mutex_unlock(&rdata->rp_mutex); | 313 | mutex_unlock(&rdata->rp_mutex); |
314 | break; | ||
315 | } | ||
310 | } | 316 | } |
311 | 317 | ||
312 | /** | 318 | /** |