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

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

The ->rport_create 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 558b88fe
...@@ -2515,7 +2515,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) ...@@ -2515,7 +2515,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)
return; return;
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
rdata = lport->tt.rport_create(lport, port_id); rdata = fc_rport_create(lport, port_id);
if (!rdata) { if (!rdata) {
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
return; return;
......
...@@ -454,7 +454,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) ...@@ -454,7 +454,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
if (ids.port_id != lport->port_id && if (ids.port_id != lport->port_id &&
ids.port_name != lport->wwpn) { ids.port_name != lport->wwpn) {
rdata = lport->tt.rport_create(lport, ids.port_id); rdata = fc_rport_create(lport, ids.port_id);
if (rdata) { if (rdata) {
rdata->ids.port_name = ids.port_name; rdata->ids.port_name = ids.port_name;
rdata->disc_id = disc->disc_id; rdata->disc_id = disc->disc_id;
...@@ -624,8 +624,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -624,8 +624,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
new_rdata = lport->tt.rport_create(lport, new_rdata = fc_rport_create(lport, rdata->ids.port_id);
rdata->ids.port_id);
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
if (new_rdata) { if (new_rdata) {
new_rdata->disc_id = disc->disc_id; new_rdata->disc_id = disc->disc_id;
...@@ -690,7 +689,7 @@ static int fc_disc_single(struct fc_lport *lport, struct fc_disc_port *dp) ...@@ -690,7 +689,7 @@ static int fc_disc_single(struct fc_lport *lport, struct fc_disc_port *dp)
{ {
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
rdata = lport->tt.rport_create(lport, dp->port_id); rdata = fc_rport_create(lport, dp->port_id);
if (!rdata) if (!rdata)
return -ENOMEM; return -ENOMEM;
rdata->disc_id = 0; rdata->disc_id = 0;
......
...@@ -250,7 +250,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, ...@@ -250,7 +250,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport,
kref_put(&lport->ptp_rdata->kref, fc_rport_destroy); kref_put(&lport->ptp_rdata->kref, fc_rport_destroy);
} }
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
lport->ptp_rdata = lport->tt.rport_create(lport, remote_fid); lport->ptp_rdata = fc_rport_create(lport, remote_fid);
kref_get(&lport->ptp_rdata->kref); kref_get(&lport->ptp_rdata->kref);
lport->ptp_rdata->ids.port_name = remote_wwpn; lport->ptp_rdata->ids.port_name = remote_wwpn;
lport->ptp_rdata->ids.node_name = remote_wwnn; lport->ptp_rdata->ids.node_name = remote_wwnn;
...@@ -1431,7 +1431,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport) ...@@ -1431,7 +1431,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport)
fc_lport_state_enter(lport, LPORT_ST_DNS); fc_lport_state_enter(lport, LPORT_ST_DNS);
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
rdata = lport->tt.rport_create(lport, FC_FID_DIR_SERV); rdata = fc_rport_create(lport, FC_FID_DIR_SERV);
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
if (!rdata) if (!rdata)
goto err; goto err;
...@@ -1548,7 +1548,7 @@ static void fc_lport_enter_fdmi(struct fc_lport *lport) ...@@ -1548,7 +1548,7 @@ static void fc_lport_enter_fdmi(struct fc_lport *lport)
fc_lport_state_enter(lport, LPORT_ST_FDMI); fc_lport_state_enter(lport, LPORT_ST_FDMI);
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
rdata = lport->tt.rport_create(lport, FC_FID_MGMT_SERV); rdata = fc_rport_create(lport, FC_FID_MGMT_SERV);
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
if (!rdata) if (!rdata)
goto err; goto err;
......
...@@ -137,8 +137,7 @@ EXPORT_SYMBOL(fc_rport_lookup); ...@@ -137,8 +137,7 @@ EXPORT_SYMBOL(fc_rport_lookup);
* *
* Locking note: must be called with the disc_mutex held. * Locking note: must be called with the disc_mutex held.
*/ */
static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
u32 port_id)
{ {
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
...@@ -172,6 +171,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, ...@@ -172,6 +171,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
} }
return rdata; return rdata;
} }
EXPORT_SYMBOL(fc_rport_create);
/** /**
* fc_rport_destroy() - Free a remote port after last reference is released * fc_rport_destroy() - Free a remote port after last reference is released
...@@ -1847,7 +1847,7 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport, ...@@ -1847,7 +1847,7 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
disc = &lport->disc; disc = &lport->disc;
mutex_lock(&disc->disc_mutex); mutex_lock(&disc->disc_mutex);
rdata = lport->tt.rport_create(lport, sid); rdata = fc_rport_create(lport, sid);
if (!rdata) { if (!rdata) {
mutex_unlock(&disc->disc_mutex); mutex_unlock(&disc->disc_mutex);
rjt_data.reason = ELS_RJT_UNAB; rjt_data.reason = ELS_RJT_UNAB;
...@@ -2175,9 +2175,6 @@ static void fc_rport_flush_queue(void) ...@@ -2175,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_create)
lport->tt.rport_create = fc_rport_create;
if (!lport->tt.rport_login) if (!lport->tt.rport_login)
lport->tt.rport_login = fc_rport_login; lport->tt.rport_login = fc_rport_login;
......
...@@ -609,13 +609,6 @@ struct libfc_function_template { ...@@ -609,13 +609,6 @@ struct libfc_function_template {
void (*lport_set_port_id)(struct fc_lport *, u32 port_id, void (*lport_set_port_id)(struct fc_lport *, u32 port_id,
struct fc_frame *); struct fc_frame *);
/*
* Create a remote port with a given port ID
*
* STATUS: OPTIONAL
*/
struct fc_rport_priv *(*rport_create)(struct fc_lport *, u32);
/* /*
* Initiates the RP state machine. It is called from the LP module. * Initiates the RP state machine. It is called from the LP module.
* This function will issue the following commands to the N_Port * This function will issue the following commands to the N_Port
...@@ -1024,6 +1017,7 @@ int fc_rport_init(struct fc_lport *); ...@@ -1024,6 +1017,7 @@ 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, struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
u32 port_id); u32 port_id);
struct fc_rport_priv *fc_rport_create(struct fc_lport *, u32);
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