Commit e87b7777 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

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

The ->rport_lookup callback only ever had a single implementation,
so we can as well call it directly and drop the callback.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Acked-by: default avatarJohannes Thumshirn <jth@kernel.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 944ef968
...@@ -2561,7 +2561,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac) ...@@ -2561,7 +2561,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac)
struct fcoe_rport *frport; struct fcoe_rport *frport;
int ret = -1; int ret = -1;
rdata = lport->tt.rport_lookup(lport, port_id); rdata = fc_rport_lookup(lport, port_id);
if (rdata) { if (rdata) {
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
memcpy(mac, frport->enode_mac, ETH_ALEN); memcpy(mac, frport->enode_mac, ETH_ALEN);
...@@ -2663,7 +2663,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, ...@@ -2663,7 +2663,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,
fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0);
return; return;
} }
rdata = lport->tt.rport_lookup(lport, new->ids.port_id); rdata = fc_rport_lookup(lport, new->ids.port_id);
if (rdata) { if (rdata) {
if (rdata->ids.node_name == new->ids.node_name && if (rdata->ids.node_name == new->ids.node_name &&
rdata->ids.port_name == new->ids.port_name) { rdata->ids.port_name == new->ids.port_name) {
......
...@@ -2125,7 +2125,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job) ...@@ -2125,7 +2125,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
break; break;
tov = rdata->e_d_tov; tov = rdata->e_d_tov;
} else { } else {
rdata = lport->tt.rport_lookup(lport, did); rdata = fc_rport_lookup(lport, did);
if (!rdata) if (!rdata)
break; break;
tov = rdata->e_d_tov; tov = rdata->e_d_tov;
......
...@@ -111,8 +111,8 @@ static const char *fc_rport_state_names[] = { ...@@ -111,8 +111,8 @@ static const char *fc_rport_state_names[] = {
* The reference count of the fc_rport_priv structure is * The reference count of the fc_rport_priv structure is
* increased by one. * increased by one.
*/ */
static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport, struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
u32 port_id) u32 port_id)
{ {
struct fc_rport_priv *rdata = NULL, *tmp_rdata; struct fc_rport_priv *rdata = NULL, *tmp_rdata;
...@@ -126,6 +126,7 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport, ...@@ -126,6 +126,7 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
rcu_read_unlock(); rcu_read_unlock();
return rdata; return rdata;
} }
EXPORT_SYMBOL(fc_rport_lookup);
/** /**
* fc_rport_create() - Create a new remote port * fc_rport_create() - Create a new remote port
...@@ -141,7 +142,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, ...@@ -141,7 +142,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
{ {
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
rdata = lport->tt.rport_lookup(lport, port_id); rdata = fc_rport_lookup(lport, port_id);
if (rdata) if (rdata)
return rdata; return rdata;
...@@ -875,7 +876,7 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport, ...@@ -875,7 +876,7 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport,
goto reject; goto reject;
} }
rdata = lport->tt.rport_lookup(lport, sid); rdata = fc_rport_lookup(lport, sid);
if (!rdata) { if (!rdata) {
rjt_data.reason = ELS_RJT_FIP; rjt_data.reason = ELS_RJT_FIP;
rjt_data.explan = ELS_EXPL_NOT_NEIGHBOR; rjt_data.explan = ELS_EXPL_NOT_NEIGHBOR;
...@@ -1684,7 +1685,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp) ...@@ -1684,7 +1685,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
struct fc_seq_els_data els_data; struct fc_seq_els_data els_data;
rdata = lport->tt.rport_lookup(lport, fc_frame_sid(fp)); rdata = fc_rport_lookup(lport, fc_frame_sid(fp));
if (!rdata) { if (!rdata) {
FC_RPORT_ID_DBG(lport, fc_frame_sid(fp), FC_RPORT_ID_DBG(lport, fc_frame_sid(fp),
"Received ELS 0x%02x from non-logged-in port\n", "Received ELS 0x%02x from non-logged-in port\n",
...@@ -2145,7 +2146,7 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) ...@@ -2145,7 +2146,7 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp)
sid = fc_frame_sid(fp); sid = fc_frame_sid(fp);
rdata = lport->tt.rport_lookup(lport, sid); rdata = fc_rport_lookup(lport, sid);
if (rdata) { if (rdata) {
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n",
...@@ -2174,9 +2175,6 @@ static void fc_rport_flush_queue(void) ...@@ -2174,9 +2175,6 @@ static void fc_rport_flush_queue(void)
*/ */
int fc_rport_init(struct fc_lport *lport) 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) if (!lport->tt.rport_create)
lport->tt.rport_create = fc_rport_create; lport->tt.rport_create = fc_rport_create;
......
...@@ -644,13 +644,6 @@ struct libfc_function_template { ...@@ -644,13 +644,6 @@ struct libfc_function_template {
*/ */
void (*rport_recv_req)(struct fc_lport *, struct fc_frame *); void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
/*
* lookup an rport by it's port ID.
*
* STATUS: OPTIONAL
*/
struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *, u32);
/* /*
* Callback routine after the remote port is logged in * Callback routine after the remote port is logged in
* *
...@@ -1029,6 +1022,8 @@ void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *); ...@@ -1029,6 +1022,8 @@ void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *);
*****************************/ *****************************/
int fc_rport_init(struct fc_lport *); int fc_rport_init(struct fc_lport *);
void fc_rport_terminate_io(struct fc_rport *); void fc_rport_terminate_io(struct fc_rport *);
struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
u32 port_id);
void fc_rport_destroy(struct kref *kref); void fc_rport_destroy(struct kref *kref);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment