#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>
MODULE_LICENSE("GPL");
static LIST_HEAD(snd_hwdep_devices);
-static DEFINE_MUTEX(register_mutex);
+static DECLARE_MUTEX(register_mutex);
static int snd_hwdep_free(struct snd_hwdep *hwdep);
static int snd_hwdep_dev_free(struct snd_device *device);
init_waitqueue_entry(&wait, current);
add_wait_queue(&hw->open_wait, &wait);
- mutex_lock(&hw->open_mutex);
+ down(&hw->open_mutex);
while (1) {
if (hw->exclusive && hw->used > 0) {
err = -EBUSY;
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
- mutex_unlock(&hw->open_mutex);
+ up(&hw->open_mutex);
schedule();
- mutex_lock(&hw->open_mutex);
+ down(&hw->open_mutex);
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
hw->ops.release(hw, file);
}
}
- mutex_unlock(&hw->open_mutex);
+ up(&hw->open_mutex);
if (err < 0)
module_put(hw->card->module);
return err;
{
int err = -ENXIO;
struct snd_hwdep *hw = file->private_data;
- mutex_lock(&hw->open_mutex);
+ down(&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);
- mutex_unlock(&hw->open_mutex);
+ up(&hw->open_mutex);
module_put(hw->card->module);
return err;
}
if (get_user(device, (int __user *)arg))
return -EFAULT;
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
device = device < 0 ? 0 : device + 1;
while (device < SNDRV_MINOR_HWDEPS) {
if (snd_hwdep_search(card, device))
}
if (device >= SNDRV_MINOR_HWDEPS)
device = -1;
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
if (put_user(device, (int __user *)arg))
return -EFAULT;
return 0;
if (get_user(device, &info->device))
return -EFAULT;
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
hwdep = snd_hwdep_search(card, device);
if (hwdep)
err = snd_hwdep_info(hwdep, info);
else
err = -ENXIO;
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return err;
}
}
return err;
}
init_waitqueue_head(&hwdep->open_wait);
- mutex_init(&hwdep->open_mutex);
+ init_MUTEX(&hwdep->open_mutex);
*rhwdep = hwdep;
return 0;
}
int err;
char name[32];
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
if (snd_hwdep_search(hwdep->card, hwdep->device)) {
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return -EBUSY;
}
list_add_tail(&hwdep->list, &snd_hwdep_devices);
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
hwdep->card->number, hwdep->device);
list_del(&hwdep->list);
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return err;
}
#ifdef CONFIG_SND_OSSEMUL
}
}
#endif
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return 0;
}
struct snd_hwdep *hwdep = device->device_data;
snd_assert(hwdep != NULL, return -ENXIO);
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return -EINVAL;
}
#ifdef CONFIG_SND_OSSEMUL
#endif
snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
list_del(&hwdep->list);
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return snd_hwdep_free(hwdep);
}
struct list_head *p;
struct snd_hwdep *hwdep;
- mutex_lock(®ister_mutex);
+ down(®ister_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);
}
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
}
static struct snd_info_entry *snd_hwdep_proc_entry;