diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-05-23 14:37:12 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-05-23 14:37:12 +1000 |
commit | 0a56aaa3b05489f57430a34d29c54678b0ebd210 (patch) | |
tree | 2e4f66374d1756897ed21138d085fa5891c434ba | |
parent | 4fd6cdb8c43f367f24fa31770d9b9434860b8d6b (diff) | |
parent | 3478a17595c48b812021a7c4943e84ca85f57521 (diff) |
Merge branch 'tmp'
Conflicts:
drivers/atm/ambassador.c
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_sysfs.c
-rw-r--r-- | arch/arm/mach-lh7a40x/clocks.c | 15 | ||||
-rw-r--r-- | drivers/atm/ambassador.c | 1 | ||||
-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 | 11 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_net.h | 2 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_wireless.c | 41 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_wireless.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_hpc.c | 30 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 7 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2443-ac97.c | 11 |
13 files changed, 87 insertions, 81 deletions
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c index 7530a95c15a6..4119f7ec3cfe 100644 --- a/arch/arm/mach-lh7a40x/clocks.c +++ b/arch/arm/mach-lh7a40x/clocks.c @@ -12,6 +12,7 @@ #include <asm/hardware.h> #include <asm/arch/clocks.h> #include <linux/err.h> +#include <linux/spinlock.h> struct module; struct icst525_params; @@ -80,14 +81,14 @@ unsigned int pclkfreq_get (void) /* ----- */ static LIST_HEAD(clocks); -static DECLARE_MUTEX(clocks_sem); +static DEFINE_SPINLOCK(clocks_lock); struct clk *clk_get (struct device *dev, const char *id) { struct clk *p; struct clk *clk = ERR_PTR(-ENOENT); - down (&clocks_sem); + spin_lock(&clocks_lock); list_for_each_entry (p, &clocks, node) { if (strcmp (id, p->name) == 0 && try_module_get(p->owner)) { @@ -95,7 +96,7 @@ struct clk *clk_get (struct device *dev, const char *id) break; } } - up (&clocks_sem); + spin_unlock(&clocks_lock); return clk; } @@ -175,18 +176,18 @@ static struct clk clcd_clk = { int clk_register (struct clk *clk) { - down (&clocks_sem); + spin_lock(&clocks_lock); list_add (&clk->node, &clocks); - up (&clocks_sem); + spin_unlock(&clocks_lock); return 0; } EXPORT_SYMBOL(clk_register); void clk_unregister (struct clk *clk) { - down (&clocks_sem); + spin_lock(&clocks_lock); list_del (&clk->node); - up (&clocks_sem); + spin_unlock(&clocks_lock); } EXPORT_SYMBOL(clk_unregister); diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 6adb72a2f876..de31e6a86d0b 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c @@ -26,6 +26,7 @@ #include <linux/types.h> #include <linux/pci.h> #include <linux/kernel.h> +#include <linux/mutex.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/atmdev.h> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 50a40e433154..71d48cf259b8 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> @@ -147,7 +148,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; @@ -3374,10 +3375,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; } @@ -3887,7 +3888,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); @@ -3920,7 +3921,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; } @@ -4878,7 +4879,7 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond int res; rtnl_lock(); - down_write(&bonding_rwsem); + mutex_lock(&bonding_mutex); /* Check to see if the bond already exists. */ if (name) { @@ -4930,12 +4931,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond 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; @@ -4948,7 +4949,7 @@ out_bond: out_netdev: free_netdev(bond_dev); out_rtnl: - up_write(&bonding_rwsem); + mutex_unlock(&bonding_mutex); rtnl_unlock(); return res; } @@ -4970,7 +4971,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, NULL); diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 08f3d396bcd6..04ac84c02598 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> @@ -63,7 +64,7 @@ static struct class *netdev_class; * that we don't collide with an ongoing ioctl. */ -struct rw_semaphore bonding_rwsem; +struct mutex bonding_mutex; @@ -79,7 +80,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)) { @@ -93,7 +94,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_safe(bond, nxt, &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 e365efb3c627..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> @@ -110,7 +111,7 @@ static void gelic_card_get_ether_port_status(struct gelic_card *card, void gelic_card_up(struct gelic_card *card) { pr_debug("%s: called\n", __func__); - down(&card->updown_lock); + mutex_lock(&card->updown_lock); if (atomic_inc_return(&card->users) == 1) { pr_debug("%s: real do\n", __func__); /* enable irq */ @@ -120,7 +121,7 @@ void gelic_card_up(struct gelic_card *card) napi_enable(&card->napi); } - up(&card->updown_lock); + mutex_unlock(&card->updown_lock); pr_debug("%s: done\n", __func__); } @@ -128,7 +129,7 @@ void gelic_card_down(struct gelic_card *card) { u64 mask; pr_debug("%s: called\n", __func__); - down(&card->updown_lock); + mutex_lock(&card->updown_lock); if (atomic_dec_if_positive(&card->users) == 0) { pr_debug("%s: real do\n", __func__); napi_disable(&card->napi); @@ -146,7 +147,7 @@ void gelic_card_down(struct gelic_card *card) /* stop tx */ gelic_card_disable_txdmac(card); } - up(&card->updown_lock); + mutex_unlock(&card->updown_lock); pr_debug("%s: done\n", __func__); } @@ -1534,7 +1535,7 @@ static struct gelic_card *gelic_alloc_card_net(struct net_device **netdev) INIT_WORK(&card->tx_timeout_task, gelic_net_tx_timeout_task); init_waitqueue_head(&card->waitq); atomic_set(&card->tx_timeout_task_counter, 0); - init_MUTEX(&card->updown_lock); + mutex_init(&card->updown_lock); atomic_set(&card->users, 0); return card; diff --git a/drivers/net/ps3_gelic_net.h b/drivers/net/ps3_gelic_net.h index 520f143c2c09..8b413868bbe2 100644 --- a/drivers/net/ps3_gelic_net.h +++ b/drivers/net/ps3_gelic_net.h @@ -298,7 +298,7 @@ struct gelic_card { wait_queue_head_t waitq; /* only first user should up the card */ - struct semaphore updown_lock; + struct mutex updown_lock; atomic_t users; u64 ether_port_status; diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index 1dae1f2ed813..06e19bce49c4 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> @@ -240,12 +241,12 @@ static u32 gelic_wl_get_link(struct net_device *netdev) u32 ret; pr_debug("%s: <-\n", __func__); - down(&wl->assoc_stat_lock); + mutex_lock(&wl->assoc_stat_lock); if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) ret = 1; else ret = 0; - up(&wl->assoc_stat_lock); + mutex_unlock(&wl->assoc_stat_lock); pr_debug("%s: ->\n", __func__); return ret; } @@ -695,7 +696,7 @@ static int gelic_wl_get_scan(struct net_device *netdev, unsigned long this_time = jiffies; pr_debug("%s: <-\n", __func__); - if (down_interruptible(&wl->scan_lock)) + if (mutex_lock_interruptible(&wl->scan_lock)) return -EAGAIN; switch (wl->scan_stat) { @@ -733,7 +734,7 @@ static int gelic_wl_get_scan(struct net_device *netdev, wrqu->data.length = ev - extra; wrqu->data.flags = 0; out: - up(&wl->scan_lock); + mutex_unlock(&wl->scan_lock); pr_debug("%s: -> %d %d\n", __func__, ret, wrqu->data.length); return ret; } @@ -979,7 +980,7 @@ static int gelic_wl_get_essid(struct net_device *netdev, unsigned long irqflag; pr_debug("%s: <- \n", __func__); - down(&wl->assoc_stat_lock); + mutex_lock(&wl->assoc_stat_lock); spin_lock_irqsave(&wl->lock, irqflag); if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) || wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { @@ -989,7 +990,7 @@ static int gelic_wl_get_essid(struct net_device *netdev, } else data->essid.flags = 0; - up(&wl->assoc_stat_lock); + mutex_unlock(&wl->assoc_stat_lock); spin_unlock_irqrestore(&wl->lock, irqflag); pr_debug("%s: -> len=%d \n", __func__, data->essid.length); @@ -1170,7 +1171,7 @@ static int gelic_wl_get_ap(struct net_device *netdev, unsigned long irqflag; pr_debug("%s: <-\n", __func__); - down(&wl->assoc_stat_lock); + mutex_lock(&wl->assoc_stat_lock); spin_lock_irqsave(&wl->lock, irqflag); if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { data->ap_addr.sa_family = ARPHRD_ETHER; @@ -1180,7 +1181,7 @@ static int gelic_wl_get_ap(struct net_device *netdev, memset(data->ap_addr.sa_data, 0, ETH_ALEN); spin_unlock_irqrestore(&wl->lock, irqflag); - up(&wl->assoc_stat_lock); + mutex_unlock(&wl->assoc_stat_lock); pr_debug("%s: ->\n", __func__); return 0; } @@ -1554,7 +1555,7 @@ static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan) int ret = 0; pr_debug("%s: <- always=%d\n", __func__, always_scan); - if (down_interruptible(&wl->scan_lock)) + if (mutex_lock_interruptible(&wl->scan_lock)) return -ERESTARTSYS; /* @@ -1588,7 +1589,7 @@ static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan) } kfree(cmd); out: - up(&wl->scan_lock); + mutex_unlock(&wl->scan_lock); pr_debug("%s: ->\n", __func__); return ret; } @@ -1610,7 +1611,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) DECLARE_MAC_BUF(mac); pr_debug("%s:start\n", __func__); - down(&wl->scan_lock); + mutex_lock(&wl->scan_lock); if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) { /* @@ -1727,7 +1728,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) NULL); out: complete(&wl->scan_done); - up(&wl->scan_lock); + mutex_unlock(&wl->scan_lock); pr_debug("%s:end\n", __func__); } @@ -2151,7 +2152,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl, * As it waits with timeout, just leave assoc_done * uncompleted, then it terminates with timeout */ - if (down_trylock(&wl->assoc_stat_lock)) { + if (!mutex_trylock(&wl->assoc_stat_lock)) { pr_debug("%s: already locked\n", __func__); lock = 0; } else { @@ -2170,7 +2171,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl, netif_carrier_off(port_to_netdev(wl_port(wl))); if (lock) - up(&wl->assoc_stat_lock); + mutex_unlock(&wl->assoc_stat_lock); } /* * event worker @@ -2258,7 +2259,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work) wl = container_of(work, struct gelic_wl_info, assoc_work.work); - down(&wl->assoc_stat_lock); + mutex_lock(&wl->assoc_stat_lock); if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN) goto out; @@ -2282,7 +2283,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work) wait_for_completion(&wl->scan_done); pr_debug("%s: scan done\n", __func__); - down(&wl->scan_lock); + mutex_lock(&wl->scan_lock); if (wl->scan_stat != GELIC_WL_SCAN_STAT_GOT_LIST) { gelic_wl_send_iwap_event(wl, NULL); pr_info("%s: no scan list. association failed\n", __func__); @@ -2302,9 +2303,9 @@ static void gelic_wl_assoc_worker(struct work_struct *work) if (ret) pr_info("%s: association failed %d\n", __func__, ret); scan_lock_out: - up(&wl->scan_lock); + mutex_unlock(&wl->scan_lock); out: - up(&wl->assoc_stat_lock); + mutex_unlock(&wl->assoc_stat_lock); } /* * Interrupt handler @@ -2431,8 +2432,8 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card) INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker); INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker); - init_MUTEX(&wl->scan_lock); - init_MUTEX(&wl->assoc_stat_lock); + mutex_init(&wl->scan_lock); + mutex_init(&wl->assoc_stat_lock); init_completion(&wl->scan_done); /* for the case that no scan request is issued and stop() is called */ diff --git a/drivers/net/ps3_gelic_wireless.h b/drivers/net/ps3_gelic_wireless.h index 103697166720..bc730632da5b 100644 --- a/drivers/net/ps3_gelic_wireless.h +++ b/drivers/net/ps3_gelic_wireless.h @@ -241,7 +241,7 @@ enum gelic_wl_assoc_state { #define GELIC_WEP_KEYS 4 struct gelic_wl_info { /* bss list */ - struct semaphore scan_lock; + struct mutex scan_lock; struct list_head network_list; struct list_head network_free_list; struct gelic_wl_scan_info *networks; @@ -266,7 +266,7 @@ struct gelic_wl_info { enum gelic_wl_wpa_level wpa_level; /* wpa/wpa2 */ /* association handling */ - struct semaphore assoc_stat_lock; + struct mutex assoc_stat_lock; struct delayed_work assoc_work; enum gelic_wl_assoc_state assoc_stat; struct completion assoc_done; diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 83f337c891a9..f061a06d8c63 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -102,9 +102,9 @@ static int to_debug = 0; // global variables //---------------------------------------------------------------------------- static struct mutex sem_hpcaccess; // lock access to HPC -static struct semaphore semOperations; // lock all operations and +static struct mutex mtx_operations; // lock all operations and // access to data structures -static struct semaphore sem_exit; // make sure polling thread goes away +static struct completion exit_cmplt; // make sure polling thread goes away static struct task_struct *ibmphp_poll_thread; //---------------------------------------------------------------------------- // local function prototypes @@ -132,8 +132,8 @@ void __init ibmphp_hpc_initvars (void) debug ("%s - Entry\n", __func__); mutex_init(&sem_hpcaccess); - init_MUTEX (&semOperations); - init_MUTEX_LOCKED (&sem_exit); + mutex_init(&mtx_operations); + init_completion(&exit_cmplt); to_debug = 0; debug ("%s - Exit\n", __func__); @@ -794,7 +794,7 @@ void free_hpc_access (void) *---------------------------------------------------------------------*/ void ibmphp_lock_operations (void) { - down (&semOperations); + mutex_lock(&mtx_operations); to_debug = 1; } @@ -804,7 +804,7 @@ void ibmphp_lock_operations (void) void ibmphp_unlock_operations (void) { debug ("%s - Entry\n", __func__); - up (&semOperations); + mutex_unlock(&mtx_operations); to_debug = 0; debug ("%s - Exit\n", __func__); } @@ -831,7 +831,7 @@ static int poll_hpc(void *data) while (!kthread_should_stop()) { /* try to get the lock to do some kind of hardware access */ - down (&semOperations); + mutex_lock(&mtx_operations); switch (poll_state) { case POLL_LATCH_REGISTER: @@ -886,13 +886,13 @@ static int poll_hpc(void *data) break; case POLL_SLEEP: /* don't sleep with a lock on the hardware */ - up (&semOperations); + mutex_unlock(&mtx_operations); msleep(POLL_INTERVAL_SEC * 1000); if (kthread_should_stop()) break; - down (&semOperations); + mutex_lock(&mtx_operations); if (poll_count >= POLL_LATCH_CNT) { poll_count = 0; @@ -902,11 +902,11 @@ static int poll_hpc(void *data) break; } /* give up the hardware semaphore */ - up (&semOperations); + mutex_unlock(&mtx_operations); /* sleep for a short time just for good measure */ msleep(100); } - up (&sem_exit); + complete(&exit_cmplt); debug ("%s - Exit\n", __func__); return 0; } @@ -1075,9 +1075,9 @@ void __exit ibmphp_hpc_stop_poll_thread (void) debug ("after locking operations \n"); // wait for poll thread to exit - debug ("before sem_exit down \n"); - down (&sem_exit); - debug ("after sem_exit down \n"); + debug ("before sem_cmplt\n"); + wait_for_completion(&exit_cmplt); + debug ("after sem_cmplt\n"); // cleanup debug ("before free_hpc_access \n"); @@ -1085,8 +1085,6 @@ void __exit ibmphp_hpc_stop_poll_thread (void) debug ("after free_hpc_access \n"); ibmphp_unlock_operations (); debug ("after unlock operations \n"); - up (&sem_exit); - debug ("after sem exit up\n"); debug ("%s - Exit\n", __func__); } diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ea13baa3851b..5ebc33d300d2 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -25,6 +25,7 @@ #ifndef __HCI_CORE_H #define __HCI_CORE_H +#include <linux/mutex.h> #include <net/bluetooth/hci.h> /* HCI upper protocols */ @@ -115,7 +116,7 @@ struct hci_dev { struct sk_buff *sent_cmd; struct sk_buff *reassembly[3]; - struct semaphore req_lock; + struct mutex req_lock; wait_queue_head_t req_wait_q; __u32 req_status; __u32 req_result; @@ -657,8 +658,8 @@ struct hci_sec_filter { #define HCI_REQ_PEND 1 #define HCI_REQ_CANCELED 2 -#define hci_req_lock(d) down(&d->req_lock) -#define hci_req_unlock(d) up(&d->req_lock) +#define hci_req_lock(d) mutex_lock(&d->req_lock) +#define hci_req_unlock(d) mutex_unlock(&d->req_lock) void hci_req_complete(struct hci_dev *hdev, int result); diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index aec6929f5c16..7c07cef47e1f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -875,7 +875,7 @@ int hci_register_dev(struct hci_dev *hdev) hdev->reassembly[i] = NULL; init_waitqueue_head(&hdev->req_wait_q); - init_MUTEX(&hdev->req_lock); + mutex_init(&hdev->req_lock); inquiry_cache_init(hdev); diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c index 0eed140dcd9b..02ead1281f51 100644 --- a/sound/soc/s3c24xx/s3c2443-ac97.c +++ b/sound/soc/s3c24xx/s3c2443-ac97.c @@ -20,6 +20,7 @@ #include <linux/wait.h> #include <linux/delay.h> #include <linux/clk.h> +#include <linux/mutex.h> #include <sound/core.h> #include <sound/pcm.h> @@ -46,7 +47,7 @@ static struct s3c24xx_ac97_info s3c24xx_ac97; static DECLARE_COMPLETION(ac97_completion); static u32 codec_ready; -static DECLARE_MUTEX(ac97_mutex); +static DEFINE_MUTEX(ac97_mutex); static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97, unsigned short reg) @@ -55,7 +56,7 @@ static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97, u32 ac_codec_cmd; u32 stat, addr, data; - down(&ac97_mutex); + mutex_lock(&ac97_mutex); codec_ready = S3C_AC97_GLBSTAT_CODECREADY; ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); @@ -78,7 +79,7 @@ static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97, printk(KERN_ERR "s3c24xx-ac97: req addr = %02x," " rep addr = %02x\n", reg, addr); - up(&ac97_mutex); + mutex_unlock(&ac97_mutex); return (unsigned short)data; } @@ -89,7 +90,7 @@ static void s3c2443_ac97_write(struct snd_ac97 *ac97, unsigned short reg, u32 ac_glbctrl; u32 ac_codec_cmd; - down(&ac97_mutex); + mutex_lock(&ac97_mutex); codec_ready = S3C_AC97_GLBSTAT_CODECREADY; ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); @@ -108,7 +109,7 @@ static void s3c2443_ac97_write(struct snd_ac97 *ac97, unsigned short reg, ac_codec_cmd |= S3C_AC97_CODEC_CMD_READ; writel(ac_codec_cmd, s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); - up(&ac97_mutex); + mutex_unlock(&ac97_mutex); } |