diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 21 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 15 | ||||
-rw-r--r-- | drivers/net/ppp_async.c | 8 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_net.c | 1 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_wireless.c | 1 |
5 files changed, 25 insertions, 21 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 5b4af3cc2a44..13307771b76a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -38,6 +38,7 @@ #include <linux/types.h> #include <linux/fcntl.h> #include <linux/interrupt.h> +#include <linux/mutex.h> #include <linux/ptrace.h> #include <linux/ioport.h> #include <linux/in.h> @@ -150,7 +151,7 @@ LIST_HEAD(bond_dev_list); static struct proc_dir_entry *bond_proc_dir = NULL; #endif -extern struct rw_semaphore bonding_rwsem; +extern struct mutex bonding_mutex; static __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; static int arp_ip_count = 0; static int bond_mode = BOND_MODE_ROUNDROBIN; @@ -3502,10 +3503,10 @@ static int bond_event_changename(struct bonding *bond) bond_remove_proc_entry(bond); bond_create_proc_entry(bond); #endif - down_write(&(bonding_rwsem)); + mutex_lock(&bonding_mutex); bond_destroy_sysfs_entry(bond); bond_create_sysfs_entry(bond); - up_write(&(bonding_rwsem)); + mutex_unlock(&bonding_mutex); return NOTIFY_DONE; } @@ -4011,7 +4012,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return -EPERM; } - down_write(&(bonding_rwsem)); + mutex_lock(&bonding_mutex); slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave); dprintk("slave_dev=%p: \n", slave_dev); @@ -4044,7 +4045,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd dev_put(slave_dev); } - up_write(&(bonding_rwsem)); + mutex_unlock(&bonding_mutex); return res; } @@ -5023,7 +5024,7 @@ int bond_create(char *name, struct bond_params *params) int res; rtnl_lock(); - down_write(&bonding_rwsem); + mutex_lock(&bonding_mutex); /* Check to see if the bond already exists. */ if (name) { @@ -5072,12 +5073,12 @@ int bond_create(char *name, struct bond_params *params) netif_carrier_off(bond_dev); - up_write(&bonding_rwsem); + mutex_unlock(&bonding_mutex); rtnl_unlock(); /* allows sysfs registration of net device */ res = bond_create_sysfs_entry(bond_dev->priv); if (res < 0) { rtnl_lock(); - down_write(&bonding_rwsem); + mutex_lock(&bonding_mutex); bond_deinit(bond_dev); unregister_netdevice(bond_dev); goto out_rtnl; @@ -5090,7 +5091,7 @@ out_bond: out_netdev: free_netdev(bond_dev); out_rtnl: - up_write(&bonding_rwsem); + mutex_unlock(&bonding_mutex); rtnl_unlock(); return res; } @@ -5112,7 +5113,7 @@ static int __init bonding_init(void) bond_create_proc_dir(); #endif - init_rwsem(&bonding_rwsem); + mutex_init(&bonding_mutex); for (i = 0; i < max_bonds; i++) { res = bond_create(NULL, &bonding_defaults); diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index dd265c69b0df..d6d10fbbe7c7 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -30,6 +30,7 @@ #include <linux/netdevice.h> #include <linux/inetdevice.h> #include <linux/in.h> +#include <linux/mutex.h> #include <linux/sysfs.h> #include <linux/ctype.h> #include <linux/inet.h> @@ -64,7 +65,7 @@ static struct class *netdev_class; * that we don't collide with an ongoing ioctl. */ -struct rw_semaphore bonding_rwsem; +struct mutex bonding_mutex; @@ -80,7 +81,7 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buf) int res = 0; struct bonding *bond; - down_read(&(bonding_rwsem)); + mutex_lock(&bonding_mutex); list_for_each_entry(bond, &bond_dev_list, bond_list) { if (res > (PAGE_SIZE - IFNAMSIZ)) { @@ -94,7 +95,7 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buf) } if (res) buf[res-1] = '\n'; /* eat the leftover space */ - up_read(&(bonding_rwsem)); + mutex_unlock(&bonding_mutex); return res; } @@ -132,7 +133,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t if (command[0] == '-') { rtnl_lock(); - down_write(&bonding_rwsem); + mutex_lock(&bonding_mutex); list_for_each_entry(bond, &bond_dev_list, bond_list) if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { @@ -167,7 +168,7 @@ err_no_cmd: return -EPERM; out_unlock: - up_write(&bonding_rwsem); + mutex_unlock(&bonding_mutex); rtnl_unlock(); /* Always return either count or an error. If you return 0, you'll @@ -262,7 +263,7 @@ static ssize_t bonding_store_slaves(struct device *d, /* Note: We can't hold bond->lock here, as bond_create grabs it. */ rtnl_lock(); - down_write(&(bonding_rwsem)); + mutex_lock(&bonding_mutex); sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ ifname = command + 1; @@ -379,7 +380,7 @@ err_no_cmd: ret = -EPERM; out: - up_write(&(bonding_rwsem)); + mutex_unlock(&bonding_mutex); rtnl_unlock(); return ret; } diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index f1a52def1241..26523cc2512d 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c @@ -67,7 +67,7 @@ struct asyncppp { struct tasklet_struct tsk; atomic_t refcnt; - struct semaphore dead_sem; + struct completion death; struct ppp_channel chan; /* interface to generic ppp layer */ unsigned char obuf[OBUFSIZE]; }; @@ -145,7 +145,7 @@ static struct asyncppp *ap_get(struct tty_struct *tty) static void ap_put(struct asyncppp *ap) { if (atomic_dec_and_test(&ap->refcnt)) - up(&ap->dead_sem); + complete(&ap->death); } /* @@ -182,7 +182,7 @@ ppp_asynctty_open(struct tty_struct *tty) tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); atomic_set(&ap->refcnt, 1); - init_MUTEX_LOCKED(&ap->dead_sem); + init_completion(&ap->death); ap->chan.private = ap; ap->chan.ops = &async_ops; @@ -229,7 +229,7 @@ ppp_asynctty_close(struct tty_struct *tty) * by the time it returns. */ if (!atomic_dec_and_test(&ap->refcnt)) - down(&ap->dead_sem); + wait_for_completion(&ap->death); tasklet_kill(&ap->tsk); ppp_unregister_channel(&ap->chan); diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index 2eb54fd7bed5..e7963cc34f8c 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c @@ -30,6 +30,7 @@ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/etherdevice.h> #include <linux/ethtool.h> diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index aa963ac1e37b..44e35df24db9 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c @@ -32,6 +32,7 @@ #include <linux/wireless.h> #include <linux/ctype.h> #include <linux/string.h> +#include <linux/mutex.h> #include <net/iw_handler.h> #include <net/ieee80211.h> |