From be93709cb13a1947fec3493267d04cd87baf497e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 20 Oct 2014 18:06:04 +0200 Subject: ALSA: doc: Recommend the use of snd_ctl_elem_info() Instead of the open code for the info call back of enum elements, recommend the use of snd_ctl_elem_info(), which will reduce lots of codes. Signed-off-by: Takashi Iwai --- Documentation/DocBook/writing-an-alsa-driver.tmpl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Documentation') diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 784793df81ed..84ef6a90131c 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -3657,6 +3657,29 @@ struct _snd_pcm_runtime { + + The above callback can be simplified with a helper function, + snd_ctl_enum_info. The final code + looks like below. + (You can pass ARRAY_SIZE(texts) instead of 4 in the third + argument; it's a matter of taste.) + + + + + + + + Some common info callbacks are available for your convenience: snd_ctl_boolean_mono_info() and -- cgit v1.2.3