*参照元 [#w7f7a722] #backlinks *説明 [#x69ac784] -パス: [[linux-2.6.33/sound/core/device.c]] -FIXME: これは何? --説明 **引数 [#p3be01f2] -struct snd_card *card -- --[[linux-2.6.33/snd_card]] -snd_device_type_t type -- --[[linux-2.6.33/snd_device_type_t]] -void *device_data -- -struct snd_device_ops *ops -- --[[linux-2.6.33/snd_device_ops]] **返り値 [#fc0958b2] -int -- **参考 [#f3aaa1a1] *実装 [#rca3de12] /** * snd_device_new - create an ALSA device component * @card: the card instance * @type: the device type, SNDRV_DEV_XXX * @device_data: the data pointer of this device * @ops: the operator table * * Creates a new device component for the given data pointer. * The device will be assigned to the card and managed together * by the card. * * The data pointer plays a role as the identifier, too, so the * pointer address must be unique and unchanged. * * Returns zero if successful, or a negative error code on failure. */ int snd_device_new(struct snd_card *card, snd_device_type_t type, void *device_data, struct snd_device_ops *ops) { struct snd_device *dev; - --[[linux-2.6.33/snd_device]] if (snd_BUG_ON(!card || !device_data || !ops)) return -ENXIO; - --[[linux-2.6.33/snd_BUG_ON()]] dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { snd_printk(KERN_ERR "Cannot allocate device\n"); return -ENOMEM; } - --[[linux-2.6.33/kzalloc()]] - --[[linux-2.6.33/snd_printk()]] dev->card = card; dev->type = type; dev->state = SNDRV_DEV_BUILD; dev->device_data = device_data; dev->ops = ops; list_add(&dev->list, &card->devices); /* add to the head of list */ - --[[linux-2.6.33/SNDRV_DEV_BUILD]] - --[[linux-2.6.33/list_add()]] return 0; } EXPORT_SYMBOL(snd_device_new); -ライセンスに関係なくシンボルを公開する。 --[[linux-2.6.33/EXPORT_SYMBOL()]] *コメント [#x8f403f1]