#include <sound/driver.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <sound/core.h>
err = snd_card_file_add(card, file);
if (err < 0)
return err;
- fmixer = (snd_mixer_oss_file_t *)snd_kcalloc(sizeof(*fmixer), GFP_KERNEL);
+ fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL);
if (fmixer == NULL) {
snd_card_file_remove(card, file);
return -ENOMEM;
return -ENXIO;
}
+/* FIXME: need to unlock BKL to allow preemption */
int snd_mixer_oss_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- return snd_mixer_oss_ioctl1((snd_mixer_oss_file_t *) file->private_data, cmd, arg);
+ int err;
+ /* FIXME: need to unlock BKL to allow preemption */
+ unlock_kernel();
+ err = snd_mixer_oss_ioctl1((snd_mixer_oss_file_t *) file->private_data, cmd, arg);
+ lock_kernel();
+ return err;
}
int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long arg)
up_read(&card->controls_rwsem);
return;
}
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
up_read(&card->controls_rwsem);
return;
}
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
down_read(&card->controls_rwsem);
if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
return;
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
up_read(&fmixer->card->controls_rwsem);
return;
}
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
snd_ctl_elem_value_t *uctl;
int err, idx;
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM;
goto __unlock;
int err;
unsigned int idx;
- uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
- uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
+ uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
+ uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM;
goto __unlock;
snd_ctl_elem_info_t uinfo;
memset(&uinfo, 0, sizeof(uinfo));
- if (kctl->info(kctl, &uinfo))
+ if (kctl->info(kctl, &uinfo)) {
+ up_read(&mixer->card->controls_rwsem);
return 0;
+ }
strcpy(str, ptr->name);
if (!strcmp(str, "Master"))
strcpy(str, "Mix");
static void snd_mixer_oss_proc_read(snd_info_entry_t *entry,
snd_info_buffer_t * buffer)
{
- snd_mixer_oss_t *mixer = snd_magic_cast(snd_mixer_oss_t, entry->private_data, return);
+ snd_mixer_oss_t *mixer = entry->private_data;
int i;
down(&mixer->reg_mutex);
static void snd_mixer_oss_proc_write(snd_info_entry_t *entry,
snd_info_buffer_t * buffer)
{
- snd_mixer_oss_t *mixer = snd_magic_cast(snd_mixer_oss_t, entry->private_data, return);
+ snd_mixer_oss_t *mixer = entry->private_data;
char line[128], str[32], idxstr[16], *cptr;
int ch, idx;
struct snd_mixer_oss_assign_table *tbl;
};
unsigned int idx;
- for (idx = 0; idx < sizeof(table) / sizeof(struct snd_mixer_oss_assign_table); idx++)
+ for (idx = 0; idx < ARRAY_SIZE(table); idx++)
snd_mixer_oss_build_input(mixer, &table[idx], 0, 0);
if (mixer->mask_recsrc) {
mixer->get_recsrc = snd_mixer_oss_get_recsrc2;
static int snd_mixer_oss_free1(void *private)
{
- snd_mixer_oss_t *mixer = snd_magic_cast(snd_mixer_oss_t, private, return -ENXIO);
+ snd_mixer_oss_t *mixer = private;
snd_card_t * card;
int idx;
if (chn->private_free)
chn->private_free(chn);
}
- snd_magic_kfree(mixer);
+ kfree(mixer);
return 0;
}
char name[128];
int idx, err;
- mixer = snd_magic_kcalloc(snd_mixer_oss_t, sizeof(snd_mixer_oss_t), GFP_KERNEL);
+ mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
if (mixer == NULL)
return -ENOMEM;
init_MUTEX(&mixer->reg_mutex);
&snd_mixer_oss_reg,
name)) < 0) {
snd_printk("unable to register OSS mixer device %i:%i\n", card->number, 0);
- snd_magic_kfree(mixer);
+ kfree(mixer);
return err;
}
mixer->oss_dev_alloc = 1;