Loading Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +25 −19 Original line number Original line Diff line number Diff line Loading @@ -492,9 +492,9 @@ } } /* (2) */ /* (2) */ card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); if (card == NULL) if (err < 0) return -ENOMEM; return err; /* (3) */ /* (3) */ err = snd_mychip_create(card, pci, &chip); err = snd_mychip_create(card, pci, &chip); Loading Loading @@ -590,8 +590,9 @@ <programlisting> <programlisting> <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> Loading Loading @@ -809,26 +810,28 @@ <para> <para> As mentioned above, to create a card instance, call As mentioned above, to create a card instance, call <function>snd_card_new()</function>. <function>snd_card_create()</function>. <informalexample> <informalexample> <programlisting> <programlisting> <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; card = snd_card_new(index, id, module, extra_size); int err; err = snd_card_create(index, id, module, extra_size, &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> </para> </para> <para> <para> The function takes four arguments, the card-index number, the The function takes five arguments, the card-index number, the id string, the module pointer (usually id string, the module pointer (usually <constant>THIS_MODULE</constant>), <constant>THIS_MODULE</constant>), and the size of extra-data space. The last argument is used to the size of extra-data space, and the pointer to return the card instance. The extra_size argument is used to allocate card->private_data for the allocate card->private_data for the chip-specific data. Note that these data chip-specific data. Note that these data are allocated by <function>snd_card_new()</function>. are allocated by <function>snd_card_create()</function>. </para> </para> </section> </section> Loading Loading @@ -915,15 +918,16 @@ </para> </para> <section id="card-management-chip-specific-snd-card-new"> <section id="card-management-chip-specific-snd-card-new"> <title>1. Allocating via <function>snd_card_new()</function>.</title> <title>1. Allocating via <function>snd_card_create()</function>.</title> <para> <para> As mentioned above, you can pass the extra-data-length As mentioned above, you can pass the extra-data-length to the 4th argument of <function>snd_card_new()</function>, i.e. to the 4th argument of <function>snd_card_create()</function>, i.e. <informalexample> <informalexample> <programlisting> <programlisting> <![CDATA[ <![CDATA[ card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip), &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> Loading Loading @@ -952,8 +956,8 @@ <para> <para> After allocating a card instance via After allocating a card instance via <function>snd_card_new()</function> (with <function>snd_card_create()</function> (with <constant>NULL</constant> on the 4th arg), call <constant>0</constant> on the 4th arg), call <function>kzalloc()</function>. <function>kzalloc()</function>. <informalexample> <informalexample> Loading @@ -961,7 +965,7 @@ <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); ..... ..... chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL); ]]> ]]> Loading Loading @@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime { .... .... struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); .... .... chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL); .... .... Loading @@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime { </informalexample> </informalexample> When you created the chip data with When you created the chip data with <function>snd_card_new()</function>, it's anyway accessible <function>snd_card_create()</function>, it's anyway accessible via <structfield>private_data</structfield> field. via <structfield>private_data</structfield> field. <informalexample> <informalexample> Loading @@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime { .... .... struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); sizeof(struct mychip), &card); .... .... chip = card->private_data; chip = card->private_data; .... .... Loading drivers/media/video/cx88/cx88-alsa.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -803,9 +803,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, return (-ENOENT); return (-ENOENT); } } card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); err = snd_card_create(index[devno], id[devno], THIS_MODULE, if (!card) sizeof(snd_cx88_card_t), &card); return (-ENOMEM); if (err < 0) return err; card->private_free = snd_cx88_dev_free; card->private_free = snd_cx88_dev_free; Loading drivers/media/video/em28xx/em28xx-audio.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -448,9 +448,10 @@ static int em28xx_audio_init(struct em28xx *dev) printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " "Rechberger\n"); "Rechberger\n"); card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0, if (card == NULL) &card); return -ENOMEM; if (err < 0) return err; spin_lock_init(&adev->slock); spin_lock_init(&adev->slock); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); Loading drivers/media/video/saa7134/saa7134-alsa.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -990,10 +990,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) if (!enable[devnum]) if (!enable[devnum]) return -ENODEV; return -ENODEV; card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t)); err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t), &card); if (card == NULL) if (err < 0) return -ENOMEM; return err; strcpy(card->driver, "SAA7134"); strcpy(card->driver, "SAA7134"); Loading drivers/staging/go7007/snd-go7007.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -248,10 +248,11 @@ int go7007_snd_init(struct go7007 *go) spin_lock_init(&gosnd->lock); spin_lock_init(&gosnd->lock); gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; gosnd->capturing = 0; gosnd->capturing = 0; gosnd->card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, if (gosnd->card == NULL) { &gosnd->card); if (ret < 0) { kfree(gosnd); kfree(gosnd); return -ENOMEM; return ret; } } ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, &go7007_snd_device_ops); &go7007_snd_device_ops); Loading Loading
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +25 −19 Original line number Original line Diff line number Diff line Loading @@ -492,9 +492,9 @@ } } /* (2) */ /* (2) */ card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); if (card == NULL) if (err < 0) return -ENOMEM; return err; /* (3) */ /* (3) */ err = snd_mychip_create(card, pci, &chip); err = snd_mychip_create(card, pci, &chip); Loading Loading @@ -590,8 +590,9 @@ <programlisting> <programlisting> <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> Loading Loading @@ -809,26 +810,28 @@ <para> <para> As mentioned above, to create a card instance, call As mentioned above, to create a card instance, call <function>snd_card_new()</function>. <function>snd_card_create()</function>. <informalexample> <informalexample> <programlisting> <programlisting> <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; card = snd_card_new(index, id, module, extra_size); int err; err = snd_card_create(index, id, module, extra_size, &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> </para> </para> <para> <para> The function takes four arguments, the card-index number, the The function takes five arguments, the card-index number, the id string, the module pointer (usually id string, the module pointer (usually <constant>THIS_MODULE</constant>), <constant>THIS_MODULE</constant>), and the size of extra-data space. The last argument is used to the size of extra-data space, and the pointer to return the card instance. The extra_size argument is used to allocate card->private_data for the allocate card->private_data for the chip-specific data. Note that these data chip-specific data. Note that these data are allocated by <function>snd_card_new()</function>. are allocated by <function>snd_card_create()</function>. </para> </para> </section> </section> Loading Loading @@ -915,15 +918,16 @@ </para> </para> <section id="card-management-chip-specific-snd-card-new"> <section id="card-management-chip-specific-snd-card-new"> <title>1. Allocating via <function>snd_card_new()</function>.</title> <title>1. Allocating via <function>snd_card_create()</function>.</title> <para> <para> As mentioned above, you can pass the extra-data-length As mentioned above, you can pass the extra-data-length to the 4th argument of <function>snd_card_new()</function>, i.e. to the 4th argument of <function>snd_card_create()</function>, i.e. <informalexample> <informalexample> <programlisting> <programlisting> <![CDATA[ <![CDATA[ card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip), &card); ]]> ]]> </programlisting> </programlisting> </informalexample> </informalexample> Loading Loading @@ -952,8 +956,8 @@ <para> <para> After allocating a card instance via After allocating a card instance via <function>snd_card_new()</function> (with <function>snd_card_create()</function> (with <constant>NULL</constant> on the 4th arg), call <constant>0</constant> on the 4th arg), call <function>kzalloc()</function>. <function>kzalloc()</function>. <informalexample> <informalexample> Loading @@ -961,7 +965,7 @@ <![CDATA[ <![CDATA[ struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); ..... ..... chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL); ]]> ]]> Loading Loading @@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime { .... .... struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); .... .... chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL); .... .... Loading @@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime { </informalexample> </informalexample> When you created the chip data with When you created the chip data with <function>snd_card_new()</function>, it's anyway accessible <function>snd_card_create()</function>, it's anyway accessible via <structfield>private_data</structfield> field. via <structfield>private_data</structfield> field. <informalexample> <informalexample> Loading @@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime { .... .... struct snd_card *card; struct snd_card *card; struct mychip *chip; struct mychip *chip; int err; .... .... card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); sizeof(struct mychip), &card); .... .... chip = card->private_data; chip = card->private_data; .... .... Loading
drivers/media/video/cx88/cx88-alsa.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -803,9 +803,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, return (-ENOENT); return (-ENOENT); } } card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); err = snd_card_create(index[devno], id[devno], THIS_MODULE, if (!card) sizeof(snd_cx88_card_t), &card); return (-ENOMEM); if (err < 0) return err; card->private_free = snd_cx88_dev_free; card->private_free = snd_cx88_dev_free; Loading
drivers/media/video/em28xx/em28xx-audio.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -448,9 +448,10 @@ static int em28xx_audio_init(struct em28xx *dev) printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " "Rechberger\n"); "Rechberger\n"); card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0, if (card == NULL) &card); return -ENOMEM; if (err < 0) return err; spin_lock_init(&adev->slock); spin_lock_init(&adev->slock); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); Loading
drivers/media/video/saa7134/saa7134-alsa.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -990,10 +990,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) if (!enable[devnum]) if (!enable[devnum]) return -ENODEV; return -ENODEV; card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t)); err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t), &card); if (card == NULL) if (err < 0) return -ENOMEM; return err; strcpy(card->driver, "SAA7134"); strcpy(card->driver, "SAA7134"); Loading
drivers/staging/go7007/snd-go7007.c +4 −3 Original line number Original line Diff line number Diff line Loading @@ -248,10 +248,11 @@ int go7007_snd_init(struct go7007 *go) spin_lock_init(&gosnd->lock); spin_lock_init(&gosnd->lock); gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; gosnd->capturing = 0; gosnd->capturing = 0; gosnd->card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, if (gosnd->card == NULL) { &gosnd->card); if (ret < 0) { kfree(gosnd); kfree(gosnd); return -ENOMEM; return ret; } } ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, &go7007_snd_device_ops); &go7007_snd_device_ops); Loading