*参照元 [#cfec532d] #backlinks *説明 [#j58db075] -パス: [[linux-2.6.33/sound/core/hwdep.c]] -FIXME: これは何? --説明 **引数 [#s95ffdcf] -struct snd_card *card -- --[[linux-2.6.33/snd_card]] -char *id -- -int device -- -struct snd_hwdep **rhwdep -- --[[linux-2.6.33/snd_hwdep]] **返り値 [#dce0ab1c] -int -- **参考 [#xe0bd820] *実装 [#o88bd38f] /** * snd_hwdep_new - create a new hwdep instance * @card: the card instance * @id: the id string * @device: the device index (zero-based) * @rhwdep: the pointer to store the new hwdep instance * * Creates a new hwdep instance with the given index on the card. * The callbacks (hwdep->ops) must be set on the returned instance * after this call manually by the caller. * * Returns zero if successful, or a negative error code on failure. */ int snd_hwdep_new(struct snd_card *card, char *id, int device, struct snd_hwdep **rhwdep) { struct snd_hwdep *hwdep; int err; static struct snd_device_ops ops = { .dev_free = snd_hwdep_dev_free, .dev_register = snd_hwdep_dev_register, .dev_disconnect = snd_hwdep_dev_disconnect, }; - --[[linux-2.6.33/snd_device_ops]] - --[[linux-2.6.33/snd_hwdep_dev_free()]] - --[[linux-2.6.33/snd_hwdep_dev_register()]] - --[[linux-2.6.33/snd_hwdep_dev_disconnect()]] if (snd_BUG_ON(!card)) return -ENXIO; if (rhwdep) *rhwdep = NULL; - --[[linux-2.6.33/snd_BUG_ON()]] hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); if (hwdep == NULL) { snd_printk(KERN_ERR "hwdep: cannot allocate\n"); return -ENOMEM; } - --[[linux-2.6.33/kzalloc()]] - --[[linux-2.6.33/snd_printk()]] hwdep->card = card; hwdep->device = device; if (id) strlcpy(hwdep->id, id, sizeof(hwdep->id)); #ifdef CONFIG_SND_OSSEMUL - --[[linux-2.6.33/CONFIG_SND_OSSEMUL]] hwdep->oss_type = -1; #endif if ((err = snd_device_new(card, SNDRV_DEV_HWDEP, hwdep, &ops)) < 0) { snd_hwdep_free(hwdep); return err; } init_waitqueue_head(&hwdep->open_wait); mutex_init(&hwdep->open_mutex); if (rhwdep) *rhwdep = hwdep; - --[[linux-2.6.33/snd_device_new()]] - --[[linux-2.6.33/SNDRV_DEV_HWDEP]] - --[[linux-2.6.33/snd_hwdep_free()]] - --[[linux-2.6.33/init_waitqueue_head()]] - --[[linux-2.6.33/mutex_init()]] return 0; } *コメント [#nfd05242]