[Open-FCoE] [RFC PATCH 4/6] fcoe: adds fcoe_em_free

Vasu Dev vasu.dev at intel.com
Wed Apr 29 15:15:13 UTC 2009


Adds fcoe_em_free instead calling fc_exch_mgr_free since
next patch will use this to free more than one em instances
in fcoe.

Renames fcoe_em_config to fcoe_em_alloc since this func
allocates an em instance and new name go along well as
inverse of fcoe_em_free.

Signed-off-by: Vasu Dev <vasu.dev at intel.com>
---

 drivers/scsi/fcoe/fcoe.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index fde0f29..8dfaa31 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -319,12 +319,12 @@ static int fcoe_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
 }
 
 /**
- * fcoe_em_config() - allocates em for this lport
+ * fcoe_em_alloc() - allocates em for this lport
  * @lp: the port that em is to allocated for
  *
  * Returns : 0 on success
  */
-static inline int fcoe_em_config(struct fc_lport *lp)
+static inline int fcoe_em_alloc(struct fc_lport *lp)
 {
 	BUG_ON(lp->emp);
 
@@ -337,6 +337,18 @@ static inline int fcoe_em_config(struct fc_lport *lp)
 }
 
 /**
+ * fcoe_em_free() - frees allocated em for a lport
+ * @lp: the port that em is to allocated for
+ *
+ * Returns : 0 on success
+ */
+static inline int fcoe_em_free(struct fc_lport *lp)
+{
+	fc_exch_mgr_free(lp->emp);
+	return 0;
+}
+
+/**
  * fcoe_if_destroy() - FCoE software HBA tear-down function
  * @netdev: ptr to the associated net_device
  *
@@ -380,7 +392,7 @@ static int fcoe_if_destroy(struct net_device *netdev)
 
 	/* There are no more rports or I/O, free the EM */
 	if (lp->emp)
-		fc_exch_mgr_free(lp->emp);
+		fcoe_em_free(lp);
 
 	/* Delete secondary MAC addresses */
 	rtnl_lock();
@@ -580,7 +592,7 @@ static int fcoe_if_create(struct net_device *netdev)
 	}
 
 	/* lport exch manager allocation */
-	rc = fcoe_em_config(lp);
+	rc = fcoe_em_alloc(lp);
 	if (rc) {
 		FC_DBG("Could not configure em for lport\n");
 		goto out_lp_destroy;
@@ -601,7 +613,7 @@ static int fcoe_if_create(struct net_device *netdev)
 	return rc;
 
 out_lp_destroy:
-	fc_exch_mgr_free(lp->emp); /* Free the EM */
+	fcoe_em_free(lp);
 out_host_put:
 	scsi_host_put(lp->host);
 	return rc;




More information about the devel mailing list