aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_disc.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:00:39 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:40 -0400
commit795d86f55ec3bf6280dda368f208943f1fb7d366 (patch)
tree8d123acf1e7d9d07495d702b88ef2d75dfe696b1 /drivers/scsi/libfc/fc_disc.c
parentab28f1fd3b0d14c1bd693e640decd711d5e6642a (diff)
[SCSI] libfc: change interface for rport_create
The interface for lport->tt.rport_create() takes a fc_disc_port arg, which is unnatural for most calls. The only reason for this was to avoid passing in the local port as an argument, but otherwise added to complexity. Simplify by just using lport and fc_rport_identifiers. 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_disc.c')
-rw-r--r--drivers/scsi/libfc/fc_disc.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 4c8d893af7bd..ecc625c20520 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -428,13 +428,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
428 if (!rport) { 428 if (!rport) {
429 rport = lport->tt.rport_lookup(lport, ids->port_id); 429 rport = lport->tt.rport_lookup(lport, ids->port_id);
430 if (!rport) { 430 if (!rport) {
431 struct fc_disc_port dp; 431 rport = lport->tt.rport_create(lport, ids);
432 dp.lp = lport;
433 dp.ids.port_id = ids->port_id;
434 dp.ids.port_name = ids->port_name;
435 dp.ids.node_name = ids->node_name;
436 dp.ids.roles = ids->roles;
437 rport = lport->tt.rport_create(&dp);
438 } 432 }
439 if (!rport) 433 if (!rport)
440 error = -ENOMEM; 434 error = -ENOMEM;
@@ -578,7 +572,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
578 size_t plen; 572 size_t plen;
579 size_t tlen; 573 size_t tlen;
580 int error = 0; 574 int error = 0;
581 struct fc_disc_port dp; 575 struct fc_rport_identifiers ids;
582 struct fc_rport *rport; 576 struct fc_rport *rport;
583 struct fc_rport_priv *rdata; 577 struct fc_rport_priv *rdata;
584 578
@@ -621,15 +615,14 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
621 * After the first time through the loop, things return to "normal". 615 * After the first time through the loop, things return to "normal".
622 */ 616 */
623 while (plen >= sizeof(*np)) { 617 while (plen >= sizeof(*np)) {
624 dp.lp = lport; 618 ids.port_id = ntoh24(np->fp_fid);
625 dp.ids.port_id = ntoh24(np->fp_fid); 619 ids.port_name = ntohll(np->fp_wwpn);
626 dp.ids.port_name = ntohll(np->fp_wwpn); 620 ids.node_name = -1;
627 dp.ids.node_name = -1; 621 ids.roles = FC_RPORT_ROLE_UNKNOWN;
628 dp.ids.roles = FC_RPORT_ROLE_UNKNOWN; 622
629 623 if (ids.port_id != fc_host_port_id(lport->host) &&
630 if ((dp.ids.port_id != fc_host_port_id(lport->host)) && 624 ids.port_name != lport->wwpn) {
631 (dp.ids.port_name != lport->wwpn)) { 625 rport = lport->tt.rport_create(lport, &ids);
632 rport = lport->tt.rport_create(&dp);
633 if (rport) { 626 if (rport) {
634 rdata = rport->dd_data; 627 rdata = rport->dd_data;
635 rdata->ops = &fc_disc_rport_ops; 628 rdata->ops = &fc_disc_rport_ops;
@@ -640,7 +633,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
640 } else 633 } else
641 printk(KERN_WARNING "libfc: Failed to allocate " 634 printk(KERN_WARNING "libfc: Failed to allocate "
642 "memory for the newly discovered port " 635 "memory for the newly discovered port "
643 "(%6x)\n", dp.ids.port_id); 636 "(%6x)\n", ids.port_id);
644 } 637 }
645 638
646 if (np->fp_flags & FC_NS_FID_LAST) { 639 if (np->fp_flags & FC_NS_FID_LAST) {
@@ -781,7 +774,7 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
781 if (dp->ids.port_id == fc_host_port_id(lport->host)) 774 if (dp->ids.port_id == fc_host_port_id(lport->host))
782 goto out; 775 goto out;
783 776
784 new_rport = lport->tt.rport_create(dp); 777 new_rport = lport->tt.rport_create(lport, &dp->ids);
785 if (new_rport) { 778 if (new_rport) {
786 rdata = new_rport->dd_data; 779 rdata = new_rport->dd_data;
787 rdata->ops = &fc_disc_rport_ops; 780 rdata->ops = &fc_disc_rport_ops;