diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2009-08-25 17:01:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 13:07:44 -0400 |
commit | 786681b96fc1a5b94d187160b7bf80bf6b4681ed (patch) | |
tree | f15c89228d48057957d86ef468118a2c76dcce42 /drivers/scsi | |
parent | 00fea930d404b9a9039291d5a61975e6c2ea974e (diff) |
[SCSI] libfc: eliminate disc->event
There was no need to have the discovery status stored in struct fc_disc.
Change fc_disc_done() to take the discovery status as an argument
and just pass it on to the discovery callback.
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')
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index bbea41e50a57..736f91742064 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -49,7 +49,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *); | |||
49 | static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *); | 49 | static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *); |
50 | static int fc_disc_new_target(struct fc_disc *, struct fc_rport_priv *, | 50 | static int fc_disc_new_target(struct fc_disc *, struct fc_rport_priv *, |
51 | struct fc_rport_identifiers *); | 51 | struct fc_rport_identifiers *); |
52 | static void fc_disc_done(struct fc_disc *); | 52 | static void fc_disc_done(struct fc_disc *, enum fc_disc_event); |
53 | static void fc_disc_timeout(struct work_struct *); | 53 | static void fc_disc_timeout(struct work_struct *); |
54 | static void fc_disc_single(struct fc_disc *, struct fc_disc_port *); | 54 | static void fc_disc_single(struct fc_disc *, struct fc_disc_port *); |
55 | static void fc_disc_restart(struct fc_disc *); | 55 | static void fc_disc_restart(struct fc_disc *); |
@@ -329,8 +329,7 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *, | |||
329 | if (rdata) { | 329 | if (rdata) { |
330 | kref_get(&rdata->kref); | 330 | kref_get(&rdata->kref); |
331 | if (!fc_disc_new_target(disc, rdata, &rdata->ids)) { | 331 | if (!fc_disc_new_target(disc, rdata, &rdata->ids)) { |
332 | disc->event = DISC_EV_SUCCESS; | 332 | fc_disc_done(disc, DISC_EV_SUCCESS); |
333 | fc_disc_done(disc); | ||
334 | } | 333 | } |
335 | kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); | 334 | kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); |
336 | } else { | 335 | } else { |
@@ -404,20 +403,18 @@ static int fc_disc_new_target(struct fc_disc *disc, | |||
404 | /** | 403 | /** |
405 | * fc_disc_done() - Discovery has been completed | 404 | * fc_disc_done() - Discovery has been completed |
406 | * @disc: FC discovery context | 405 | * @disc: FC discovery context |
406 | * @event: discovery completion status | ||
407 | * | ||
407 | * Locking Note: This function expects that the disc mutex is locked before | 408 | * Locking Note: This function expects that the disc mutex is locked before |
408 | * it is called. The discovery callback is then made with the lock released, | 409 | * it is called. The discovery callback is then made with the lock released, |
409 | * and the lock is re-taken before returning from this function | 410 | * and the lock is re-taken before returning from this function |
410 | */ | 411 | */ |
411 | static void fc_disc_done(struct fc_disc *disc) | 412 | static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event) |
412 | { | 413 | { |
413 | struct fc_lport *lport = disc->lport; | 414 | struct fc_lport *lport = disc->lport; |
414 | enum fc_disc_event event; | ||
415 | 415 | ||
416 | FC_DISC_DBG(disc, "Discovery complete\n"); | 416 | FC_DISC_DBG(disc, "Discovery complete\n"); |
417 | 417 | ||
418 | event = disc->event; | ||
419 | disc->event = DISC_EV_NONE; | ||
420 | |||
421 | if (disc->requested) | 418 | if (disc->requested) |
422 | fc_disc_gpn_ft_req(disc); | 419 | fc_disc_gpn_ft_req(disc); |
423 | else | 420 | else |
@@ -460,11 +457,8 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp) | |||
460 | } | 457 | } |
461 | disc->retry_count++; | 458 | disc->retry_count++; |
462 | schedule_delayed_work(&disc->disc_work, delay); | 459 | schedule_delayed_work(&disc->disc_work, delay); |
463 | } else { | 460 | } else |
464 | /* exceeded retries */ | 461 | fc_disc_done(disc, DISC_EV_FAILED); |
465 | disc->event = DISC_EV_FAILED; | ||
466 | fc_disc_done(disc); | ||
467 | } | ||
468 | } | 462 | } |
469 | } | 463 | } |
470 | 464 | ||
@@ -503,10 +497,12 @@ err: | |||
503 | } | 497 | } |
504 | 498 | ||
505 | /** | 499 | /** |
506 | * fc_disc_gpn_ft_parse() - Parse the list of IDs and names resulting from a request | 500 | * fc_disc_gpn_ft_parse() - Parse the body of the dNS GPN_FT response. |
507 | * @lport: Fibre Channel host port instance | 501 | * @lport: Fibre Channel host port instance |
508 | * @buf: GPN_FT response buffer | 502 | * @buf: GPN_FT response buffer |
509 | * @len: size of response buffer | 503 | * @len: size of response buffer |
504 | * | ||
505 | * Goes through the list of IDs and names resulting from a request. | ||
510 | */ | 506 | */ |
511 | static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | 507 | static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) |
512 | { | 508 | { |
@@ -577,8 +573,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
577 | } | 573 | } |
578 | 574 | ||
579 | if (np->fp_flags & FC_NS_FID_LAST) { | 575 | if (np->fp_flags & FC_NS_FID_LAST) { |
580 | disc->event = DISC_EV_SUCCESS; | 576 | fc_disc_done(disc, DISC_EV_SUCCESS); |
581 | fc_disc_done(disc); | ||
582 | len = 0; | 577 | len = 0; |
583 | break; | 578 | break; |
584 | } | 579 | } |
@@ -669,8 +664,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
669 | FC_DISC_DBG(disc, "GPN_FT rejected reason %x exp %x " | 664 | FC_DISC_DBG(disc, "GPN_FT rejected reason %x exp %x " |
670 | "(check zoning)\n", cp->ct_reason, | 665 | "(check zoning)\n", cp->ct_reason, |
671 | cp->ct_explan); | 666 | cp->ct_explan); |
672 | disc->event = DISC_EV_FAILED; | 667 | fc_disc_done(disc, DISC_EV_FAILED); |
673 | fc_disc_done(disc); | ||
674 | } else { | 668 | } else { |
675 | FC_DISC_DBG(disc, "GPN_FT unexpected response code " | 669 | FC_DISC_DBG(disc, "GPN_FT unexpected response code " |
676 | "%x\n", ntohs(cp->ct_cmd)); | 670 | "%x\n", ntohs(cp->ct_cmd)); |
@@ -782,7 +776,6 @@ int fc_disc_init(struct fc_lport *lport) | |||
782 | 776 | ||
783 | disc->lport = lport; | 777 | disc->lport = lport; |
784 | disc->delay = FC_DISC_DELAY; | 778 | disc->delay = FC_DISC_DELAY; |
785 | disc->event = DISC_EV_NONE; | ||
786 | 779 | ||
787 | return 0; | 780 | return 0; |
788 | } | 781 | } |