X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=sound%2Fcore%2Fsound.c;h=4084de06412707e28011788d56c02aa60514fe10;hb=bd0561c9d8dcbf21cd9aa46c416bbf6a3a12e4b1;hp=efa476c5210ac52832d8e7154984d42717d8588b;hpb=a319a2773a13bab56a0d0b3744ba8703324313b5;p=pandora-kernel.git diff --git a/sound/core/sound.c b/sound/core/sound.c index efa476c5210a..4084de064127 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -61,9 +61,6 @@ EXPORT_SYMBOL(snd_ecards_limit); static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; static DEFINE_MUTEX(sound_mutex); -extern struct class *sound_class; - - #ifdef CONFIG_KMOD /** @@ -222,26 +219,27 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) #endif /** - * snd_register_device - Register the ALSA device file for the card + * snd_register_device_for_dev - Register the ALSA device file for the card * @type: the device type, SNDRV_DEVICE_TYPE_XXX * @card: the card instance * @dev: the device index * @f_ops: the file operations * @private_data: user pointer for f_ops->open() * @name: the device file name + * @device: the &struct device to link this new device to * * Registers an ALSA device file for the given card. * The operators have to be set in reg parameter. * - * Retrurns zero if successful, or a negative error code on failure. + * Returns zero if successful, or a negative error code on failure. */ -int snd_register_device(int type, struct snd_card *card, int dev, - const struct file_operations *f_ops, void *private_data, - const char *name) +int snd_register_device_for_dev(int type, struct snd_card *card, int dev, + const struct file_operations *f_ops, + void *private_data, + const char *name, struct device *device) { int minor; struct snd_minor *preg; - struct device *device = NULL; snd_assert(name, return -EINVAL); preg = kmalloc(sizeof *preg, GFP_KERNEL); @@ -266,19 +264,16 @@ int snd_register_device(int type, struct snd_card *card, int dev, return minor; } snd_minors[minor] = preg; - if (card) - device = card->dev; - preg->class_dev = class_device_create(sound_class, NULL, - MKDEV(major, minor), - device, "%s", name); - if (preg->class_dev) - class_set_devdata(preg->class_dev, private_data); + preg->dev = device_create(sound_class, device, MKDEV(major, minor), + "%s", name); + if (preg->dev) + dev_set_drvdata(preg->dev, private_data); mutex_unlock(&sound_mutex); return 0; } -EXPORT_SYMBOL(snd_register_device); +EXPORT_SYMBOL(snd_register_device_for_dev); /* find the matching minor record * return the index of snd_minor, or -1 if not found @@ -320,7 +315,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) return -EINVAL; } - class_device_destroy(sound_class, MKDEV(major, minor)); + device_destroy(sound_class, MKDEV(major, minor)); kfree(snd_minors[minor]); snd_minors[minor] = NULL; @@ -331,15 +326,15 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) EXPORT_SYMBOL(snd_unregister_device); int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, - const struct class_device_attribute *attr) + struct device_attribute *attr) { int minor, ret = -EINVAL; - struct class_device *cdev; + struct device *d; mutex_lock(&sound_mutex); minor = find_snd_minor(type, card, dev); - if (minor >= 0 && (cdev = snd_minors[minor]->class_dev) != NULL) - ret = class_device_create_file(cdev, attr); + if (minor >= 0 && (d = snd_minors[minor]->dev) != NULL) + ret = device_create_file(d, attr); mutex_unlock(&sound_mutex); return ret;