Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22703
b: refs/heads/master
c: 1a60d4c
h: refs/heads/master
i:
  22701: 28a1dcc
  22699: 0c5f30a
  22695: 81cd490
  22687: 42bd73c
v: v3
  • Loading branch information
Ingo Molnar authored and Jaroslav Kysela committed Mar 22, 2006
1 parent a3e4c54 commit 7e627c5
Show file tree
Hide file tree
Showing 31 changed files with 294 additions and 283 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f0283f45a04d5cf31512e5e390a38504d97e7a97
refs/heads/master: 1a60d4c5a0c4028559585a74e48593b16e1ca9b2
8 changes: 4 additions & 4 deletions trunk/include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#include <linux/sched.h> /* wake_up() */
#include <asm/semaphore.h> /* struct semaphore */
#include <linux/mutex.h> /* struct mutex */
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/workqueue.h> /* struct workqueue_struct */
#include <linux/pm.h> /* pm_message_t */
Expand Down Expand Up @@ -137,7 +137,7 @@ struct snd_card {

#ifdef CONFIG_PM
unsigned int power_state; /* power state */
struct semaphore power_lock; /* power lock */
struct mutex power_lock; /* power lock */
wait_queue_head_t power_sleep;
#endif

Expand All @@ -150,12 +150,12 @@ struct snd_card {
#ifdef CONFIG_PM
static inline void snd_power_lock(struct snd_card *card)
{
down(&card->power_lock);
mutex_lock(&card->power_lock);
}

static inline void snd_power_unlock(struct snd_card *card)
{
up(&card->power_lock);
mutex_unlock(&card->power_lock);
}

static inline unsigned int snd_power_get_state(struct snd_card *card)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/hwdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct snd_hwdep {
void *private_data;
void (*private_free) (struct snd_hwdep *hwdep);

struct semaphore open_mutex;
struct mutex open_mutex;
int used;
unsigned int dsp_loaded;
unsigned int exclusive: 1;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct snd_info_entry {
void *private_data;
void (*private_free)(struct snd_info_entry *entry);
struct proc_dir_entry *p;
struct semaphore access;
struct mutex access;
};

#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/mixer_oss.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct snd_mixer_oss {
unsigned int active_index);
void *private_data_recsrc;
void (*private_free_recsrc)(struct snd_mixer_oss *mixer);
struct semaphore reg_mutex;
struct mutex reg_mutex;
struct snd_info_entry *proc_entry;
int oss_dev_alloc;
/* --- */
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ struct snd_pcm {
char id[64];
char name[80];
struct snd_pcm_str streams[2];
struct semaphore open_mutex;
struct mutex open_mutex;
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (struct snd_pcm *pcm);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/pcm_oss.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct snd_pcm_oss_substream {

struct snd_pcm_oss_stream {
struct snd_pcm_oss_setup *setup_list; /* setup list */
struct semaphore setup_mutex;
struct mutex setup_mutex;
struct snd_info_entry *proc_entry;
};

Expand Down
4 changes: 2 additions & 2 deletions trunk/include/sound/rawmidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
#include "seq_device.h"
Expand Down Expand Up @@ -130,7 +130,7 @@ struct snd_rawmidi {
void *private_data;
void (*private_free) (struct snd_rawmidi *rmidi);

struct semaphore open_mutex;
struct mutex open_mutex;
wait_queue_head_t open_wait;

struct snd_info_entry *dev;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/sound/seq_instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct snd_seq_kinstr_list {

spinlock_t lock;
spinlock_t ops_lock;
struct semaphore ops_mutex;
struct mutex ops_mutex;
unsigned long ops_flags;
};

Expand Down
43 changes: 22 additions & 21 deletions trunk/sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/minors.h>
Expand All @@ -36,7 +37,7 @@ MODULE_DESCRIPTION("Hardware dependent layer");
MODULE_LICENSE("GPL");

static LIST_HEAD(snd_hwdep_devices);
static DECLARE_MUTEX(register_mutex);
static DEFINE_MUTEX(register_mutex);

static int snd_hwdep_free(struct snd_hwdep *hwdep);
static int snd_hwdep_dev_free(struct snd_device *device);
Expand Down Expand Up @@ -111,7 +112,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)

init_waitqueue_entry(&wait, current);
add_wait_queue(&hw->open_wait, &wait);
down(&hw->open_mutex);
mutex_lock(&hw->open_mutex);
while (1) {
if (hw->exclusive && hw->used > 0) {
err = -EBUSY;
Expand All @@ -128,9 +129,9 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
up(&hw->open_mutex);
mutex_unlock(&hw->open_mutex);
schedule();
down(&hw->open_mutex);
mutex_lock(&hw->open_mutex);
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
Expand All @@ -147,7 +148,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
hw->ops.release(hw, file);
}
}
up(&hw->open_mutex);
mutex_unlock(&hw->open_mutex);
if (err < 0)
module_put(hw->card->module);
return err;
Expand All @@ -157,15 +158,15 @@ static int snd_hwdep_release(struct inode *inode, struct file * file)
{
int err = -ENXIO;
struct snd_hwdep *hw = file->private_data;
down(&hw->open_mutex);
mutex_lock(&hw->open_mutex);
if (hw->ops.release) {
err = hw->ops.release(hw, file);
wake_up(&hw->open_wait);
}
if (hw->used > 0)
hw->used--;
snd_card_file_remove(hw->card, file);
up(&hw->open_mutex);
mutex_unlock(&hw->open_mutex);
module_put(hw->card->module);
return err;
}
Expand Down Expand Up @@ -272,7 +273,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,

if (get_user(device, (int __user *)arg))
return -EFAULT;
down(&register_mutex);
mutex_lock(&register_mutex);
device = device < 0 ? 0 : device + 1;
while (device < SNDRV_MINOR_HWDEPS) {
if (snd_hwdep_search(card, device))
Expand All @@ -281,7 +282,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,
}
if (device >= SNDRV_MINOR_HWDEPS)
device = -1;
up(&register_mutex);
mutex_unlock(&register_mutex);
if (put_user(device, (int __user *)arg))
return -EFAULT;
return 0;
Expand All @@ -294,13 +295,13 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,

if (get_user(device, &info->device))
return -EFAULT;
down(&register_mutex);
mutex_lock(&register_mutex);
hwdep = snd_hwdep_search(card, device);
if (hwdep)
err = snd_hwdep_info(hwdep, info);
else
err = -ENXIO;
up(&register_mutex);
mutex_unlock(&register_mutex);
return err;
}
}
Expand Down Expand Up @@ -375,7 +376,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
return err;
}
init_waitqueue_head(&hwdep->open_wait);
init_MUTEX(&hwdep->open_mutex);
mutex_init(&hwdep->open_mutex);
*rhwdep = hwdep;
return 0;
}
Expand All @@ -401,9 +402,9 @@ static int snd_hwdep_dev_register(struct snd_device *device)
int err;
char name[32];

down(&register_mutex);
mutex_lock(&register_mutex);
if (snd_hwdep_search(hwdep->card, hwdep->device)) {
up(&register_mutex);
mutex_unlock(&register_mutex);
return -EBUSY;
}
list_add_tail(&hwdep->list, &snd_hwdep_devices);
Expand All @@ -414,7 +415,7 @@ static int snd_hwdep_dev_register(struct snd_device *device)
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
hwdep->card->number, hwdep->device);
list_del(&hwdep->list);
up(&register_mutex);
mutex_unlock(&register_mutex);
return err;
}
#ifdef CONFIG_SND_OSSEMUL
Expand All @@ -434,7 +435,7 @@ static int snd_hwdep_dev_register(struct snd_device *device)
}
}
#endif
up(&register_mutex);
mutex_unlock(&register_mutex);
return 0;
}

Expand All @@ -443,9 +444,9 @@ static int snd_hwdep_dev_unregister(struct snd_device *device)
struct snd_hwdep *hwdep = device->device_data;

snd_assert(hwdep != NULL, return -ENXIO);
down(&register_mutex);
mutex_lock(&register_mutex);
if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
up(&register_mutex);
mutex_unlock(&register_mutex);
return -EINVAL;
}
#ifdef CONFIG_SND_OSSEMUL
Expand All @@ -454,7 +455,7 @@ static int snd_hwdep_dev_unregister(struct snd_device *device)
#endif
snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
list_del(&hwdep->list);
up(&register_mutex);
mutex_unlock(&register_mutex);
return snd_hwdep_free(hwdep);
}

Expand All @@ -469,13 +470,13 @@ static void snd_hwdep_proc_read(struct snd_info_entry *entry,
struct list_head *p;
struct snd_hwdep *hwdep;

down(&register_mutex);
mutex_lock(&register_mutex);
list_for_each(p, &snd_hwdep_devices) {
hwdep = list_entry(p, struct snd_hwdep, list);
snd_iprintf(buffer, "%02i-%02i: %s\n",
hwdep->card->number, hwdep->device, hwdep->name);
}
up(&register_mutex);
mutex_unlock(&register_mutex);
}

static struct snd_info_entry *snd_hwdep_proc_entry;
Expand Down
27 changes: 14 additions & 13 deletions trunk/sound/core/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <sound/version.h>
#include <linux/proc_fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/mutex.h>
#include <stdarg.h>

/*
Expand Down Expand Up @@ -68,7 +69,7 @@ int snd_info_check_reserved_words(const char *str)
return 1;
}

static DECLARE_MUTEX(info_mutex);
static DEFINE_MUTEX(info_mutex);

struct snd_info_private_data {
struct snd_info_buffer *rbuffer;
Expand Down Expand Up @@ -265,11 +266,11 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
struct proc_dir_entry *p;
int mode, err;

down(&info_mutex);
mutex_lock(&info_mutex);
p = PDE(inode);
entry = p == NULL ? NULL : (struct snd_info_entry *)p->data;
if (entry == NULL || entry->disconnected) {
up(&info_mutex);
mutex_unlock(&info_mutex);
return -ENODEV;
}
if (!try_module_get(entry->module)) {
Expand Down Expand Up @@ -361,21 +362,21 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
break;
}
file->private_data = data;
up(&info_mutex);
mutex_unlock(&info_mutex);
if (entry->content == SNDRV_INFO_CONTENT_TEXT &&
(mode == O_RDONLY || mode == O_RDWR)) {
if (entry->c.text.read) {
down(&entry->access);
mutex_lock(&entry->access);
entry->c.text.read(entry, data->rbuffer);
up(&entry->access);
mutex_unlock(&entry->access);
}
}
return 0;

__error:
module_put(entry->module);
__error1:
up(&info_mutex);
mutex_unlock(&info_mutex);
return err;
}

Expand Down Expand Up @@ -747,7 +748,7 @@ static struct snd_info_entry *snd_info_create_entry(const char *name)
}
entry->mode = S_IFREG | S_IRUGO;
entry->content = SNDRV_INFO_CONTENT_TEXT;
init_MUTEX(&entry->access);
mutex_init(&entry->access);
return entry;
}

Expand Down Expand Up @@ -896,10 +897,10 @@ int snd_info_register(struct snd_info_entry * entry)

snd_assert(entry != NULL, return -ENXIO);
root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
down(&info_mutex);
mutex_lock(&info_mutex);
p = snd_create_proc_entry(entry->name, entry->mode, root);
if (!p) {
up(&info_mutex);
mutex_unlock(&info_mutex);
return -ENOMEM;
}
p->owner = entry->module;
Expand All @@ -908,7 +909,7 @@ int snd_info_register(struct snd_info_entry * entry)
p->size = entry->size;
p->data = entry;
entry->p = p;
up(&info_mutex);
mutex_unlock(&info_mutex);
return 0;
}

Expand All @@ -929,9 +930,9 @@ int snd_info_unregister(struct snd_info_entry * entry)
snd_assert(entry->p != NULL, return -ENXIO);
root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
snd_assert(root, return -ENXIO);
down(&info_mutex);
mutex_lock(&info_mutex);
snd_remove_proc_entry(root, entry->p);
up(&info_mutex);
mutex_unlock(&info_mutex);
snd_info_free_entry(entry);
return 0;
}
Expand Down
Loading

0 comments on commit 7e627c5

Please sign in to comment.