Message ID | 1465828160-17141-1-git-send-email-binoy.jayan@linaro.org |
---|---|
State | Superseded |
Headers | show |
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
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);
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(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project