diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2006-10-05 15:05:34 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 09:00:06 +0100 |
commit | 12b131c4cf3eb1dc8a60082a434b7b100774c2e7 (patch) | |
tree | 3c7269d2617724710d35ad8543dbe0713c61a58e /include | |
parent | feaa6a74d852be40c0e717471aa92eead012052c (diff) | |
download | op-kernel-dev-12b131c4cf3eb1dc8a60082a434b7b100774c2e7.zip op-kernel-dev-12b131c4cf3eb1dc8a60082a434b7b100774c2e7.tar.gz |
[ALSA] allow registering an alsa device with struct device pointer
This patch adds snd_register_device_for_dev taking a struct device
pointer to link the new device to and makes snd_register_device a simple
static inline wrapper around it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/core.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 521f036..83a575a 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -211,9 +211,40 @@ extern struct class *sound_class; void snd_request_card(int card); -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); + +/** + * snd_register_device - 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 + * + * Registers an ALSA device file for the given card. + * The operators have to be set in reg parameter. + * + * This function uses the card's device pointer to link to the + * correct &struct device. + * + * Returns zero if successful, or a negative error code on failure. + */ +static inline int snd_register_device(int type, struct snd_card *card, int dev, + const struct file_operations *f_ops, + void *private_data, + const char *name) +{ + return snd_register_device_for_dev(type, card, dev, f_ops, + private_data, name, + card ? card->dev : NULL); +} + int snd_unregister_device(int type, struct snd_card *card, int dev); void *snd_lookup_minor_data(unsigned int minor, int type); int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, |