linux-2.6.33/snd_register_device_for_dev()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#l6750175]
#backlinks
*説明 [#sed1cea3]
-パス: [[linux-2.6.33/sound/core/sound.c]]
-FIXME: これは何?
--説明
**引数 [#tb086db5]
-int type
--
-struct snd_card *card
--
--[[linux-2.6.33/snd_card]]
-int dev
--
-const struct file_operations *f_ops
--
--[[linux-2.6.33/file_operations]]
-void *private_data
--
-const char *name
--
-struct device *device
--
--[[linux-2.6.33/device]]
**返り値 [#g68a64d4]
-int
--
**参考 [#s0bb4112]
*実装 [#l950569c]
/**
* snd_register_device_for_dev - Register the ALSA devic...
* @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.
*
* Returns zero if successful, or a negative error code ...
*/
int snd_register_device_for_dev(int type, struct snd_car...
const struct file_operations *f_ops,
void *private_data,
const char *name, struct device *device)
{
int minor;
struct snd_minor *preg;
-
--[[linux-2.6.33/snd_minor]]
if (snd_BUG_ON(!name))
return -EINVAL;
-
--[[linux-2.6.33/snd_BUG_ON()]]
preg = kmalloc(sizeof *preg, GFP_KERNEL);
if (preg == NULL)
return -ENOMEM;
-
--[[linux-2.6.33/kmalloc()]]
preg->type = type;
preg->card = card ? card->number : -1;
preg->device = dev;
preg->f_ops = f_ops;
preg->private_data = private_data;
mutex_lock(&sound_mutex);
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/sound_mutex(global)]]
#ifdef CONFIG_SND_DYNAMIC_MINORS
-
--[[linux-2.6.33/CONFIG_SND_DYNAMIC_MINORS]]
minor = snd_find_free_minor();
-
--[[linux-2.6.33/snd_find_free_minor()]]
#else
minor = snd_kernel_minor(type, card, dev);
if (minor >= 0 && snd_minors[minor])
minor = -EBUSY;
-
--[[linux-2.6.33/snd_kernel_minor()]]
#endif
if (minor < 0) {
mutex_unlock(&sound_mutex);
kfree(preg);
return minor;
}
-
--[[linux-2.6.33/mutex_unlock()]]
-
--[[linux-2.6.33/kfree()]]
snd_minors[minor] = preg;
preg->dev = device_create(sound_class, device, MKDEV(ma...
private_data, "%s", name);
-
--[[linux-2.6.33/device_create()]]
-
--[[linux-2.6.33/sound_class(global)]]
-
--[[linux-2.6.33/MKDEV()]]
if (IS_ERR(preg->dev)) {
snd_minors[minor] = NULL;
mutex_unlock(&sound_mutex);
minor = PTR_ERR(preg->dev);
kfree(preg);
return minor;
}
-
--[[linux-2.6.33/IS_ERR()]]
-
--[[linux-2.6.33/snd_minors(global)]]
-
--[[linux-2.6.33/PTR_ERR()]]
mutex_unlock(&sound_mutex);
return 0;
}
EXPORT_SYMBOL(snd_register_device_for_dev);
-モジュールのライセンスに関係なくシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]
*コメント [#z903129e]
終了行:
*参照元 [#l6750175]
#backlinks
*説明 [#sed1cea3]
-パス: [[linux-2.6.33/sound/core/sound.c]]
-FIXME: これは何?
--説明
**引数 [#tb086db5]
-int type
--
-struct snd_card *card
--
--[[linux-2.6.33/snd_card]]
-int dev
--
-const struct file_operations *f_ops
--
--[[linux-2.6.33/file_operations]]
-void *private_data
--
-const char *name
--
-struct device *device
--
--[[linux-2.6.33/device]]
**返り値 [#g68a64d4]
-int
--
**参考 [#s0bb4112]
*実装 [#l950569c]
/**
* snd_register_device_for_dev - Register the ALSA devic...
* @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.
*
* Returns zero if successful, or a negative error code ...
*/
int snd_register_device_for_dev(int type, struct snd_car...
const struct file_operations *f_ops,
void *private_data,
const char *name, struct device *device)
{
int minor;
struct snd_minor *preg;
-
--[[linux-2.6.33/snd_minor]]
if (snd_BUG_ON(!name))
return -EINVAL;
-
--[[linux-2.6.33/snd_BUG_ON()]]
preg = kmalloc(sizeof *preg, GFP_KERNEL);
if (preg == NULL)
return -ENOMEM;
-
--[[linux-2.6.33/kmalloc()]]
preg->type = type;
preg->card = card ? card->number : -1;
preg->device = dev;
preg->f_ops = f_ops;
preg->private_data = private_data;
mutex_lock(&sound_mutex);
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/sound_mutex(global)]]
#ifdef CONFIG_SND_DYNAMIC_MINORS
-
--[[linux-2.6.33/CONFIG_SND_DYNAMIC_MINORS]]
minor = snd_find_free_minor();
-
--[[linux-2.6.33/snd_find_free_minor()]]
#else
minor = snd_kernel_minor(type, card, dev);
if (minor >= 0 && snd_minors[minor])
minor = -EBUSY;
-
--[[linux-2.6.33/snd_kernel_minor()]]
#endif
if (minor < 0) {
mutex_unlock(&sound_mutex);
kfree(preg);
return minor;
}
-
--[[linux-2.6.33/mutex_unlock()]]
-
--[[linux-2.6.33/kfree()]]
snd_minors[minor] = preg;
preg->dev = device_create(sound_class, device, MKDEV(ma...
private_data, "%s", name);
-
--[[linux-2.6.33/device_create()]]
-
--[[linux-2.6.33/sound_class(global)]]
-
--[[linux-2.6.33/MKDEV()]]
if (IS_ERR(preg->dev)) {
snd_minors[minor] = NULL;
mutex_unlock(&sound_mutex);
minor = PTR_ERR(preg->dev);
kfree(preg);
return minor;
}
-
--[[linux-2.6.33/IS_ERR()]]
-
--[[linux-2.6.33/snd_minors(global)]]
-
--[[linux-2.6.33/PTR_ERR()]]
mutex_unlock(&sound_mutex);
return 0;
}
EXPORT_SYMBOL(snd_register_device_for_dev);
-モジュールのライセンスに関係なくシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]
*コメント [#z903129e]
ページ名: