#include <linux/init.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/initval.h>
#include <linux/kmod.h>
#include <linux/mutex.h>
static int major = …;
int snd_major;
EXPORT_SYMBOL(…);
static int cards_limit = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_param(major, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(cards_limit, int, 0444);
MODULE_PARM_DESC(…) …;
MODULE_ALIAS_CHARDEV_MAJOR(…);
int snd_ecards_limit;
EXPORT_SYMBOL(…);
#ifdef CONFIG_SND_DEBUG
struct dentry *sound_debugfs_root;
EXPORT_SYMBOL_GPL(…);
#endif
static struct snd_minor *snd_minors[SNDRV_OS_MINORS];
static DEFINE_MUTEX(sound_mutex);
#ifdef CONFIG_MODULES
void snd_request_card(int card)
{ … }
EXPORT_SYMBOL(…);
static void snd_request_other(int minor)
{ … }
#endif
void *snd_lookup_minor_data(unsigned int minor, int type)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_MODULES
static struct snd_minor *autoload_device(unsigned int minor)
{ … }
#else
#define autoload_device …
#endif
static int snd_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations snd_fops = …;
#ifdef CONFIG_SND_DYNAMIC_MINORS
static int snd_find_free_minor(int type, struct snd_card *card, int dev)
{ … }
#else
static int snd_find_free_minor(int type, struct snd_card *card, int dev)
{
int minor;
switch (type) {
case SNDRV_DEVICE_TYPE_SEQUENCER:
case SNDRV_DEVICE_TYPE_TIMER:
minor = type;
break;
case SNDRV_DEVICE_TYPE_CONTROL:
if (snd_BUG_ON(!card))
return -EINVAL;
minor = SNDRV_MINOR(card->number, type);
break;
case SNDRV_DEVICE_TYPE_HWDEP:
case SNDRV_DEVICE_TYPE_RAWMIDI:
case SNDRV_DEVICE_TYPE_PCM_PLAYBACK:
case SNDRV_DEVICE_TYPE_PCM_CAPTURE:
case SNDRV_DEVICE_TYPE_COMPRESS:
if (snd_BUG_ON(!card))
return -EINVAL;
minor = SNDRV_MINOR(card->number, type + dev);
break;
default:
return -EINVAL;
}
if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OS_MINORS))
return -EINVAL;
if (snd_minors[minor])
return -EBUSY;
return minor;
}
#endif
int snd_register_device(int type, struct snd_card *card, int dev,
const struct file_operations *f_ops,
void *private_data, struct device *device)
{ … }
EXPORT_SYMBOL(…);
int snd_unregister_device(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_SND_PROC_FS
static const char *snd_device_type_name(int type)
{ … }
static void snd_minor_info_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{ … }
int __init snd_minor_info_init(void)
{ … }
#endif
static int __init alsa_sound_init(void)
{ … }
static void __exit alsa_sound_exit(void)
{ … }
subsys_initcall(alsa_sound_init);
module_exit(alsa_sound_exit);