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]; ...@@ -68,10 +68,6 @@ static struct list_head snd_minors_hash[SNDRV_CARDS];
static DECLARE_MUTEX(sound_mutex); static DECLARE_MUTEX(sound_mutex);
#ifdef CONFIG_DEVFS_FS
static devfs_handle_t devfs_handle = NULL;
#endif
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
/** /**
...@@ -343,15 +339,7 @@ static int __init alsa_sound_init(void) ...@@ -343,15 +339,7 @@ static int __init alsa_sound_init(void)
if ((err = snd_oss_init_module()) < 0) if ((err = snd_oss_init_module()) < 0)
return err; return err;
#endif #endif
#ifdef CONFIG_DEVFS_FS devfs_mk_dir("snd");
#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
if (register_chrdev(major, "alsa", &snd_fops)) { if (register_chrdev(major, "alsa", &snd_fops)) {
snd_printk(KERN_ERR "unable to register native major device number %d\n", major); snd_printk(KERN_ERR "unable to register native major device number %d\n", major);
return -EIO; return -EIO;
...@@ -404,9 +392,7 @@ static void __exit alsa_sound_exit(void) ...@@ -404,9 +392,7 @@ static void __exit alsa_sound_exit(void)
#endif #endif
if (unregister_chrdev(major, "alsa") != 0) if (unregister_chrdev(major, "alsa") != 0)
snd_printk(KERN_ERR "unable to unregister major device number %d\n", major); snd_printk(KERN_ERR "unable to unregister major device number %d\n", major);
#ifdef CONFIG_DEVFS_FS devfs_remove("snd");
devfs_unregister(devfs_handle);
#endif
} }
module_init(alsa_sound_init) module_init(alsa_sound_init)
......
...@@ -54,7 +54,7 @@ struct sound_unit ...@@ -54,7 +54,7 @@ struct sound_unit
int unit_minor; int unit_minor;
struct file_operations *unit_fops; struct file_operations *unit_fops;
struct sound_unit *next; struct sound_unit *next;
devfs_handle_t de; char name[32];
}; };
#ifdef CONFIG_SOUND_MSNDCLAS #ifdef CONFIG_SOUND_MSNDCLAS
...@@ -151,30 +151,29 @@ static spinlock_t sound_loader_lock = SPIN_LOCK_UNLOCKED; ...@@ -151,30 +151,29 @@ 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) 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; 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; return -ENOMEM;
spin_lock(&sound_loader_lock); 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); spin_unlock(&sound_loader_lock);
if(r<0) if (r < 0)
{ goto fail;
kfree(s); else if (r < SOUND_STEP)
return r; sprintf(s->name, "sound/%s", name);
}
if (r < SOUND_STEP)
sprintf (name_buf, "sound/%s", name);
else else
sprintf (name_buf, "sound/%s%d", name, r / SOUND_STEP); sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);
s->de = devfs_register (NULL, name_buf,
DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor, devfs_register(NULL, s->name, 0, SOUND_MAJOR, s->unit_minor,
S_IFCHR | mode, fops, NULL); S_IFCHR | mode, fops, NULL);
return r;
fail:
kfree(s);
return r; return r;
} }
...@@ -192,7 +191,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit) ...@@ -192,7 +191,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit)
p = __sound_remove_unit(list, unit); p = __sound_remove_unit(list, unit);
spin_unlock(&sound_loader_lock); spin_unlock(&sound_loader_lock);
if (p) { if (p) {
devfs_unregister (p->de); devfs_remove(p->name);
kfree(p); 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