Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47034
b: refs/heads/master
c: 12b131c
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and Jaroslav Kysela committed Feb 9, 2007
1 parent 39e7655 commit c2e7805
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: feaa6a74d852be40c0e717471aa92eead012052c
refs/heads/master: 12b131c4cf3eb1dc8a60082a434b7b100774c2e7
37 changes: 34 additions & 3 deletions trunk/include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 8 additions & 7 deletions trunk/sound/core/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,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 = snd_card_get_device_link(card);

snd_assert(name, return -EINVAL);
preg = kmalloc(sizeof *preg, GFP_KERNEL);
Expand Down Expand Up @@ -272,7 +273,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
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
Expand Down

0 comments on commit c2e7805

Please sign in to comment.