aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:02:06 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:47 -0400
commit8025b5db7e10cd90cadec940cc766be3bbda65e8 (patch)
tree79d509309c67529db93e071aa51a63947d869fe2 /drivers/scsi/libfc
parent8345592b8388b51e0f52f63e94a5a5d3f07fda9a (diff)
[SCSI] libfc: move rport_lookup into fc_rport.c
Move the libfc remote port lookup function into fc_rport.c. This seems like the best place for it. 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_disc.c22
-rw-r--r--drivers/scsi/libfc/fc_rport.c20
2 files changed, 20 insertions, 22 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 3fcbba17186..f6762a52147 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -53,25 +53,6 @@ static void fc_disc_single(struct fc_disc *, struct fc_disc_port *);
53static void fc_disc_restart(struct fc_disc *); 53static void fc_disc_restart(struct fc_disc *);
54 54
55/** 55/**
56 * fc_disc_lookup_rport() - lookup a remote port by port_id
57 * @lport: Fibre Channel host port instance
58 * @port_id: remote port port_id to match
59 */
60struct fc_rport_priv *fc_disc_lookup_rport(const struct fc_lport *lport,
61 u32 port_id)
62{
63 const struct fc_disc *disc = &lport->disc;
64 struct fc_rport_priv *rdata;
65
66 list_for_each_entry(rdata, &disc->rports, peers) {
67 if (rdata->ids.port_id == port_id &&
68 rdata->rp_state != RPORT_ST_DELETE)
69 return rdata;
70 }
71 return NULL;
72}
73
74/**
75 * fc_disc_stop_rports() - delete all the remote ports associated with the lport 56 * fc_disc_stop_rports() - delete all the remote ports associated with the lport
76 * @disc: The discovery job to stop rports on 57 * @disc: The discovery job to stop rports on
77 * 58 *
@@ -714,9 +695,6 @@ int fc_disc_init(struct fc_lport *lport)
714 if (!lport->tt.disc_recv_req) 695 if (!lport->tt.disc_recv_req)
715 lport->tt.disc_recv_req = fc_disc_recv_req; 696 lport->tt.disc_recv_req = fc_disc_recv_req;
716 697
717 if (!lport->tt.rport_lookup)
718 lport->tt.rport_lookup = fc_disc_lookup_rport;
719
720 disc = &lport->disc; 698 disc = &lport->disc;
721 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); 699 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout);
722 mutex_init(&disc->disc_mutex); 700 mutex_init(&disc->disc_mutex);
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 406049c13a0..99ac056293f 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -87,6 +87,23 @@ static const char *fc_rport_state_names[] = {
87}; 87};
88 88
89/** 89/**
90 * fc_rport_lookup() - lookup a remote port by port_id
91 * @lport: Fibre Channel host port instance
92 * @port_id: remote port port_id to match
93 */
94static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
95 u32 port_id)
96{
97 struct fc_rport_priv *rdata;
98
99 list_for_each_entry(rdata, &lport->disc.rports, peers)
100 if (rdata->ids.port_id == port_id &&
101 rdata->rp_state != RPORT_ST_DELETE)
102 return rdata;
103 return NULL;
104}
105
106/**
90 * fc_rport_create() - create remote port in INIT state. 107 * fc_rport_create() - create remote port in INIT state.
91 * @lport: local port. 108 * @lport: local port.
92 * @ids: remote port identifiers. 109 * @ids: remote port identifiers.
@@ -1292,6 +1309,9 @@ static void fc_rport_flush_queue(void)
1292 1309
1293int fc_rport_init(struct fc_lport *lport) 1310int fc_rport_init(struct fc_lport *lport)
1294{ 1311{
1312 if (!lport->tt.rport_lookup)
1313 lport->tt.rport_lookup = fc_rport_lookup;
1314
1295 if (!lport->tt.rport_create) 1315 if (!lport->tt.rport_create)
1296 lport->tt.rport_create = fc_rport_create; 1316 lport->tt.rport_create = fc_rport_create;
1297 1317