]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/core/sound.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / sound / core / sound.c
index 4084de06412707e28011788d56c02aa60514fe10..812f91b3de5b88fca9259dece4ac4c4a5787a551 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Advanced Linux Sound Architecture
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,6 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/time.h>
@@ -42,7 +41,7 @@ EXPORT_SYMBOL(snd_major);
 
 static int cards_limit = 1;
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards.");
 MODULE_LICENSE("GPL");
 module_param(major, int, 0444);
@@ -72,8 +71,6 @@ static DEFINE_MUTEX(sound_mutex);
  */
 void snd_request_card(int card)
 {
-       if (! current->fs->root)
-               return;
        if (snd_card_locked(card))
                return;
        if (card < 0 || card >= cards_limit)
@@ -87,8 +84,6 @@ static void snd_request_other(int minor)
 {
        char *str;
 
-       if (! current->fs->root)
-               return;
        switch (minor) {
        case SNDRV_MINOR_SEQUENCER:     str = "snd-seq";        break;
        case SNDRV_MINOR_TIMER:         str = "snd-timer";      break;
@@ -168,7 +163,7 @@ static int snd_open(struct inode *inode, struct file *file)
        return err;
 }
 
-static struct file_operations snd_fops =
+static const struct file_operations snd_fops =
 {
        .owner =        THIS_MODULE,
        .open =         snd_open
@@ -266,6 +261,14 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
        snd_minors[minor] = preg;
        preg->dev = device_create(sound_class, device, MKDEV(major, minor),
                                  "%s", name);
+       if (IS_ERR(preg->dev)) {
+               snd_minors[minor] = NULL;
+               mutex_unlock(&sound_mutex);
+               minor = PTR_ERR(preg->dev);
+               kfree(preg);
+               return minor;
+       }
+
        if (preg->dev)
                dev_set_drvdata(preg->dev, private_data);
 
@@ -446,8 +449,7 @@ static void __exit alsa_sound_exit(void)
 {
        snd_info_minor_unregister();
        snd_info_done();
-       if (unregister_chrdev(major, "alsa") != 0)
-               snd_printk(KERN_ERR "unable to unregister major device number %d\n", major);
+       unregister_chrdev(major, "alsa");
 }
 
 module_init(alsa_sound_init)