Commit e8095bf2 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] devfs: sound

parent 36a674f3
......@@ -68,10 +68,6 @@ static struct list_head snd_minors_hash[SNDRV_CARDS];
static DECLARE_MUTEX(sound_mutex);
#ifdef CONFIG_DEVFS_FS
static devfs_handle_t devfs_handle = NULL;
#endif
#ifdef CONFIG_KMOD
/**
......@@ -343,15 +339,7 @@ static int __init alsa_sound_init(void)
if ((err = snd_oss_init_module()) < 0)
return err;
#endif
#ifdef CONFIG_DEVFS_FS
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
devfs_handle = devfs_mk_dir(NULL, "snd", 3, NULL);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,5,67)
devfs_handle = devfs_mk_dir(NULL, "snd", NULL);
#else
devfs_handle = devfs_mk_dir("snd");
#endif
#endif
devfs_mk_dir("snd");
if (register_chrdev(major, "alsa", &snd_fops)) {
snd_printk(KERN_ERR "unable to register native major device number %d\n", major);
return -EIO;
......@@ -404,9 +392,7 @@ static void __exit alsa_sound_exit(void)
#endif
if (unregister_chrdev(major, "alsa") != 0)
snd_printk(KERN_ERR "unable to unregister major device number %d\n", major);
#ifdef CONFIG_DEVFS_FS
devfs_unregister(devfs_handle);
#endif
devfs_remove("snd");
}
module_init(alsa_sound_init)
......
......@@ -54,7 +54,7 @@ struct sound_unit
int unit_minor;
struct file_operations *unit_fops;
struct sound_unit *next;
devfs_handle_t de;
char name[32];
};
#ifdef CONFIG_SOUND_MSNDCLAS
......@@ -151,31 +151,30 @@ static spinlock_t sound_loader_lock = SPIN_LOCK_UNLOCKED;
static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode)
{
struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL);
int r;
struct sound_unit *s=(struct sound_unit *)kmalloc(sizeof(struct sound_unit), GFP_KERNEL);
char name_buf[32];
if(s==NULL)
if (!s)
return -ENOMEM;
spin_lock(&sound_loader_lock);
r=__sound_insert_unit(s,list,fops,index,low,top);
r = __sound_insert_unit(s, list, fops, index, low, top);
spin_unlock(&sound_loader_lock);
if(r<0)
{
kfree(s);
return r;
}
if (r < SOUND_STEP)
sprintf (name_buf, "sound/%s", name);
if (r < 0)
goto fail;
else if (r < SOUND_STEP)
sprintf(s->name, "sound/%s", name);
else
sprintf (name_buf, "sound/%s%d", name, r / SOUND_STEP);
s->de = devfs_register (NULL, name_buf,
DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor,
sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);
devfs_register(NULL, s->name, 0, SOUND_MAJOR, s->unit_minor,
S_IFCHR | mode, fops, NULL);
return r;
fail:
kfree(s);
return r;
}
/*
......@@ -192,7 +191,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit)
p = __sound_remove_unit(list, unit);
spin_unlock(&sound_loader_lock);
if (p) {
devfs_unregister (p->de);
devfs_remove(p->name);
kfree(p);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment