Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a3e2f71 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by David S. Miller
Browse files

[NET] sem2mutex: net/



Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4ccd08c
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/crypto.h>
#include <linux/crypto.h>
#include <linux/pfkeyv2.h>
#include <linux/pfkeyv2.h>
#include <linux/in6.h>
#include <linux/in6.h>
#include <linux/mutex.h>


#include <net/sock.h>
#include <net/sock.h>
#include <net/dst.h>
#include <net/dst.h>
@@ -24,7 +25,7 @@ extern struct sock *xfrm_nl;
extern u32 sysctl_xfrm_aevent_etime;
extern u32 sysctl_xfrm_aevent_etime;
extern u32 sysctl_xfrm_aevent_rseqth;
extern u32 sysctl_xfrm_aevent_rseqth;


extern struct semaphore xfrm_cfg_sem;
extern struct mutex xfrm_cfg_mutex;


/* Organization of SPD aka "XFRM rules"
/* Organization of SPD aka "XFRM rules"
   ------------------------------------
   ------------------------------------
+8 −7
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/atmmpc.h>
#include <linux/atmmpc.h>
#include <net/atmclip.h>
#include <net/atmclip.h>
#include <linux/atmlec.h>
#include <linux/atmlec.h>
#include <linux/mutex.h>
#include <asm/ioctls.h>
#include <asm/ioctls.h>


#include "resources.h"
#include "resources.h"
@@ -25,22 +26,22 @@
#include "common.h"
#include "common.h"




static DECLARE_MUTEX(ioctl_mutex);
static DEFINE_MUTEX(ioctl_mutex);
static LIST_HEAD(ioctl_list);
static LIST_HEAD(ioctl_list);




void register_atm_ioctl(struct atm_ioctl *ioctl)
void register_atm_ioctl(struct atm_ioctl *ioctl)
{
{
	down(&ioctl_mutex);
	mutex_lock(&ioctl_mutex);
	list_add_tail(&ioctl->list, &ioctl_list);
	list_add_tail(&ioctl->list, &ioctl_list);
	up(&ioctl_mutex);
	mutex_unlock(&ioctl_mutex);
}
}


void deregister_atm_ioctl(struct atm_ioctl *ioctl)
void deregister_atm_ioctl(struct atm_ioctl *ioctl)
{
{
	down(&ioctl_mutex);
	mutex_lock(&ioctl_mutex);
	list_del(&ioctl->list);
	list_del(&ioctl->list);
	up(&ioctl_mutex);
	mutex_unlock(&ioctl_mutex);
}
}


EXPORT_SYMBOL(register_atm_ioctl);
EXPORT_SYMBOL(register_atm_ioctl);
@@ -137,7 +138,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)


	error = -ENOIOCTLCMD;
	error = -ENOIOCTLCMD;


	down(&ioctl_mutex);
	mutex_lock(&ioctl_mutex);
	list_for_each(pos, &ioctl_list) {
	list_for_each(pos, &ioctl_list) {
		struct atm_ioctl * ic = list_entry(pos, struct atm_ioctl, list);
		struct atm_ioctl * ic = list_entry(pos, struct atm_ioctl, list);
		if (try_module_get(ic->owner)) {
		if (try_module_get(ic->owner)) {
@@ -147,7 +148,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
				break;
				break;
		}
		}
	}
	}
	up(&ioctl_mutex);
	mutex_unlock(&ioctl_mutex);


	if (error != -ENOIOCTLCMD)
	if (error != -ENOIOCTLCMD)
		goto done;
		goto done;
+5 −3
Original line number Original line Diff line number Diff line
@@ -37,6 +37,8 @@
#include <linux/wait.h>
#include <linux/wait.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/net.h>
#include <linux/net.h>
#include <linux/mutex.h>

#include <net/sock.h>
#include <net/sock.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
#include <asm/unaligned.h>
@@ -57,9 +59,9 @@ static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU;


static struct task_struct *rfcomm_thread;
static struct task_struct *rfcomm_thread;


static DECLARE_MUTEX(rfcomm_sem);
static DEFINE_MUTEX(rfcomm_mutex);
#define rfcomm_lock()	down(&rfcomm_sem);
#define rfcomm_lock()	mutex_lock(&rfcomm_mutex)
#define rfcomm_unlock()	up(&rfcomm_sem);
#define rfcomm_unlock()	mutex_unlock(&rfcomm_mutex)


static unsigned long rfcomm_event;
static unsigned long rfcomm_event;


+4 −3
Original line number Original line Diff line number Diff line
@@ -81,6 +81,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/string.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/socket.h>
@@ -2931,7 +2932,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
 * 2) Since we run with the RTNL semaphore not held, we can sleep
 * 2) Since we run with the RTNL semaphore not held, we can sleep
 *    safely in order to wait for the netdev refcnt to drop to zero.
 *    safely in order to wait for the netdev refcnt to drop to zero.
 */
 */
static DECLARE_MUTEX(net_todo_run_mutex);
static DEFINE_MUTEX(net_todo_run_mutex);
void netdev_run_todo(void)
void netdev_run_todo(void)
{
{
	struct list_head list = LIST_HEAD_INIT(list);
	struct list_head list = LIST_HEAD_INIT(list);
@@ -2939,7 +2940,7 @@ void netdev_run_todo(void)




	/* Need to guard against multiple cpu's getting out of order. */
	/* Need to guard against multiple cpu's getting out of order. */
	down(&net_todo_run_mutex);
	mutex_lock(&net_todo_run_mutex);


	/* Not safe to do outside the semaphore.  We must not return
	/* Not safe to do outside the semaphore.  We must not return
	 * until all unregister events invoked by the local processor
	 * until all unregister events invoked by the local processor
@@ -2996,7 +2997,7 @@ void netdev_run_todo(void)
	}
	}


out:
out:
	up(&net_todo_run_mutex);
	mutex_unlock(&net_todo_run_mutex);
}
}


/**
/**
+4 −3
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/notifier.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/cpumask.h>
#include <linux/mutex.h>
#include <net/flow.h>
#include <net/flow.h>
#include <asm/atomic.h>
#include <asm/atomic.h>
#include <asm/semaphore.h>
#include <asm/semaphore.h>
@@ -287,11 +288,11 @@ static void flow_cache_flush_per_cpu(void *data)
void flow_cache_flush(void)
void flow_cache_flush(void)
{
{
	struct flow_flush_info info;
	struct flow_flush_info info;
	static DECLARE_MUTEX(flow_flush_sem);
	static DEFINE_MUTEX(flow_flush_sem);


	/* Don't want cpus going down or up during this. */
	/* Don't want cpus going down or up during this. */
	lock_cpu_hotplug();
	lock_cpu_hotplug();
	down(&flow_flush_sem);
	mutex_lock(&flow_flush_sem);
	atomic_set(&info.cpuleft, num_online_cpus());
	atomic_set(&info.cpuleft, num_online_cpus());
	init_completion(&info.completion);
	init_completion(&info.completion);


@@ -301,7 +302,7 @@ void flow_cache_flush(void)
	local_bh_enable();
	local_bh_enable();


	wait_for_completion(&info.completion);
	wait_for_completion(&info.completion);
	up(&flow_flush_sem);
	mutex_unlock(&flow_flush_sem);
	unlock_cpu_hotplug();
	unlock_cpu_hotplug();
}
}


Loading