[SCSI] libfc: move rport_lookup into fc_rport.c
authorJoe Eykholt <jeykholt@cisco.com>
Tue, 25 Aug 2009 21:02:06 +0000 (14:02 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 10 Sep 2009 17:07:47 +0000 (12:07 -0500)
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>
drivers/scsi/libfc/fc_disc.c
drivers/scsi/libfc/fc_rport.c

index 3fcbba1718631a5c529826681a2d0aced617aa46..f6762a52147ddf0fe6fcf3752f8191aeb92b5dd0 100644 (file)
@@ -52,25 +52,6 @@ static void fc_disc_timeout(struct work_struct *);
 static void fc_disc_single(struct fc_disc *, struct fc_disc_port *);
 static void fc_disc_restart(struct fc_disc *);
 
-/**
- * fc_disc_lookup_rport() - lookup a remote port by port_id
- * @lport: Fibre Channel host port instance
- * @port_id: remote port port_id to match
- */
-struct fc_rport_priv *fc_disc_lookup_rport(const struct fc_lport *lport,
-                                          u32 port_id)
-{
-       const struct fc_disc *disc = &lport->disc;
-       struct fc_rport_priv *rdata;
-
-       list_for_each_entry(rdata, &disc->rports, peers) {
-               if (rdata->ids.port_id == port_id &&
-                   rdata->rp_state != RPORT_ST_DELETE)
-                       return rdata;
-       }
-       return NULL;
-}
-
 /**
  * fc_disc_stop_rports() - delete all the remote ports associated with the lport
  * @disc: The discovery job to stop rports on
@@ -714,9 +695,6 @@ int fc_disc_init(struct fc_lport *lport)
        if (!lport->tt.disc_recv_req)
                lport->tt.disc_recv_req = fc_disc_recv_req;
 
-       if (!lport->tt.rport_lookup)
-               lport->tt.rport_lookup = fc_disc_lookup_rport;
-
        disc = &lport->disc;
        INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout);
        mutex_init(&disc->disc_mutex);
index 406049c13a0e508b3ee2659b4b36791940e887ce..99ac056293f526187d0b4e3564e45103df938830 100644 (file)
@@ -86,6 +86,23 @@ static const char *fc_rport_state_names[] = {
        [RPORT_ST_DELETE] = "Delete",
 };
 
+/**
+ * fc_rport_lookup() - lookup a remote port by port_id
+ * @lport: Fibre Channel host port instance
+ * @port_id: remote port port_id to match
+ */
+static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
+                                            u32 port_id)
+{
+       struct fc_rport_priv *rdata;
+
+       list_for_each_entry(rdata, &lport->disc.rports, peers)
+               if (rdata->ids.port_id == port_id &&
+                   rdata->rp_state != RPORT_ST_DELETE)
+                       return rdata;
+       return NULL;
+}
+
 /**
  * fc_rport_create() - create remote port in INIT state.
  * @lport: local port.
@@ -1292,6 +1309,9 @@ static void fc_rport_flush_queue(void)
 
 int fc_rport_init(struct fc_lport *lport)
 {
+       if (!lport->tt.rport_lookup)
+               lport->tt.rport_lookup = fc_rport_lookup;
+
        if (!lport->tt.rport_create)
                lport->tt.rport_create = fc_rport_create;