Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: libfc: Replace ->exch_seq_send callback with function call

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>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
3afd2d15 c5cb444c

+45 -55
+1 -1
drivers/scsi/libfc/fc_elsct.c
··· 67 67 fc_fill_fc_hdr(fp, r_ctl, did, lport->port_id, fh_type, 68 68 FC_FCTL_REQ, 0); 69 69 70 - return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec); 70 + return fc_exch_seq_send(lport, fp, resp, NULL, arg, timer_msec); 71 71 } 72 72 EXPORT_SYMBOL(fc_elsct_send); 73 73
+26 -11
drivers/scsi/libfc/fc_exch.c
··· 2127 2127 * @arg: The argument to be passed to the response handler 2128 2128 * @timer_msec: The timeout period for the exchange 2129 2129 * 2130 + * The exchange response handler is set in this routine to resp() 2131 + * function pointer. It can be called in two scenarios: if a timeout 2132 + * occurs or if a response frame is received for the exchange. The 2133 + * fc_frame pointer in response handler will also indicate timeout 2134 + * as error using IS_ERR related macros. 2135 + * 2136 + * The exchange destructor handler is also set in this routine. 2137 + * The destructor handler is invoked by EM layer when exchange 2138 + * is about to free, this can be used by caller to free its 2139 + * resources along with exchange free. 2140 + * 2141 + * The arg is passed back to resp and destructor handler. 2142 + * 2143 + * The timeout value (in msec) for an exchange is set if non zero 2144 + * timer_msec argument is specified. The timer is canceled when 2145 + * it fires or when the exchange is done. The exchange timeout handler 2146 + * is registered by EM layer. 2147 + * 2130 2148 * The frame pointer with some of the header's fields must be 2131 2149 * filled before calling this routine, those fields are: 2132 2150 * ··· 2155 2137 * - frame control 2156 2138 * - parameter or relative offset 2157 2139 */ 2158 - static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, 2159 - struct fc_frame *fp, 2160 - void (*resp)(struct fc_seq *, 2161 - struct fc_frame *fp, 2162 - void *arg), 2163 - void (*destructor)(struct fc_seq *, 2164 - void *), 2165 - void *arg, u32 timer_msec) 2140 + struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, 2141 + struct fc_frame *fp, 2142 + void (*resp)(struct fc_seq *, 2143 + struct fc_frame *fp, 2144 + void *arg), 2145 + void (*destructor)(struct fc_seq *, void *), 2146 + void *arg, u32 timer_msec) 2166 2147 { 2167 2148 struct fc_exch *ep; 2168 2149 struct fc_seq *sp = NULL; ··· 2214 2197 fc_exch_delete(ep); 2215 2198 return NULL; 2216 2199 } 2200 + EXPORT_SYMBOL(fc_exch_seq_send); 2217 2201 2218 2202 /** 2219 2203 * fc_exch_rrq() - Send an ELS RRQ (Reinstate Recovery Qualifier) command ··· 2647 2629 2648 2630 if (!lport->tt.seq_set_resp) 2649 2631 lport->tt.seq_set_resp = fc_seq_set_resp; 2650 - 2651 - if (!lport->tt.exch_seq_send) 2652 - lport->tt.exch_seq_send = fc_exch_seq_send; 2653 2632 2654 2633 if (!lport->tt.seq_send) 2655 2634 lport->tt.seq_send = fc_seq_send;
+5 -6
drivers/scsi/libfc/fc_fcp.c
··· 196 196 * @seq: The sequence that the FCP packet is on (required by destructor API) 197 197 * @fsp: The FCP packet to be released 198 198 * 199 - * This routine is called by a destructor callback in the exch_seq_send() 199 + * This routine is called by a destructor callback in the fc_exch_seq_send() 200 200 * routine of the libfc Transport Template. The 'struct fc_seq' is a required 201 201 * argument even though it is not used by this routine. 202 202 * ··· 1206 1206 rpriv->local_port->port_id, FC_TYPE_FCP, 1207 1207 FC_FCTL_REQ, 0); 1208 1208 1209 - seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, 1210 - fsp, 0); 1209 + seq = fc_exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, fsp, 0); 1211 1210 if (!seq) { 1212 1211 rc = -1; 1213 1212 goto unlock; ··· 1756 1757 rpriv->local_port->port_id, FC_TYPE_FCP, 1757 1758 FC_FCTL_REQ, 0); 1758 1759 1759 - seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp, 1760 - fc_fcp_pkt_destroy, 1761 - fsp, get_fsp_rec_tov(fsp)); 1760 + seq = fc_exch_seq_send(lport, fp, fc_fcp_srr_resp, 1761 + fc_fcp_pkt_destroy, 1762 + fsp, get_fsp_rec_tov(fsp)); 1762 1763 if (!seq) 1763 1764 goto retry; 1764 1765
+4 -4
drivers/scsi/libfc/fc_lport.c
··· 2006 2006 info->nents = job->reply_payload.sg_cnt; 2007 2007 info->sg = job->reply_payload.sg_list; 2008 2008 2009 - if (!lport->tt.exch_seq_send(lport, fp, fc_lport_bsg_resp, 2010 - NULL, info, tov)) { 2009 + if (!fc_exch_seq_send(lport, fp, fc_lport_bsg_resp, 2010 + NULL, info, tov)) { 2011 2011 kfree(info); 2012 2012 return -ECOMM; 2013 2013 } ··· 2067 2067 info->nents = job->reply_payload.sg_cnt; 2068 2068 info->sg = job->reply_payload.sg_list; 2069 2069 2070 - if (!lport->tt.exch_seq_send(lport, fp, fc_lport_bsg_resp, 2071 - NULL, info, tov)) { 2070 + if (!fc_exch_seq_send(lport, fp, fc_lport_bsg_resp, 2071 + NULL, info, tov)) { 2072 2072 kfree(info); 2073 2073 return -ECOMM; 2074 2074 }
+2 -2
drivers/scsi/libfc/fc_rport.c
··· 1282 1282 FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); 1283 1283 1284 1284 kref_get(&rdata->kref); 1285 - if (!lport->tt.exch_seq_send(lport, fp, fc_rport_prli_resp, 1286 - NULL, rdata, 2 * lport->r_a_tov)) { 1285 + if (!fc_exch_seq_send(lport, fp, fc_rport_prli_resp, 1286 + NULL, rdata, 2 * lport->r_a_tov)) { 1287 1287 fc_rport_error_retry(rdata, -FC_EX_XMIT_ERR); 1288 1288 kref_put(&rdata->kref, lport->tt.rport_destroy); 1289 1289 }
+7 -31
include/scsi/libfc.h
··· 485 485 void *arg, u32 timer_msec); 486 486 487 487 /* 488 - * Send the FC frame payload using a new exchange and sequence. 489 - * 490 - * The exchange response handler is set in this routine to resp() 491 - * function pointer. It can be called in two scenarios: if a timeout 492 - * occurs or if a response frame is received for the exchange. The 493 - * fc_frame pointer in response handler will also indicate timeout 494 - * as error using IS_ERR related macros. 495 - * 496 - * The exchange destructor handler is also set in this routine. 497 - * The destructor handler is invoked by EM layer when exchange 498 - * is about to free, this can be used by caller to free its 499 - * resources along with exchange free. 500 - * 501 - * The arg is passed back to resp and destructor handler. 502 - * 503 - * The timeout value (in msec) for an exchange is set if non zero 504 - * timer_msec argument is specified. The timer is canceled when 505 - * it fires or when the exchange is done. The exchange timeout handler 506 - * is registered by EM layer. 507 - * 508 - * STATUS: OPTIONAL 509 - */ 510 - struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *, 511 - void (*resp)(struct fc_seq *, 512 - struct fc_frame *, 513 - void *), 514 - void (*destructor)(struct fc_seq *, 515 - void *), 516 - void *, unsigned int timer_msec); 517 - 518 - /* 519 488 * Sets up the DDP context for a given exchange id on the given 520 489 * scatterlist if LLD supports DDP for large receive. 521 490 * ··· 1086 1117 *****************************/ 1087 1118 int fc_exch_init(struct fc_lport *); 1088 1119 void fc_exch_update_stats(struct fc_lport *lport); 1120 + struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, 1121 + struct fc_frame *fp, 1122 + void (*resp)(struct fc_seq *, 1123 + struct fc_frame *fp, 1124 + void *arg), 1125 + void (*destructor)(struct fc_seq *, void *), 1126 + void *arg, u32 timer_msec); 1089 1127 void fc_seq_els_rsp_send(struct fc_frame *, enum fc_els_cmd, 1090 1128 struct fc_seq_els_data *); 1091 1129 struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,