Move the RP event callback out of the transport template and
into the fc_rport_libfc_priv structure.

Signed-off-by: Robert Love <[EMAIL PROTECTED]>
---

 drivers/scsi/libfc/fc_lport.c |   10 ++++------
 drivers/scsi/libfc/fc_ns.c    |    2 ++
 drivers/scsi/libfc/fc_rport.c |    3 ++-
 include/scsi/libfc/libfc.h    |    9 +++++++--
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 3b45d66..bdd2760 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -58,8 +58,8 @@ static int fc_frame_drop(struct fc_lport *lp, struct fc_frame 
*fp)
        return 0;
 }
 
-static int fc_lport_rport_event(struct fc_lport *lport, struct fc_rport *rport,
-                               enum fc_lport_event event)
+static void fc_lport_rport_event(struct fc_lport *lport, struct fc_rport 
*rport,
+                                enum fc_lport_event event)
 {
        fc_lport_lock(lport);
        if (rport->port_id == FC_FID_DIR_SERV) {
@@ -73,8 +73,6 @@ static int fc_lport_rport_event(struct fc_lport *lport, 
struct fc_rport *rport,
                }
        }
        fc_lport_unlock(lport);
-
-       return 0;
 }
 
 static const char *fc_lport_state(struct fc_lport *lp)
@@ -926,8 +924,8 @@ int fc_lport_init(struct fc_lport *lp)
        if (!lp->tt.lport_logout)
                lp->tt.lport_logout = fc_lport_logout;
 
-       if (!lp->tt.lport_event)
-               lp->tt.lport_event = fc_lport_rport_event;
+       if (!lp->tt.event_callback)
+               lp->tt.event_callback = fc_lport_rport_event;
 
        return 0;
 }
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index 97464db..65dff77 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -624,6 +624,7 @@ static int fc_ns_new_target(struct fc_lport *lp,
                }
                if (rport) {
                        rp = rport->dd_data;
+                       rp->event_callback = lp->tt.event_callback;
                        rp->rp_state = RPORT_ST_INIT;
                        lp->tt.rport_login(rport);
                }
@@ -1067,6 +1068,7 @@ static void fc_ns_enter_dns(struct fc_lport *lp)
         * If dNS session isn't ready, start its logon.
         */
        if (rp->rp_state != RPORT_ST_READY) {
+               rp->event_callback = lp->tt.event_callback;
                lp->tt.rport_login(rport);
        } else {
                del_timer(&lp->state_timer);
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 3eac78f..d21261d 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -340,7 +340,8 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
        if (fc_rp_debug)
                FC_DBG("remote %6x ready\n", rport->port_id);
 
-       lport->tt.lport_event(lport, rport, LPORT_EV_RPORT_CREATED);
+       if (rdata->event_callback)
+               rdata->event_callback(lport, rport, LPORT_EV_RPORT_CREATED);
 }
 
 /*
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index 5936c78..03e4e0a 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -143,6 +143,7 @@ struct fc_ns_port {
  * @r_a_tov: resource allocation timeout value (in msec)
  * @rp_lock: lock protects state
  * @retry_work:
+ * @event_callback: Callback for rport READY, FAILED or LOGO
  */
 struct fc_rport_libfc_priv {
        struct fc_lport         *local_port;
@@ -156,6 +157,9 @@ struct fc_rport_libfc_priv {
        unsigned int    r_a_tov;
        spinlock_t      rp_lock;
        struct delayed_work     retry_work;
+       void (*event_callback)(struct fc_lport *,
+                              struct fc_rport *,
+                              enum fc_lport_event);
 };
 
 struct fc_rport *fc_ns_create_dummy_rport(struct fc_ns_port *);
@@ -342,8 +346,9 @@ struct libfc_function_template {
        int (*lport_reset)(struct fc_lport *);
        int (*lport_logout)(struct fc_lport *);
 
-       int (*lport_event)(struct fc_lport *, struct fc_rport *,
-                          enum fc_lport_event);
+       void (*event_callback)(struct fc_lport *,
+                              struct fc_rport *,
+                              enum fc_lport_event);
 
        /**
         * Remote Port interfaces

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to