aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-10-05 09:05:34 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:00:06 -0500
commit12b131c4cf3eb1dc8a60082a434b7b100774c2e7 (patch)
tree3c7269d2617724710d35ad8543dbe0713c61a58e /sound/core
parentfeaa6a74d852be40c0e717471aa92eead012052c (diff)
[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 'sound/core')
-rw-r--r--sound/core/sound.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 82a61c67cf3a..4084de064127 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -219,26 +219,27 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
219#endif 219#endif
220 220
221/** 221/**
222 * snd_register_device - Register the ALSA device file for the card 222 * snd_register_device_for_dev - Register the ALSA device file for the card
223 * @type: the device type, SNDRV_DEVICE_TYPE_XXX 223 * @type: the device type, SNDRV_DEVICE_TYPE_XXX
224 * @card: the card instance 224 * @card: the card instance
225 * @dev: the device index 225 * @dev: the device index
226 * @f_ops: the file operations 226 * @f_ops: the file operations
227 * @private_data: user pointer for f_ops->open() 227 * @private_data: user pointer for f_ops->open()
228 * @name: the device file name 228 * @name: the device file name
229 * @device: the &struct device to link this new device to
229 * 230 *
230 * Registers an ALSA device file for the given card. 231 * Registers an ALSA device file for the given card.
231 * The operators have to be set in reg parameter. 232 * The operators have to be set in reg parameter.
232 * 233 *
233 * Retrurns zero if successful, or a negative error code on failure. 234 * Returns zero if successful, or a negative error code on failure.
234 */ 235 */
235int snd_register_device(int type, struct snd_card *card, int dev, 236int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
236 const struct file_operations *f_ops, void *private_data, 237 const struct file_operations *f_ops,
237 const char *name) 238 void *private_data,
239 const char *name, struct device *device)
238{ 240{
239 int minor; 241 int minor;
240 struct snd_minor *preg; 242 struct snd_minor *preg;
241 struct device *device = snd_card_get_device_link(card);
242 243
243 snd_assert(name, return -EINVAL); 244 snd_assert(name, return -EINVAL);
244 preg = kmalloc(sizeof *preg, GFP_KERNEL); 245 preg = kmalloc(sizeof *preg, GFP_KERNEL);
@@ -272,7 +273,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
272 return 0; 273 return 0;
273} 274}
274 275
275EXPORT_SYMBOL(snd_register_device); 276EXPORT_SYMBOL(snd_register_device_for_dev);
276 277
277/* find the matching minor record 278/* find the matching minor record
278 * return the index of snd_minor, or -1 if not found 279 * return the index of snd_minor, or -1 if not found