scsi: libfc: Replace ->exch_seq_send callback with function call
authorHannes Reinecke <hare@suse.de>
Tue, 18 Oct 2016 08:01:38 +0000 (10:01 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Nov 2016 22:29:55 +0000 (17:29 -0500)
The ->exch_seq_send callback only ever had one implementation,
so we can call the function directly and drop the callback.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libfc/fc_elsct.c
drivers/scsi/libfc/fc_exch.c
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c
include/scsi/libfc.h

index c2384d501470123a119f4fcd61fadd9ba7aacc24..6384a98048af8f396e4e04bf36d6572d8827bc53 100644 (file)
@@ -67,7 +67,7 @@ struct fc_seq *fc_elsct_send(struct fc_lport *lport, u32 did,
        fc_fill_fc_hdr(fp, r_ctl, did, lport->port_id, fh_type,
                       FC_FCTL_REQ, 0);
 
-       return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
+       return fc_exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
 }
 EXPORT_SYMBOL(fc_elsct_send);
 
index cc320a91b7b7abd5949686de7e26192d6810ccd8..f5c3c1d09651606b2607895088408afc77141d62 100644 (file)
@@ -2127,6 +2127,24 @@ cleanup:
  * @arg:       The argument to be passed to the response handler
  * @timer_msec: The timeout period for the exchange
  *
+ * The exchange response handler is set in this routine to resp()
+ * function pointer. It can be called in two scenarios: if a timeout
+ * occurs or if a response frame is received for the exchange. The
+ * fc_frame pointer in response handler will also indicate timeout
+ * as error using IS_ERR related macros.
+ *
+ * The exchange destructor handler is also set in this routine.
+ * The destructor handler is invoked by EM layer when exchange
+ * is about to free, this can be used by caller to free its
+ * resources along with exchange free.
+ *
+ * The arg is passed back to resp and destructor handler.
+ *
+ * The timeout value (in msec) for an exchange is set if non zero
+ * timer_msec argument is specified. The timer is canceled when
+ * it fires or when the exchange is done. The exchange timeout handler
+ * is registered by EM layer.
+ *
  * The frame pointer with some of the header's fields must be
  * filled before calling this routine, those fields are:
  *
@@ -2137,14 +2155,13 @@ cleanup:
  * - frame control
  * - parameter or relative offset
  */
-static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
-                                      struct fc_frame *fp,
-                                      void (*resp)(struct fc_seq *,
-                                                   struct fc_frame *fp,
-                                                   void *arg),
-                                      void (*destructor)(struct fc_seq *,
-                                                         void *),
-                                      void *arg, u32 timer_msec)
+struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
+                               struct fc_frame *fp,
+                               void (*resp)(struct fc_seq *,
+                                            struct fc_frame *fp,
+                                            void *arg),
+                               void (*destructor)(struct fc_seq *, void *),
+                               void *arg, u32 timer_msec)
 {
        struct fc_exch *ep;
        struct fc_seq *sp = NULL;
@@ -2197,6 +2214,7 @@ err:
                fc_exch_delete(ep);
        return NULL;
 }
+EXPORT_SYMBOL(fc_exch_seq_send);
 
 /**
  * fc_exch_rrq() - Send an ELS RRQ (Reinstate Recovery Qualifier) command
@@ -2630,9 +2648,6 @@ int fc_exch_init(struct fc_lport *lport)
        if (!lport->tt.seq_set_resp)
                lport->tt.seq_set_resp = fc_seq_set_resp;
 
-       if (!lport->tt.exch_seq_send)
-               lport->tt.exch_seq_send = fc_exch_seq_send;
-
        if (!lport->tt.seq_send)
                lport->tt.seq_send = fc_seq_send;
 
index 831de3eada9c65cd9389d2d5d0f01875984ac0ce..5cf1d2e3b57553324a038115f08f120df6ad346e 100644 (file)
@@ -196,7 +196,7 @@ static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp)
  * @seq: The sequence that the FCP packet is on (required by destructor API)
  * @fsp: The FCP packet to be released
  *
- * This routine is called by a destructor callback in the exch_seq_send()
+ * This routine is called by a destructor callback in the fc_exch_seq_send()
  * routine of the libfc Transport Template. The 'struct fc_seq' is a required
  * argument even though it is not used by this routine.
  *
@@ -1206,8 +1206,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
                       rpriv->local_port->port_id, FC_TYPE_FCP,
                       FC_FCTL_REQ, 0);
 
-       seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy,
-                                     fsp, 0);
+       seq = fc_exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, fsp, 0);
        if (!seq) {
                rc = -1;
                goto unlock;
@@ -1757,9 +1756,9 @@ static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset)
                       rpriv->local_port->port_id, FC_TYPE_FCP,
                       FC_FCTL_REQ, 0);
 
-       seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp,
-                                     fc_fcp_pkt_destroy,
-                                     fsp, get_fsp_rec_tov(fsp));
+       seq = fc_exch_seq_send(lport, fp, fc_fcp_srr_resp,
+                              fc_fcp_pkt_destroy,
+                              fsp, get_fsp_rec_tov(fsp));
        if (!seq)
                goto retry;
 
index 42dcb722172bc1bbd947ccdba57521bbfffa9186..1a4f17617260ec751ea2469a7dc15d2e110077a6 100644 (file)
@@ -2006,8 +2006,8 @@ static int fc_lport_els_request(struct fc_bsg_job *job,
        info->nents = job->reply_payload.sg_cnt;
        info->sg = job->reply_payload.sg_list;
 
-       if (!lport->tt.exch_seq_send(lport, fp, fc_lport_bsg_resp,
-                                    NULL, info, tov)) {
+       if (!fc_exch_seq_send(lport, fp, fc_lport_bsg_resp,
+                             NULL, info, tov)) {
                kfree(info);
                return -ECOMM;
        }
@@ -2067,8 +2067,8 @@ static int fc_lport_ct_request(struct fc_bsg_job *job,
        info->nents = job->reply_payload.sg_cnt;
        info->sg = job->reply_payload.sg_list;
 
-       if (!lport->tt.exch_seq_send(lport, fp, fc_lport_bsg_resp,
-                                    NULL, info, tov)) {
+       if (!fc_exch_seq_send(lport, fp, fc_lport_bsg_resp,
+                             NULL, info, tov)) {
                kfree(info);
                return -ECOMM;
        }
index 4ca0f40dc0d65ae84de15fe920cf004341911e38..d275df04f03a746c5d2560b260447e86063948ce 100644 (file)
@@ -1282,8 +1282,8 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata)
                       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
 
        kref_get(&rdata->kref);
-       if (!lport->tt.exch_seq_send(lport, fp, fc_rport_prli_resp,
-                                    NULL, rdata, 2 * lport->r_a_tov)) {
+       if (!fc_exch_seq_send(lport, fp, fc_rport_prli_resp,
+                             NULL, rdata, 2 * lport->r_a_tov)) {
                fc_rport_error_retry(rdata, -FC_EX_XMIT_ERR);
                kref_put(&rdata->kref, lport->tt.rport_destroy);
        }
index 7bba81ebb0e77fc516e9cb671cc8358adab0bf74..5e8a2083dbf0e046692678d269af9c43d7f69c48 100644 (file)
@@ -484,37 +484,6 @@ struct libfc_function_template {
                                             struct fc_frame *, void *arg),
                                     void *arg, u32 timer_msec);
 
-       /*
-        * Send the FC frame payload using a new exchange and sequence.
-        *
-        * The exchange response handler is set in this routine to resp()
-        * function pointer. It can be called in two scenarios: if a timeout
-        * occurs or if a response frame is received for the exchange. The
-        * fc_frame pointer in response handler will also indicate timeout
-        * as error using IS_ERR related macros.
-        *
-        * The exchange destructor handler is also set in this routine.
-        * The destructor handler is invoked by EM layer when exchange
-        * is about to free, this can be used by caller to free its
-        * resources along with exchange free.
-        *
-        * The arg is passed back to resp and destructor handler.
-        *
-        * The timeout value (in msec) for an exchange is set if non zero
-        * timer_msec argument is specified. The timer is canceled when
-        * it fires or when the exchange is done. The exchange timeout handler
-        * is registered by EM layer.
-        *
-        * STATUS: OPTIONAL
-        */
-       struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *,
-                                       void (*resp)(struct fc_seq *,
-                                                    struct fc_frame *,
-                                                    void *),
-                                       void (*destructor)(struct fc_seq *,
-                                                          void *),
-                                       void *, unsigned int timer_msec);
-
        /*
         * Sets up the DDP context for a given exchange id on the given
         * scatterlist if LLD supports DDP for large receive.
@@ -1117,6 +1086,13 @@ void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
  *****************************/
 int fc_exch_init(struct fc_lport *);
 void fc_exch_update_stats(struct fc_lport *lport);
+struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
+                               struct fc_frame *fp,
+                               void (*resp)(struct fc_seq *,
+                                            struct fc_frame *fp,
+                                            void *arg),
+                               void (*destructor)(struct fc_seq *, void *),
+                               void *arg, u32 timer_msec);
 void fc_seq_els_rsp_send(struct fc_frame *, enum fc_els_cmd,
                         struct fc_seq_els_data *);
 struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,