diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-02-19 04:22:14 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-19 04:22:14 -0500 |
commit | a5e0e970c06065a14844b406a0c2a59776a1ccc6 (patch) | |
tree | 1da3f4aac02e29f0dfbd099b17412011ca950cb8 /Documentation/sound | |
parent | 6ce6c473a7fd742fdb0db95841e2c4c6b37337c5 (diff) | |
parent | b1a0aac05f044e78a589bfd7a9e2334aa640eb45 (diff) |
Merge branch 'topic/snd_card_new-err' into topic/oxygen
Diffstat (limited to 'Documentation/sound')
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 87a7c07ab658..320384c1791b 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -492,9 +492,9 @@ | |||
492 | } | 492 | } |
493 | 493 | ||
494 | /* (2) */ | 494 | /* (2) */ |
495 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 495 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
496 | if (card == NULL) | 496 | if (err < 0) |
497 | return -ENOMEM; | 497 | return err; |
498 | 498 | ||
499 | /* (3) */ | 499 | /* (3) */ |
500 | err = snd_mychip_create(card, pci, &chip); | 500 | err = snd_mychip_create(card, pci, &chip); |
@@ -590,8 +590,9 @@ | |||
590 | <programlisting> | 590 | <programlisting> |
591 | <![CDATA[ | 591 | <![CDATA[ |
592 | struct snd_card *card; | 592 | struct snd_card *card; |
593 | int err; | ||
593 | .... | 594 | .... |
594 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 595 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
595 | ]]> | 596 | ]]> |
596 | </programlisting> | 597 | </programlisting> |
597 | </informalexample> | 598 | </informalexample> |
@@ -809,26 +810,28 @@ | |||
809 | 810 | ||
810 | <para> | 811 | <para> |
811 | As mentioned above, to create a card instance, call | 812 | As mentioned above, to create a card instance, call |
812 | <function>snd_card_new()</function>. | 813 | <function>snd_card_create()</function>. |
813 | 814 | ||
814 | <informalexample> | 815 | <informalexample> |
815 | <programlisting> | 816 | <programlisting> |
816 | <![CDATA[ | 817 | <![CDATA[ |
817 | struct snd_card *card; | 818 | struct snd_card *card; |
818 | card = snd_card_new(index, id, module, extra_size); | 819 | int err; |
820 | err = snd_card_create(index, id, module, extra_size, &card); | ||
819 | ]]> | 821 | ]]> |
820 | </programlisting> | 822 | </programlisting> |
821 | </informalexample> | 823 | </informalexample> |
822 | </para> | 824 | </para> |
823 | 825 | ||
824 | <para> | 826 | <para> |
825 | The function takes four arguments, the card-index number, the | 827 | The function takes five arguments, the card-index number, the |
826 | id string, the module pointer (usually | 828 | id string, the module pointer (usually |
827 | <constant>THIS_MODULE</constant>), | 829 | <constant>THIS_MODULE</constant>), |
828 | and the size of extra-data space. The last argument is used to | 830 | the size of extra-data space, and the pointer to return the |
831 | card instance. The extra_size argument is used to | ||
829 | allocate card->private_data for the | 832 | allocate card->private_data for the |
830 | chip-specific data. Note that these data | 833 | chip-specific data. Note that these data |
831 | are allocated by <function>snd_card_new()</function>. | 834 | are allocated by <function>snd_card_create()</function>. |
832 | </para> | 835 | </para> |
833 | </section> | 836 | </section> |
834 | 837 | ||
@@ -915,15 +918,16 @@ | |||
915 | </para> | 918 | </para> |
916 | 919 | ||
917 | <section id="card-management-chip-specific-snd-card-new"> | 920 | <section id="card-management-chip-specific-snd-card-new"> |
918 | <title>1. Allocating via <function>snd_card_new()</function>.</title> | 921 | <title>1. Allocating via <function>snd_card_create()</function>.</title> |
919 | <para> | 922 | <para> |
920 | As mentioned above, you can pass the extra-data-length | 923 | As mentioned above, you can pass the extra-data-length |
921 | to the 4th argument of <function>snd_card_new()</function>, i.e. | 924 | to the 4th argument of <function>snd_card_create()</function>, i.e. |
922 | 925 | ||
923 | <informalexample> | 926 | <informalexample> |
924 | <programlisting> | 927 | <programlisting> |
925 | <![CDATA[ | 928 | <![CDATA[ |
926 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); | 929 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
930 | sizeof(struct mychip), &card); | ||
927 | ]]> | 931 | ]]> |
928 | </programlisting> | 932 | </programlisting> |
929 | </informalexample> | 933 | </informalexample> |
@@ -952,8 +956,8 @@ | |||
952 | 956 | ||
953 | <para> | 957 | <para> |
954 | After allocating a card instance via | 958 | After allocating a card instance via |
955 | <function>snd_card_new()</function> (with | 959 | <function>snd_card_create()</function> (with |
956 | <constant>NULL</constant> on the 4th arg), call | 960 | <constant>0</constant> on the 4th arg), call |
957 | <function>kzalloc()</function>. | 961 | <function>kzalloc()</function>. |
958 | 962 | ||
959 | <informalexample> | 963 | <informalexample> |
@@ -961,7 +965,7 @@ | |||
961 | <![CDATA[ | 965 | <![CDATA[ |
962 | struct snd_card *card; | 966 | struct snd_card *card; |
963 | struct mychip *chip; | 967 | struct mychip *chip; |
964 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); | 968 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
965 | ..... | 969 | ..... |
966 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 970 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
967 | ]]> | 971 | ]]> |
@@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime { | |||
5750 | .... | 5754 | .... |
5751 | struct snd_card *card; | 5755 | struct snd_card *card; |
5752 | struct mychip *chip; | 5756 | struct mychip *chip; |
5757 | int err; | ||
5753 | .... | 5758 | .... |
5754 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); | 5759 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
5755 | .... | 5760 | .... |
5756 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 5761 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
5757 | .... | 5762 | .... |
@@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime { | |||
5763 | </informalexample> | 5768 | </informalexample> |
5764 | 5769 | ||
5765 | When you created the chip data with | 5770 | When you created the chip data with |
5766 | <function>snd_card_new()</function>, it's anyway accessible | 5771 | <function>snd_card_create()</function>, it's anyway accessible |
5767 | via <structfield>private_data</structfield> field. | 5772 | via <structfield>private_data</structfield> field. |
5768 | 5773 | ||
5769 | <informalexample> | 5774 | <informalexample> |
@@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime { | |||
5775 | .... | 5780 | .... |
5776 | struct snd_card *card; | 5781 | struct snd_card *card; |
5777 | struct mychip *chip; | 5782 | struct mychip *chip; |
5783 | int err; | ||
5778 | .... | 5784 | .... |
5779 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 5785 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
5780 | sizeof(struct mychip)); | 5786 | sizeof(struct mychip), &card); |
5781 | .... | 5787 | .... |
5782 | chip = card->private_data; | 5788 | chip = card->private_data; |
5783 | .... | 5789 | .... |