aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook/writing-an-alsa-driver.tmpl
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-07 01:52:28 -0500
committerTakashi Iwai <tiwai@suse.de>2012-12-07 01:53:38 -0500
commit090015aeefb1360dfa2c467310530052a2965eac (patch)
treed4aa221859f3bb0d4238acfd9de2e7c1f94162fe /Documentation/DocBook/writing-an-alsa-driver.tmpl
parent6a0f56a784cd8b08d5c438c11cfa659472b29113 (diff)
ALSA: DocBook: Remove the description of __dev*
Remove obsoleted __devinit* and __devexit* from the example codes and the descriptions, or modified the descriptions a bit to match with the current situation. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'Documentation/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r--Documentation/DocBook/writing-an-alsa-driver.tmpl85
1 files changed, 28 insertions, 57 deletions
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl
index cab4ec58e46e..fb32aead5a0b 100644
--- a/Documentation/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl
@@ -433,9 +433,9 @@
433 /* chip-specific constructor 433 /* chip-specific constructor
434 * (see "Management of Cards and Components") 434 * (see "Management of Cards and Components")
435 */ 435 */
436 static int __devinit snd_mychip_create(struct snd_card *card, 436 static int snd_mychip_create(struct snd_card *card,
437 struct pci_dev *pci, 437 struct pci_dev *pci,
438 struct mychip **rchip) 438 struct mychip **rchip)
439 { 439 {
440 struct mychip *chip; 440 struct mychip *chip;
441 int err; 441 int err;
@@ -475,8 +475,8 @@
475 } 475 }
476 476
477 /* constructor -- see "Constructor" sub-section */ 477 /* constructor -- see "Constructor" sub-section */
478 static int __devinit snd_mychip_probe(struct pci_dev *pci, 478 static int snd_mychip_probe(struct pci_dev *pci,
479 const struct pci_device_id *pci_id) 479 const struct pci_device_id *pci_id)
480 { 480 {
481 static int dev; 481 static int dev;
482 struct snd_card *card; 482 struct snd_card *card;
@@ -526,7 +526,7 @@
526 } 526 }
527 527
528 /* destructor -- see the "Destructor" sub-section */ 528 /* destructor -- see the "Destructor" sub-section */
529 static void __devexit snd_mychip_remove(struct pci_dev *pci) 529 static void snd_mychip_remove(struct pci_dev *pci)
530 { 530 {
531 snd_card_free(pci_get_drvdata(pci)); 531 snd_card_free(pci_get_drvdata(pci));
532 pci_set_drvdata(pci, NULL); 532 pci_set_drvdata(pci, NULL);
@@ -542,9 +542,8 @@
542 <para> 542 <para>
543 The real constructor of PCI drivers is the <function>probe</function> callback. 543 The real constructor of PCI drivers is the <function>probe</function> callback.
544 The <function>probe</function> callback and other component-constructors which are called 544 The <function>probe</function> callback and other component-constructors which are called
545 from the <function>probe</function> callback should be defined with 545 from the <function>probe</function> callback cannot be used with
546 the <parameter>__devinit</parameter> prefix. You 546 the <parameter>__init</parameter> prefix
547 cannot use the <parameter>__init</parameter> prefix for them,
548 because any PCI device could be a hotplug device. 547 because any PCI device could be a hotplug device.
549 </para> 548 </para>
550 549
@@ -728,7 +727,7 @@
728 <informalexample> 727 <informalexample>
729 <programlisting> 728 <programlisting>
730<![CDATA[ 729<![CDATA[
731 static void __devexit snd_mychip_remove(struct pci_dev *pci) 730 static void snd_mychip_remove(struct pci_dev *pci)
732 { 731 {
733 snd_card_free(pci_get_drvdata(pci)); 732 snd_card_free(pci_get_drvdata(pci));
734 pci_set_drvdata(pci, NULL); 733 pci_set_drvdata(pci, NULL);
@@ -1059,14 +1058,6 @@
1059 </para> 1058 </para>
1060 1059
1061 <para> 1060 <para>
1062 As further notes, the destructors (both
1063 <function>snd_mychip_dev_free</function> and
1064 <function>snd_mychip_free</function>) cannot be defined with
1065 the <parameter>__devexit</parameter> prefix, because they may be
1066 called from the constructor, too, at the false path.
1067 </para>
1068
1069 <para>
1070 For a device which allows hotplugging, you can use 1061 For a device which allows hotplugging, you can use
1071 <function>snd_card_free_when_closed</function>. This one will 1062 <function>snd_card_free_when_closed</function>. This one will
1072 postpone the destruction until all devices are closed. 1063 postpone the destruction until all devices are closed.
@@ -1120,9 +1111,9 @@
1120 } 1111 }
1121 1112
1122 /* chip-specific constructor */ 1113 /* chip-specific constructor */
1123 static int __devinit snd_mychip_create(struct snd_card *card, 1114 static int snd_mychip_create(struct snd_card *card,
1124 struct pci_dev *pci, 1115 struct pci_dev *pci,
1125 struct mychip **rchip) 1116 struct mychip **rchip)
1126 { 1117 {
1127 struct mychip *chip; 1118 struct mychip *chip;
1128 int err; 1119 int err;
@@ -1200,7 +1191,7 @@
1200 .name = KBUILD_MODNAME, 1191 .name = KBUILD_MODNAME,
1201 .id_table = snd_mychip_ids, 1192 .id_table = snd_mychip_ids,
1202 .probe = snd_mychip_probe, 1193 .probe = snd_mychip_probe,
1203 .remove = __devexit_p(snd_mychip_remove), 1194 .remove = snd_mychip_remove,
1204 }; 1195 };
1205 1196
1206 /* module initialization */ 1197 /* module initialization */
@@ -1465,11 +1456,6 @@
1465 </para> 1456 </para>
1466 1457
1467 <para> 1458 <para>
1468 Again, remember that you cannot
1469 use the <parameter>__devexit</parameter> prefix for this destructor.
1470 </para>
1471
1472 <para>
1473 We didn't implement the hardware disabling part in the above. 1459 We didn't implement the hardware disabling part in the above.
1474 If you need to do this, please note that the destructor may be 1460 If you need to do this, please note that the destructor may be
1475 called even before the initialization of the chip is completed. 1461 called even before the initialization of the chip is completed.
@@ -1619,7 +1605,7 @@
1619 .name = KBUILD_MODNAME, 1605 .name = KBUILD_MODNAME,
1620 .id_table = snd_mychip_ids, 1606 .id_table = snd_mychip_ids,
1621 .probe = snd_mychip_probe, 1607 .probe = snd_mychip_probe,
1622 .remove = __devexit_p(snd_mychip_remove), 1608 .remove = snd_mychip_remove,
1623 }; 1609 };
1624]]> 1610]]>
1625 </programlisting> 1611 </programlisting>
@@ -1630,11 +1616,7 @@
1630 The <structfield>probe</structfield> and 1616 The <structfield>probe</structfield> and
1631 <structfield>remove</structfield> functions have already 1617 <structfield>remove</structfield> functions have already
1632 been defined in the previous sections. 1618 been defined in the previous sections.
1633 The <structfield>remove</structfield> function should 1619 The <structfield>name</structfield>
1634 be defined with the
1635 <function>__devexit_p()</function> macro, so that it's not
1636 defined for built-in (and non-hot-pluggable) case. The
1637 <structfield>name</structfield>
1638 field is the name string of this device. Note that you must not 1620 field is the name string of this device. Note that you must not
1639 use a slash <quote>/</quote> in this string. 1621 use a slash <quote>/</quote> in this string.
1640 </para> 1622 </para>
@@ -1665,9 +1647,7 @@
1665 <para> 1647 <para>
1666 Note that these module entries are tagged with 1648 Note that these module entries are tagged with
1667 <parameter>__init</parameter> and 1649 <parameter>__init</parameter> and
1668 <parameter>__exit</parameter> prefixes, not 1650 <parameter>__exit</parameter> prefixes.
1669 <parameter>__devinit</parameter> nor
1670 <parameter>__devexit</parameter>.
1671 </para> 1651 </para>
1672 1652
1673 <para> 1653 <para>
@@ -1918,7 +1898,7 @@
1918 */ 1898 */
1919 1899
1920 /* create a pcm device */ 1900 /* create a pcm device */
1921 static int __devinit snd_mychip_new_pcm(struct mychip *chip) 1901 static int snd_mychip_new_pcm(struct mychip *chip)
1922 { 1902 {
1923 struct snd_pcm *pcm; 1903 struct snd_pcm *pcm;
1924 int err; 1904 int err;
@@ -1957,7 +1937,7 @@
1957 <informalexample> 1937 <informalexample>
1958 <programlisting> 1938 <programlisting>
1959<![CDATA[ 1939<![CDATA[
1960 static int __devinit snd_mychip_new_pcm(struct mychip *chip) 1940 static int snd_mychip_new_pcm(struct mychip *chip)
1961 { 1941 {
1962 struct snd_pcm *pcm; 1942 struct snd_pcm *pcm;
1963 int err; 1943 int err;
@@ -2124,7 +2104,7 @@
2124 .... 2104 ....
2125 } 2105 }
2126 2106
2127 static int __devinit snd_mychip_new_pcm(struct mychip *chip) 2107 static int snd_mychip_new_pcm(struct mychip *chip)
2128 { 2108 {
2129 struct snd_pcm *pcm; 2109 struct snd_pcm *pcm;
2130 .... 2110 ....
@@ -3399,7 +3379,7 @@ struct _snd_pcm_runtime {
3399 <title>Definition of a Control</title> 3379 <title>Definition of a Control</title>
3400 <programlisting> 3380 <programlisting>
3401<![CDATA[ 3381<![CDATA[
3402 static struct snd_kcontrol_new my_control __devinitdata = { 3382 static struct snd_kcontrol_new my_control = {
3403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3383 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3404 .name = "PCM Playback Switch", 3384 .name = "PCM Playback Switch",
3405 .index = 0, 3385 .index = 0,
@@ -3415,13 +3395,6 @@ struct _snd_pcm_runtime {
3415 </para> 3395 </para>
3416 3396
3417 <para> 3397 <para>
3418 Most likely the control is created via
3419 <function>snd_ctl_new1()</function>, and in such a case, you can
3420 add the <parameter>__devinitdata</parameter> prefix to the
3421 definition as above.
3422 </para>
3423
3424 <para>
3425 The <structfield>iface</structfield> field specifies the control 3398 The <structfield>iface</structfield> field specifies the control
3426 type, <constant>SNDRV_CTL_ELEM_IFACE_XXX</constant>, which 3399 type, <constant>SNDRV_CTL_ELEM_IFACE_XXX</constant>, which
3427 is usually <constant>MIXER</constant>. 3400 is usually <constant>MIXER</constant>.
@@ -3847,10 +3820,8 @@ struct _snd_pcm_runtime {
3847 3820
3848 <para> 3821 <para>
3849 <function>snd_ctl_new1()</function> allocates a new 3822 <function>snd_ctl_new1()</function> allocates a new
3850 <structname>snd_kcontrol</structname> instance (that's why the definition 3823 <structname>snd_kcontrol</structname> instance,
3851 of <parameter>my_control</parameter> can be with 3824 and <function>snd_ctl_add</function> assigns the given
3852 the <parameter>__devinitdata</parameter>
3853 prefix), and <function>snd_ctl_add</function> assigns the given
3854 control component to the card. 3825 control component to the card.
3855 </para> 3826 </para>
3856 </section> 3827 </section>
@@ -3896,7 +3867,7 @@ struct _snd_pcm_runtime {
3896<![CDATA[ 3867<![CDATA[
3897 static DECLARE_TLV_DB_SCALE(db_scale_my_control, -4050, 150, 0); 3868 static DECLARE_TLV_DB_SCALE(db_scale_my_control, -4050, 150, 0);
3898 3869
3899 static struct snd_kcontrol_new my_control __devinitdata = { 3870 static struct snd_kcontrol_new my_control = {
3900 ... 3871 ...
3901 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 3872 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
3902 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 3873 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -5761,8 +5732,8 @@ struct _snd_pcm_runtime {
5761 <informalexample> 5732 <informalexample>
5762 <programlisting> 5733 <programlisting>
5763<![CDATA[ 5734<![CDATA[
5764 static int __devinit snd_mychip_probe(struct pci_dev *pci, 5735 static int snd_mychip_probe(struct pci_dev *pci,
5765 const struct pci_device_id *pci_id) 5736 const struct pci_device_id *pci_id)
5766 { 5737 {
5767 .... 5738 ....
5768 struct snd_card *card; 5739 struct snd_card *card;
@@ -5787,8 +5758,8 @@ struct _snd_pcm_runtime {
5787 <informalexample> 5758 <informalexample>
5788 <programlisting> 5759 <programlisting>
5789<![CDATA[ 5760<![CDATA[
5790 static int __devinit snd_mychip_probe(struct pci_dev *pci, 5761 static int snd_mychip_probe(struct pci_dev *pci,
5791 const struct pci_device_id *pci_id) 5762 const struct pci_device_id *pci_id)
5792 { 5763 {
5793 .... 5764 ....
5794 struct snd_card *card; 5765 struct snd_card *card;
@@ -5825,7 +5796,7 @@ struct _snd_pcm_runtime {
5825 .name = KBUILD_MODNAME, 5796 .name = KBUILD_MODNAME,
5826 .id_table = snd_my_ids, 5797 .id_table = snd_my_ids,
5827 .probe = snd_my_probe, 5798 .probe = snd_my_probe,
5828 .remove = __devexit_p(snd_my_remove), 5799 .remove = snd_my_remove,
5829 #ifdef CONFIG_PM 5800 #ifdef CONFIG_PM
5830 .suspend = snd_my_suspend, 5801 .suspend = snd_my_suspend,
5831 .resume = snd_my_resume, 5802 .resume = snd_my_resume,