mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Shuey <shuey@purdue.edu>
To: oleg.drokin@intel.com
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	HPDD-discuss@ml01.01.org, lustre-deve@lists.lustre.org,
	Mike Shuey <shuey@purdue.edu>
Subject: [PATCH v4 08/13] staging: lustre: lnet: remove LNET_MUTEX_LOCK macro
Date: Thu, 21 May 2015 15:50:31 -0400	[thread overview]
Message-ID: <1432237849-53947-9-git-send-email-shuey@purdue.edu> (raw)
In-Reply-To: <1432237849-53947-1-git-send-email-shuey@purdue.edu>

LNET_MUTEX_LOCK and LNET_MUTEX_UNLOCK are verbose wrappers to mutex_lock and
mutex_unlock.  Get rid of these.

Signed-off-by: Mike Shuey <shuey@purdue.edu>
---
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |    2 -
 drivers/staging/lustre/lnet/lnet/api-ni.c          |   26 ++++++++++----------
 drivers/staging/lustre/lnet/lnet/module.c          |   12 ++++----
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 0038d29..d84aa9a 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -172,8 +172,6 @@ lnet_net_lock_current(void)
 #define lnet_eq_wait_unlock()	spin_unlock(&the_lnet.ln_eq_wait_lock)
 #define lnet_ni_lock(ni)	spin_lock(&(ni)->ni_lock)
 #define lnet_ni_unlock(ni)	spin_unlock(&(ni)->ni_lock)
-#define LNET_MUTEX_LOCK(m)	mutex_lock(m)
-#define LNET_MUTEX_UNLOCK(m)	mutex_unlock(m)
 
 #define MAX_PORTALS     64
 
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 1adc481..2230eb0 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -282,7 +282,7 @@ lnet_find_lnd_by_type(int type)
 void
 lnet_register_lnd(lnd_t *lnd)
 {
-	LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
+	mutex_lock(&the_lnet.ln_lnd_mutex);
 
 	LASSERT(the_lnet.ln_init);
 	LASSERT(libcfs_isknown_lnd(lnd->lnd_type));
@@ -293,14 +293,14 @@ lnet_register_lnd(lnd_t *lnd)
 
 	CDEBUG(D_NET, "%s LND registered\n", libcfs_lnd2str(lnd->lnd_type));
 
-	LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+	mutex_unlock(&the_lnet.ln_lnd_mutex);
 }
 EXPORT_SYMBOL(lnet_register_lnd);
 
 void
 lnet_unregister_lnd(lnd_t *lnd)
 {
-	LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
+	mutex_lock(&the_lnet.ln_lnd_mutex);
 
 	LASSERT(the_lnet.ln_init);
 	LASSERT(lnet_find_lnd_by_type(lnd->lnd_type) == lnd);
@@ -309,7 +309,7 @@ lnet_unregister_lnd(lnd_t *lnd)
 	list_del(&lnd->lnd_list);
 	CDEBUG(D_NET, "%s LND unregistered\n", libcfs_lnd2str(lnd->lnd_type));
 
-	LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+	mutex_unlock(&the_lnet.ln_lnd_mutex);
 }
 EXPORT_SYMBOL(lnet_unregister_lnd);
 
@@ -1055,18 +1055,18 @@ lnet_startup_lndnis(void)
 			goto failed;
 		}
 
-		LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
+		mutex_lock(&the_lnet.ln_lnd_mutex);
 		lnd = lnet_find_lnd_by_type(lnd_type);
 
 		if (lnd == NULL) {
-			LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+			mutex_unlock(&the_lnet.ln_lnd_mutex);
 			rc = request_module("%s",
 						libcfs_lnd2modname(lnd_type));
-			LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
+			mutex_lock(&the_lnet.ln_lnd_mutex);
 
 			lnd = lnet_find_lnd_by_type(lnd_type);
 			if (lnd == NULL) {
-				LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+				mutex_unlock(&the_lnet.ln_lnd_mutex);
 				CERROR("Can't load LND %s, module %s, rc=%d\n",
 				       libcfs_lnd2str(lnd_type),
 				       libcfs_lnd2modname(lnd_type), rc);
@@ -1082,7 +1082,7 @@ lnet_startup_lndnis(void)
 
 		rc = (lnd->lnd_startup)(ni);
 
-		LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+		mutex_unlock(&the_lnet.ln_lnd_mutex);
 
 		if (rc != 0) {
 			LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s\n",
@@ -1272,7 +1272,7 @@ LNetNIInit(lnet_pid_t requested_pid)
 	int im_a_router = 0;
 	int rc;
 
-	LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
+	mutex_lock(&the_lnet.ln_api_mutex);
 
 	LASSERT(the_lnet.ln_init);
 	CDEBUG(D_OTHER, "refs %d\n", the_lnet.ln_refcount);
@@ -1343,7 +1343,7 @@ LNetNIInit(lnet_pid_t requested_pid)
  failed0:
 	LASSERT(rc < 0);
  out:
-	LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
+	mutex_unlock(&the_lnet.ln_api_mutex);
 	return rc;
 }
 EXPORT_SYMBOL(LNetNIInit);
@@ -1360,7 +1360,7 @@ EXPORT_SYMBOL(LNetNIInit);
 int
 LNetNIFini(void)
 {
-	LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
+	mutex_lock(&the_lnet.ln_api_mutex);
 
 	LASSERT(the_lnet.ln_init);
 	LASSERT(the_lnet.ln_refcount > 0);
@@ -1383,7 +1383,7 @@ LNetNIFini(void)
 		lnet_unprepare();
 	}
 
-	LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
+	mutex_unlock(&the_lnet.ln_api_mutex);
 	return 0;
 }
 EXPORT_SYMBOL(LNetNIFini);
diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c
index f73d644..6881b9c 100644
--- a/drivers/staging/lustre/lnet/lnet/module.c
+++ b/drivers/staging/lustre/lnet/lnet/module.c
@@ -49,7 +49,7 @@ lnet_configure(void *arg)
 	/* 'arg' only there so I can be passed to cfs_create_thread() */
 	int rc = 0;
 
-	LNET_MUTEX_LOCK(&lnet_config_mutex);
+	mutex_lock(&lnet_config_mutex);
 
 	if (!the_lnet.ln_niinit_self) {
 		rc = LNetNIInit(LUSTRE_SRV_LNET_PID);
@@ -59,7 +59,7 @@ lnet_configure(void *arg)
 		}
 	}
 
-	LNET_MUTEX_UNLOCK(&lnet_config_mutex);
+	mutex_unlock(&lnet_config_mutex);
 	return rc;
 }
 
@@ -68,18 +68,18 @@ lnet_unconfigure(void)
 {
 	int refcount;
 
-	LNET_MUTEX_LOCK(&lnet_config_mutex);
+	mutex_lock(&lnet_config_mutex);
 
 	if (the_lnet.ln_niinit_self) {
 		the_lnet.ln_niinit_self = 0;
 		LNetNIFini();
 	}
 
-	LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
+	mutex_lock(&the_lnet.ln_api_mutex);
 	refcount = the_lnet.ln_refcount;
-	LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
+	mutex_unlock(&the_lnet.ln_api_mutex);
 
-	LNET_MUTEX_UNLOCK(&lnet_config_mutex);
+	mutex_unlock(&lnet_config_mutex);
 	return (refcount == 0) ? 0 : -EBUSY;
 }
 
-- 
1.7.1


  parent reply	other threads:[~2015-05-21 19:57 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 19:50 [PATCH v4 00/13] staging: lustre: lnet: code cleanups Mike Shuey
2015-05-21 19:50 ` [PATCH v4 01/13] staging: lustre: lnet: lnet: code cleanups - variable declarations Mike Shuey
2015-05-21 19:50 ` [PATCH v4 02/13] staging: lustre: lnet: dead code - remove lnet_fini_locks Mike Shuey
2015-05-21 19:50 ` [PATCH v4 03/13] staging: lustre: lnet: dead code - remove LNetSetAsync Mike Shuey
2015-05-21 19:50 ` [PATCH v4 04/13] staging: lustre: lnet: lnet: Module is LNet, not Portals Mike Shuey
2015-05-21 19:50 ` [PATCH v4 05/13] staging: lustre: lnet: o2iblnd: code cleanup - align whitespace Mike Shuey
2015-05-22 13:03   ` Dan Carpenter
2015-05-21 19:50 ` [PATCH v4 06/13] staging: lustre: lnet: socklnd: code cleanup - align spacing Mike Shuey
2015-05-21 19:50 ` [PATCH v4 07/13] staging: lustre: lnet: selftest: code cleanup - variable spacing, indentation Mike Shuey
2015-05-21 19:50 ` Mike Shuey [this message]
2015-05-21 19:50 ` [PATCH v4 09/13] staging: lustre: lnet: lnet: remove dead code, fix checkpatch.pl issue Mike Shuey
2015-05-21 19:50 ` [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes Mike Shuey
2015-05-21 21:00   ` Joe Perches
2015-05-21 21:29     ` Julia Lawall
     [not found]       ` <CABqvwjuKypiacf3336j-q450FGKaO4wh0Ld7PF8MGz0VPsYBbw@mail.gmail.com>
2015-05-22  2:46         ` Joe Perches
2015-05-22  5:06         ` Julia Lawall
2015-05-22  8:08           ` Drokin, Oleg
2015-05-22 15:42             ` Joe Perches
2015-05-22 21:16               ` Drokin, Oleg
2015-05-22 23:57                 ` Joe Perches
2015-05-23  0:07                   ` Drokin, Oleg
2015-05-23  0:18                     ` Joe Perches
2015-05-23  0:25                       ` Drokin, Oleg
2015-05-23  0:36                         ` Joe Perches
2015-05-23  3:13                           ` [HPDD-discuss] " Patrick Farrell
     [not found]     ` <CABqvwjs=S1VrCHe7M4JnDikGBVN3yqjNMrtSA=UvftGmxSasRQ@mail.gmail.com>
2015-05-22  3:06       ` Joe Perches
2015-05-22  8:04       ` Drokin, Oleg
2015-05-22 10:00         ` Julia Lawall
2015-05-23  6:28     ` [PATCH] checkpatch: Categorize some long line length checks Joe Perches
2015-05-23 11:32       ` Julia Lawall
2015-05-23 17:26         ` Joe Perches
2015-05-23 18:07           ` Dan Carpenter
2015-05-23 18:13             ` Joe Perches
2015-05-23 18:21               ` Dan Carpenter
2015-05-24  2:49           ` [PATCH V2] " Joe Perches
2015-05-21 19:50 ` [PATCH v4 11/13] staging: lnet: o2iblnd: checkpatch.pl fixes Mike Shuey
2015-05-22 10:49   ` Dan Carpenter
2015-05-21 19:50 ` [PATCH v4 12/13] staging: lustre: lnet: socklnd: checkpatch.pl cleanups Mike Shuey
2015-05-21 19:50 ` [PATCH v4 13/13] staging: lustre: lnet: selftest: checkpatch.pl fixes Mike Shuey
2015-05-21 19:50 ` [PATCH 01/13] staging: lustre: lnet: lnet: code cleanups - variable declarations Mike Shuey
2015-05-21 19:50 ` [PATCH 02/13] staging: lustre: lnet: dead code - remove lnet_fini_locks Mike Shuey
2015-05-21 19:50 ` [PATCH 03/13] staging: lustre: lnet: dead code - remove LNetSetAsync Mike Shuey
2015-05-21 19:50 ` [PATCH 04/13] staging: lustre: lnet: lnet: Module is LNet, not Portals Mike Shuey
2015-05-21 19:50 ` [PATCH 05/13] staging: lustre: lnet: o2iblnd: code cleanup - align whitespace Mike Shuey
2015-05-21 19:50 ` [PATCH 06/13] staging: lustre: lnet: socklnd: code cleanup - align spacing Mike Shuey
2015-05-21 19:50 ` [PATCH 07/13] staging: lustre: lnet: selftest: code cleanup - variable spacing, indentation Mike Shuey
2015-05-21 19:50 ` [PATCH 08/13] staging: lustre: lnet: remove LNET_MUTEX_LOCK macro Mike Shuey
2015-05-21 19:50 ` [PATCH 09/13] staging: lustre: lnet: lnet: remove dead code, fix checkpatch.pl issue Mike Shuey
2015-05-21 19:50 ` [PATCH 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes Mike Shuey
2015-05-21 19:50 ` [PATCH 11/13] staging: lnet: o2iblnd: " Mike Shuey
2015-05-21 19:50 ` [PATCH 12/13] staging: lustre: lnet: socklnd: checkpatch.pl cleanups Mike Shuey
2015-05-21 19:50 ` [PATCH 13/13] staging: lustre: lnet: selftest: checkpatch.pl fixes Mike Shuey
2015-05-22 10:55   ` Dan Carpenter
2015-05-22  9:21 ` [PATCH v4 00/13] staging: lustre: lnet: code cleanups Dan Carpenter
     [not found]   ` <CABqvwjsJXJYciMDHqy9vEdL6dGLhx3+Pi0_ro6192Z5SGR9Q_w@mail.gmail.com>
2015-05-23 10:14     ` Dan Carpenter
2015-05-23 12:09       ` Michael Shuey
2015-05-23 12:39         ` Sudip Mukherjee
2015-05-23 14:05           ` Michael Shuey
2015-05-31  2:24             ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432237849-53947-9-git-send-email-shuey@purdue.edu \
    --to=shuey@purdue.edu \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-deve@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®