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

The ->rport_login callback only ever had one implementation,
so we can as well call it 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>
This commit is contained in:
Hannes Reinecke 2016-10-18 10:01:43 +02:00 committed by Martin K. Petersen
parent 2580064b5e
commit 05d7d3b0bd
5 changed files with 19 additions and 25 deletions

View File

@ -2674,7 +2674,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,
LIBFCOE_FIP_DBG(fip, "beacon expired " LIBFCOE_FIP_DBG(fip, "beacon expired "
"for rport %x\n", "for rport %x\n",
rdata->ids.port_id); rdata->ids.port_id);
lport->tt.rport_login(rdata); fc_rport_login(rdata);
} }
frport->time = jiffies; frport->time = jiffies;
} }
@ -3088,7 +3088,7 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip)
continue; continue;
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
if (frport->time) if (frport->time)
lport->tt.rport_login(rdata); fc_rport_login(rdata);
kref_put(&rdata->kref, fc_rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
rcu_read_unlock(); rcu_read_unlock();

View File

@ -299,7 +299,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
continue; continue;
if (rdata->disc_id) { if (rdata->disc_id) {
if (rdata->disc_id == disc->disc_id) if (rdata->disc_id == disc->disc_id)
lport->tt.rport_login(rdata); fc_rport_login(rdata);
else else
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
} }
@ -628,13 +628,13 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
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;
lport->tt.rport_login(new_rdata); fc_rport_login(new_rdata);
} }
goto out; goto out;
} }
rdata->disc_id = disc->disc_id; rdata->disc_id = disc->disc_id;
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
lport->tt.rport_login(rdata); fc_rport_login(rdata);
} else if (ntohs(cp->ct_cmd) == FC_FS_RJT) { } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
FC_DISC_DBG(disc, "GPN_ID rejected reason %x exp %x\n", FC_DISC_DBG(disc, "GPN_ID rejected reason %x exp %x\n",
cp->ct_reason, cp->ct_explan); cp->ct_reason, cp->ct_explan);

View File

@ -256,7 +256,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport,
lport->ptp_rdata->ids.node_name = remote_wwnn; lport->ptp_rdata->ids.node_name = remote_wwnn;
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
lport->tt.rport_login(lport->ptp_rdata); fc_rport_login(lport->ptp_rdata);
fc_lport_enter_ready(lport); fc_lport_enter_ready(lport);
} }
@ -1437,7 +1437,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport)
goto err; goto err;
rdata->ops = &fc_lport_rport_ops; rdata->ops = &fc_lport_rport_ops;
lport->tt.rport_login(rdata); fc_rport_login(rdata);
return; return;
err: err:
@ -1554,7 +1554,7 @@ static void fc_lport_enter_fdmi(struct fc_lport *lport)
goto err; goto err;
rdata->ops = &fc_lport_rport_ops; rdata->ops = &fc_lport_rport_ops;
lport->tt.rport_login(rdata); fc_rport_login(rdata);
return; return;
err: err:

View File

@ -412,6 +412,14 @@ static void fc_rport_work(struct work_struct *work)
* fc_rport_login() - Start the remote port login state machine * fc_rport_login() - Start the remote port login state machine
* @rdata: The remote port to be logged in to * @rdata: The remote port to be logged in to
* *
* Initiates the RP state machine. It is called from the LP module.
* This function will issue the following commands to the N_Port
* identified by the FC ID provided.
*
* - PLOGI
* - PRLI
* - RTV
*
* Locking Note: Called without the rport lock held. This * Locking Note: Called without the rport lock held. This
* function will hold the rport lock, call an _enter_* * function will hold the rport lock, call an _enter_*
* function and then unlock the rport. * function and then unlock the rport.
@ -420,7 +428,7 @@ static void fc_rport_work(struct work_struct *work)
* If it appears we are already logged in, ADISC is used to verify * If it appears we are already logged in, ADISC is used to verify
* the setup. * the setup.
*/ */
static int fc_rport_login(struct fc_rport_priv *rdata) int fc_rport_login(struct fc_rport_priv *rdata)
{ {
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
@ -452,6 +460,7 @@ static int fc_rport_login(struct fc_rport_priv *rdata)
return 0; return 0;
} }
EXPORT_SYMBOL(fc_rport_login);
/** /**
* fc_rport_enter_delete() - Schedule a remote port to be deleted * fc_rport_enter_delete() - Schedule a remote port to be deleted
@ -2175,9 +2184,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_login)
lport->tt.rport_login = fc_rport_login;
if (!lport->tt.rport_logoff) if (!lport->tt.rport_logoff)
lport->tt.rport_logoff = fc_rport_logoff; lport->tt.rport_logoff = fc_rport_logoff;

View File

@ -609,19 +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 *);
/*
* Initiates the RP state machine. It is called from the LP module.
* This function will issue the following commands to the N_Port
* identified by the FC ID provided.
*
* - PLOGI
* - PRLI
* - RTV
*
* STATUS: OPTIONAL
*/
int (*rport_login)(struct fc_rport_priv *);
/* /*
* Logoff, and remove the rport from the transport if * Logoff, and remove the rport from the transport if
* it had been added. This will send a LOGO to the target. * it had been added. This will send a LOGO to the target.
@ -1019,6 +1006,7 @@ 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); 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);
int fc_rport_login(struct fc_rport_priv *rdata);
/* /*
* DISCOVERY LAYER * DISCOVERY LAYER