Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1420941 > unrolled thread
| Started by | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| First post | 2016-06-13 16:40 +0200 |
| Last post | 2016-06-15 07:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: gdm724x: Replace semaphore netlink with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-06-13 16:40 +0200
Re: [PATCH] staging: gdm724x: Replace semaphore netlink with mutex Arnd Bergmann <arnd@arndb.de> - 2016-06-13 17:50 +0200
[PATCH v2] staging: gdm724x: Replace semaphore netlink with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-06-15 07:50 +0200
| From | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| Date | 2016-06-13 16:40 +0200 |
| Subject | [PATCH] staging: gdm724x: Replace semaphore netlink with mutex |
| Message-ID | <rJBbY-7vM-25@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-06-13 17:50 +0200 |
| Message-ID | <rJChH-8go-9@gated-at.bofh.it> |
| In reply to | #1420941 |
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
[toc] | [prev] | [next] | [standalone]
| From | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| Date | 2016-06-15 07:50 +0200 |
| Subject | [PATCH v2] staging: gdm724x: Replace semaphore netlink with mutex |
| Message-ID | <rKbSa-6S6-27@gated-at.bofh.it> |
| In reply to | #1420941 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web