linux-2.6.33/snd_pcm_dev_register()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#h693e29b]
#backlinks
*説明 [#a6eb4ea2]
-パス: [[linux-2.6.33/sound/core/pcm.c]]
-FIXME: これは何?
--説明
**引数 [#r4766fda]
-struct snd_device *device
--
--[[linux-2.6.33/snd_device]]
**返り値 [#w4dceb76]
-int
--
**参考 [#i53c7c77]
*実装 [#addc4075]
static int snd_pcm_dev_register(struct snd_device *device)
{
int cidx, err;
struct snd_pcm_substream *substream;
struct snd_pcm_notify *notify;
char str[16];
struct snd_pcm *pcm;
struct device *dev;
-
--[[linux-2.6.33/snd_pcm_substream]]
-
--[[linux-2.6.33/snd_pcm_notify]]
-
--[[linux-2.6.33/snd_pcm]]
-
--[[linux-2.6.33/device]]
if (snd_BUG_ON(!device || !device->device_data))
return -ENXIO;
-
--[[linux-2.6.33/snd_BUG_ON()]]
pcm = device->device_data;
mutex_lock(®ister_mutex);
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/register_mutex(global)]]
err = snd_pcm_add(pcm);
if (err) {
mutex_unlock(®ister_mutex);
return err;
}
-
--[[linux-2.6.33/snd_pcm_add()]]
-
--[[linux-2.6.33/mutex_unlock()]]
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
if (pcm->streams[cidx].substream == NULL)
continue;
switch (cidx) {
case SNDRV_PCM_STREAM_PLAYBACK:
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_PLAYBACK]]
sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->de...
devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK;
break;
-
--[[linux-2.6.33/SNDRV_DEVICE_TYPE_PCM_PLAYBACK]]
case SNDRV_PCM_STREAM_CAPTURE:
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_CAPTURE]]
sprintf(str, "pcmC%iD%ic", pcm->card->number, pcm->de...
devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
break;
-
--[[linux-2.6.33/SNDRV_DEVICE_TYPE_PCM_CAPTURE]]
}
/* device pointer to use, pcm->dev takes precedence if
* it is assigned, otherwise fall back to card's device
* if possible */
dev = pcm->dev;
if (!dev)
dev = snd_card_get_device_link(pcm->card);
-
--[[linux-2.6.33/snd_card_get_device_link()]]
/* register pcm */
err = snd_register_device_for_dev(devtype, pcm->card,
pcm->device,
&snd_pcm_f_ops[cidx],
pcm, str, dev);
if (err < 0) {
list_del(&pcm->list);
mutex_unlock(®ister_mutex);
return err;
}
-
--[[linux-2.6.33/snd_register_device_for_dev()]]
-
--[[linux-2.6.33/snd_pcm_f_ops(global)]]
-
--[[linux-2.6.33/list_del()]]
snd_add_device_sysfs_file(devtype, pcm->card, pcm->dev...
&pcm_attrs);
-
--[[linux-2.6.33/snd_add_device_sysfs_file()]]
-
--[[linux-2.6.33/pcm_attrs(global)]]
for (substream = pcm->streams[cidx].substream; substre...
snd_pcm_timer_init(substream);
-
--[[linux-2.6.33/snd_pcm_timer_init()]]
}
list_for_each_entry(notify, &snd_pcm_notify_list, list)
notify->n_register(pcm);
-
--[[linux-2.6.33/list_for_each_entry()]]
-
--[[linux-2.6.33/snd_pcm_notify_list(global)]]
mutex_unlock(®ister_mutex);
return 0;
}
*コメント [#i2aa92c2]
終了行:
*参照元 [#h693e29b]
#backlinks
*説明 [#a6eb4ea2]
-パス: [[linux-2.6.33/sound/core/pcm.c]]
-FIXME: これは何?
--説明
**引数 [#r4766fda]
-struct snd_device *device
--
--[[linux-2.6.33/snd_device]]
**返り値 [#w4dceb76]
-int
--
**参考 [#i53c7c77]
*実装 [#addc4075]
static int snd_pcm_dev_register(struct snd_device *device)
{
int cidx, err;
struct snd_pcm_substream *substream;
struct snd_pcm_notify *notify;
char str[16];
struct snd_pcm *pcm;
struct device *dev;
-
--[[linux-2.6.33/snd_pcm_substream]]
-
--[[linux-2.6.33/snd_pcm_notify]]
-
--[[linux-2.6.33/snd_pcm]]
-
--[[linux-2.6.33/device]]
if (snd_BUG_ON(!device || !device->device_data))
return -ENXIO;
-
--[[linux-2.6.33/snd_BUG_ON()]]
pcm = device->device_data;
mutex_lock(®ister_mutex);
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/register_mutex(global)]]
err = snd_pcm_add(pcm);
if (err) {
mutex_unlock(®ister_mutex);
return err;
}
-
--[[linux-2.6.33/snd_pcm_add()]]
-
--[[linux-2.6.33/mutex_unlock()]]
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
if (pcm->streams[cidx].substream == NULL)
continue;
switch (cidx) {
case SNDRV_PCM_STREAM_PLAYBACK:
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_PLAYBACK]]
sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->de...
devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK;
break;
-
--[[linux-2.6.33/SNDRV_DEVICE_TYPE_PCM_PLAYBACK]]
case SNDRV_PCM_STREAM_CAPTURE:
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_CAPTURE]]
sprintf(str, "pcmC%iD%ic", pcm->card->number, pcm->de...
devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
break;
-
--[[linux-2.6.33/SNDRV_DEVICE_TYPE_PCM_CAPTURE]]
}
/* device pointer to use, pcm->dev takes precedence if
* it is assigned, otherwise fall back to card's device
* if possible */
dev = pcm->dev;
if (!dev)
dev = snd_card_get_device_link(pcm->card);
-
--[[linux-2.6.33/snd_card_get_device_link()]]
/* register pcm */
err = snd_register_device_for_dev(devtype, pcm->card,
pcm->device,
&snd_pcm_f_ops[cidx],
pcm, str, dev);
if (err < 0) {
list_del(&pcm->list);
mutex_unlock(®ister_mutex);
return err;
}
-
--[[linux-2.6.33/snd_register_device_for_dev()]]
-
--[[linux-2.6.33/snd_pcm_f_ops(global)]]
-
--[[linux-2.6.33/list_del()]]
snd_add_device_sysfs_file(devtype, pcm->card, pcm->dev...
&pcm_attrs);
-
--[[linux-2.6.33/snd_add_device_sysfs_file()]]
-
--[[linux-2.6.33/pcm_attrs(global)]]
for (substream = pcm->streams[cidx].substream; substre...
snd_pcm_timer_init(substream);
-
--[[linux-2.6.33/snd_pcm_timer_init()]]
}
list_for_each_entry(notify, &snd_pcm_notify_list, list)
notify->n_register(pcm);
-
--[[linux-2.6.33/list_for_each_entry()]]
-
--[[linux-2.6.33/snd_pcm_notify_list(global)]]
mutex_unlock(®ister_mutex);
return 0;
}
*コメント [#i2aa92c2]
ページ名: