linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: gdm724x: Replace semaphore netlink with mutex
@ 2016-06-13 14:29 Binoy Jayan
  2016-06-13 15:48 ` Arnd Bergmann
  2016-06-15  5:40 ` [PATCH v2] " Binoy Jayan
  0 siblings, 2 replies; 3+ messages in thread
From: Binoy Jayan @ 2016-06-13 14:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, devel, linux-kernel, Binoy Jayan

Replace semaphore netlink_mutex with mutex. Semaphores are
going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
---
 drivers/staging/gdm724x/netlink_k.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm724x/netlink_k.c b/drivers/staging/gdm724x/netlink_k.c
index a0232e8..57db83d 100644
--- a/drivers/staging/gdm724x/netlink_k.c
+++ b/drivers/staging/gdm724x/netlink_k.c
@@ -21,13 +21,7 @@
 
 #include "netlink_k.h"
 
-#if defined(DEFINE_MUTEX)
-static DEFINE_MUTEX(netlink_mutex);
-#else
-static struct semaphore netlink_mutex;
-#define mutex_lock(x)		down(x)
-#define mutex_unlock(x)		up(x)
-#endif
+static struct mutex netlink_mutex;
 
 #define ND_MAX_GROUP		30
 #define ND_IFINDEX_LEN		sizeof(int)
@@ -96,9 +90,7 @@ struct sock *netlink_init(int unit,
 		.input  = netlink_rcv,
 	};
 
-#if !defined(DEFINE_MUTEX)
-	init_MUTEX(&netlink_mutex);
-#endif
+	mutex_init(&netlink_mutex);
 
 	sock = netlink_kernel_create(&init_net, unit, &cfg);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: gdm724x: Replace semaphore netlink with mutex
  2016-06-13 14:29 [PATCH] staging: gdm724x: Replace semaphore netlink with mutex Binoy Jayan
@ 2016-06-13 15:48 ` Arnd Bergmann
  2016-06-15  5:40 ` [PATCH v2] " Binoy Jayan
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-06-13 15:48 UTC (permalink / raw)
  To: Binoy Jayan; +Cc: Greg Kroah-Hartman, devel, linux-kernel

On Monday, June 13, 2016 7:59:20 PM CEST Binoy Jayan wrote:
> 
> -#if defined(DEFINE_MUTEX)
> -static DEFINE_MUTEX(netlink_mutex);
> -#else
> -static struct semaphore netlink_mutex;
> -#define mutex_lock(x)          down(x)
> -#define mutex_unlock(x)                up(x)
> -#endif
> +static struct mutex netlink_mutex;
> 

Good catch! I think the patch is correct, but the DEFINE_MUTEX
here seems preferable over the runtime mutex_init() call.

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] staging: gdm724x: Replace semaphore netlink with mutex
  2016-06-13 14:29 [PATCH] staging: gdm724x: Replace semaphore netlink with mutex Binoy Jayan
  2016-06-13 15:48 ` Arnd Bergmann
@ 2016-06-15  5:40 ` Binoy Jayan
  1 sibling, 0 replies; 3+ messages in thread
From: Binoy Jayan @ 2016-06-15  5:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, driverdev-devel, linux-kernel, Binoy Jayan

Replace semaphore netlink_mutex with mutex. Semaphores are
going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/gdm724x/netlink_k.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/gdm724x/netlink_k.c b/drivers/staging/gdm724x/netlink_k.c
index a0232e8..abe2425 100644
--- a/drivers/staging/gdm724x/netlink_k.c
+++ b/drivers/staging/gdm724x/netlink_k.c
@@ -14,6 +14,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/export.h>
+#include <linux/mutex.h>
 #include <linux/etherdevice.h>
 #include <linux/netlink.h>
 #include <asm/byteorder.h>
@@ -21,13 +22,7 @@
 
 #include "netlink_k.h"
 
-#if defined(DEFINE_MUTEX)
 static DEFINE_MUTEX(netlink_mutex);
-#else
-static struct semaphore netlink_mutex;
-#define mutex_lock(x)		down(x)
-#define mutex_unlock(x)		up(x)
-#endif
 
 #define ND_MAX_GROUP		30
 #define ND_IFINDEX_LEN		sizeof(int)
@@ -96,10 +91,6 @@ struct sock *netlink_init(int unit,
 		.input  = netlink_rcv,
 	};
 
-#if !defined(DEFINE_MUTEX)
-	init_MUTEX(&netlink_mutex);
-#endif
-
 	sock = netlink_kernel_create(&init_net, unit, &cfg);
 
 	if (sock)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-15  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 14:29 [PATCH] staging: gdm724x: Replace semaphore netlink with mutex Binoy Jayan
2016-06-13 15:48 ` Arnd Bergmann
2016-06-15  5:40 ` [PATCH v2] " Binoy Jayan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).