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

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

The ->rport_destroy callback only ever had one 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 3afd2d15
...@@ -2180,7 +2180,7 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport) ...@@ -2180,7 +2180,7 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)
list_for_each_entry_rcu(rdata, &lport->disc.rports, peers) { list_for_each_entry_rcu(rdata, &lport->disc.rports, peers) {
if (kref_get_unless_zero(&rdata->kref)) { if (kref_get_unless_zero(&rdata->kref)) {
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -2566,7 +2566,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac) ...@@ -2566,7 +2566,7 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac)
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
memcpy(mac, frport->enode_mac, ETH_ALEN); memcpy(mac, frport->enode_mac, ETH_ALEN);
ret = 0; ret = 0;
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
return ret; return ret;
} }
...@@ -2678,7 +2678,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, ...@@ -2678,7 +2678,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,
} }
frport->time = jiffies; frport->time = jiffies;
} }
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
return; return;
} }
if (fip->state != FIP_ST_VNMP_UP) if (fip->state != FIP_ST_VNMP_UP)
...@@ -2719,7 +2719,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip) ...@@ -2719,7 +2719,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)
continue; continue;
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
if (!frport->time) { if (!frport->time) {
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
continue; continue;
} }
deadline = frport->time + deadline = frport->time +
...@@ -2732,7 +2732,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip) ...@@ -2732,7 +2732,7 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
} else if (time_before(deadline, next_time)) } else if (time_before(deadline, next_time))
next_time = deadline; next_time = deadline;
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
rcu_read_unlock(); rcu_read_unlock();
return next_time; return next_time;
...@@ -3089,7 +3089,7 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip) ...@@ -3089,7 +3089,7 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip)
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
if (frport->time) if (frport->time)
lport->tt.rport_login(rdata); lport->tt.rport_login(rdata);
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
rcu_read_unlock(); rcu_read_unlock();
if (callback) if (callback)
......
...@@ -72,7 +72,7 @@ static void fc_disc_stop_rports(struct fc_disc *disc) ...@@ -72,7 +72,7 @@ static void fc_disc_stop_rports(struct fc_disc *disc)
list_for_each_entry_rcu(rdata, &disc->rports, peers) { list_for_each_entry_rcu(rdata, &disc->rports, peers) {
if (kref_get_unless_zero(&rdata->kref)) { if (kref_get_unless_zero(&rdata->kref)) {
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -303,7 +303,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event) ...@@ -303,7 +303,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
else else
lport->tt.rport_logoff(rdata); lport->tt.rport_logoff(rdata);
} }
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
rcu_read_unlock(); rcu_read_unlock();
mutex_unlock(&disc->disc_mutex); mutex_unlock(&disc->disc_mutex);
...@@ -649,7 +649,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -649,7 +649,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_unlock(&disc->disc_mutex); mutex_unlock(&disc->disc_mutex);
} }
out: out:
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
/** /**
......
...@@ -247,7 +247,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, ...@@ -247,7 +247,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport,
{ {
if (lport->ptp_rdata) { if (lport->ptp_rdata) {
lport->tt.rport_logoff(lport->ptp_rdata); lport->tt.rport_logoff(lport->ptp_rdata);
kref_put(&lport->ptp_rdata->kref, lport->tt.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 = lport->tt.rport_create(lport, remote_fid);
...@@ -1017,7 +1017,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport) ...@@ -1017,7 +1017,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
if (lport->ptp_rdata) { if (lport->ptp_rdata) {
lport->tt.rport_logoff(lport->ptp_rdata); lport->tt.rport_logoff(lport->ptp_rdata);
kref_put(&lport->ptp_rdata->kref, lport->tt.rport_destroy); kref_put(&lport->ptp_rdata->kref, fc_rport_destroy);
lport->ptp_rdata = NULL; lport->ptp_rdata = NULL;
} }
...@@ -2129,7 +2129,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job) ...@@ -2129,7 +2129,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
if (!rdata) if (!rdata)
break; break;
tov = rdata->e_d_tov; tov = rdata->e_d_tov;
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
rc = fc_lport_ct_request(job, lport, did, tov); rc = fc_lport_ct_request(job, lport, did, tov);
......
This diff is collapsed.
...@@ -651,12 +651,6 @@ struct libfc_function_template { ...@@ -651,12 +651,6 @@ struct libfc_function_template {
*/ */
struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *, u32); struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *, u32);
/*
* Destroy an rport after final kref_put().
* The argument is a pointer to the kref inside the fc_rport_priv.
*/
void (*rport_destroy)(struct kref *);
/* /*
* Callback routine after the remote port is logged in * Callback routine after the remote port is logged in
* *
...@@ -1035,6 +1029,7 @@ void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *); ...@@ -1035,6 +1029,7 @@ 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 *);
void fc_rport_destroy(struct kref *kref);
/* /*
* DISCOVERY LAYER * DISCOVERY LAYER
......
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