fc_lport_enter_reset() required the lport lock to be held by the caller,
but the template functions lport_reset and lport_login should not require
the caller to lock the lport. This adds fc_lport_reset() which just gets
the lock and calls fc_lport_enter_reset().
Signed-off-by: Robert Love <[EMAIL PROTECTED]>
---
drivers/scsi/libfc/fc_lport.c | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 1cbc2b4..c0a3554 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -38,6 +38,7 @@ static int fc_lport_debug;
static void fc_lport_enter_flogi(struct fc_lport *);
static void fc_lport_enter_logo(struct fc_lport *);
+static int fc_lport_reset(struct fc_lport *);
static const char *fc_lport_state_names[] = {
[LPORT_ST_NONE] = "none",
@@ -267,7 +268,7 @@ static void fc_lport_recv_logo_req(struct fc_seq *sp,
struct fc_frame *fp,
struct fc_lport *lp)
{
lp->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL);
- fc_lport_enter_reset(lp);
+ fc_lport_reset(lp);
fc_frame_free(fp);
}
@@ -280,9 +281,7 @@ int fc_fabric_login(struct fc_lport *lp)
int rc = -1;
if (lp->state == LPORT_ST_NONE) {
- fc_lport_lock(lp);
- fc_lport_enter_reset(lp);
- fc_lport_unlock(lp);
+ fc_lport_reset(lp);
rc = 0;
}
return rc;
@@ -295,13 +294,14 @@ EXPORT_SYMBOL(fc_fabric_login);
**/
void fc_linkup(struct fc_lport *lp)
{
+ fc_lport_lock(lp);
if ((lp->link_status & FC_LINK_UP) != FC_LINK_UP) {
lp->link_status |= FC_LINK_UP;
- fc_lport_lock(lp);
+ fc_lport_unlock(lp);
if (lp->state == LPORT_ST_RESET)
lp->tt.lport_login(lp);
+ } else
fc_lport_unlock(lp);
- }
}
EXPORT_SYMBOL(fc_linkup);
@@ -311,11 +311,14 @@ EXPORT_SYMBOL(fc_linkup);
**/
void fc_linkdown(struct fc_lport *lp)
{
+ fc_lport_lock(lp);
if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP) {
lp->link_status &= ~(FC_LINK_UP);
fc_lport_enter_reset(lp);
+ fc_lport_unlock(lp);
lp->tt.scsi_cleanup(lp);
- }
+ } else
+ fc_lport_unlock(lp);
}
EXPORT_SYMBOL(fc_linkdown);
@@ -409,7 +412,7 @@ int fc_set_mfs(struct fc_lport *lp, u32 mfs)
if (!rc && mfs < old_mfs) {
lp->ns_disc_done = 0;
- fc_lport_enter_reset(lp);
+ fc_lport_reset(lp);
}
return rc;
}
@@ -673,6 +676,14 @@ int fc_lport_enter_reset(struct fc_lport *lp)
}
EXPORT_SYMBOL(fc_lport_enter_reset);
+static int fc_lport_reset(struct fc_lport *lp)
+{
+ fc_lport_lock(lp);
+ fc_lport_enter_reset(lp);
+ fc_lport_unlock(lp);
+ return 0;
+}
+
/*
* Handle errors on local port requests.
* Don't get locks if in RESET state.
@@ -901,10 +912,10 @@ int fc_lport_init(struct fc_lport *lp)
lp->tt.lport_recv = fc_lport_recv;
if (!lp->tt.lport_login)
- lp->tt.lport_login = fc_lport_enter_reset;
+ lp->tt.lport_login = fc_lport_reset;
if (!lp->tt.lport_reset)
- lp->tt.lport_reset = fc_lport_enter_reset;
+ lp->tt.lport_reset = fc_lport_reset;
if (!lp->tt.lport_logout)
lp->tt.lport_logout = fc_lport_logout;
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel