diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:19:34 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 03:10:53 -0400 |
commit | 8d678da9f0afbb951778369510c09b99de608c24 (patch) | |
tree | 1368bee015d6418649e962a1c6e36f3da317abf1 /sound/pci/rme9652 | |
parent | 9c30d46a0fb3b294faf1226025071d6e802a8c36 (diff) |
ALSA: hdsp: Use snd_ctl_enum_info()
... and reduce the open codes. Also add missing const to text arrays.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 175 |
1 files changed, 57 insertions, 118 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 7646ba1664eb..2eb8baf7b828 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -1680,16 +1680,13 @@ static int hdsp_set_spdif_input(struct hdsp *hdsp, int in) | |||
1680 | 1680 | ||
1681 | static int snd_hdsp_info_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1681 | static int snd_hdsp_info_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1682 | { | 1682 | { |
1683 | static char *texts[4] = {"Optical", "Coaxial", "Internal", "AES"}; | 1683 | static const char * const texts[4] = { |
1684 | "Optical", "Coaxial", "Internal", "AES" | ||
1685 | }; | ||
1684 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1686 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1685 | 1687 | ||
1686 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1688 | return snd_ctl_enum_info(uinfo, 1, (hdsp->io_type == H9632) ? 4 : 3, |
1687 | uinfo->count = 1; | 1689 | texts); |
1688 | uinfo->value.enumerated.items = ((hdsp->io_type == H9632) ? 4 : 3); | ||
1689 | if (uinfo->value.enumerated.item > ((hdsp->io_type == H9632) ? 3 : 2)) | ||
1690 | uinfo->value.enumerated.item = ((hdsp->io_type == H9632) ? 3 : 2); | ||
1691 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1692 | return 0; | ||
1693 | } | 1690 | } |
1694 | 1691 | ||
1695 | static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1692 | static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1786,16 +1783,14 @@ static int snd_hdsp_put_toggle_setting(struct snd_kcontrol *kcontrol, | |||
1786 | 1783 | ||
1787 | static int snd_hdsp_info_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1784 | static int snd_hdsp_info_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1788 | { | 1785 | { |
1789 | static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; | 1786 | static const char * const texts[] = { |
1787 | "32000", "44100", "48000", "64000", "88200", "96000", | ||
1788 | "None", "128000", "176400", "192000" | ||
1789 | }; | ||
1790 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1790 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1791 | 1791 | ||
1792 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1792 | return snd_ctl_enum_info(uinfo, 1, (hdsp->io_type == H9632) ? 10 : 7, |
1793 | uinfo->count = 1; | 1793 | texts); |
1794 | uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7; | ||
1795 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
1796 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
1797 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1798 | return 0; | ||
1799 | } | 1794 | } |
1800 | 1795 | ||
1801 | static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1796 | static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1872,14 +1867,13 @@ static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct | |||
1872 | static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1867 | static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1873 | { | 1868 | { |
1874 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1869 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1875 | static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; | 1870 | static const char * const texts[] = { |
1876 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1871 | "32000", "44100", "48000", "64000", "88200", "96000", |
1877 | uinfo->count = 1; | 1872 | "None", "128000", "176400", "192000" |
1878 | uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ; | 1873 | }; |
1879 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 1874 | |
1880 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 1875 | return snd_ctl_enum_info(uinfo, 1, (hdsp->io_type == H9632) ? 10 : 7, |
1881 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 1876 | texts); |
1882 | return 0; | ||
1883 | } | 1877 | } |
1884 | 1878 | ||
1885 | static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1879 | static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1940,15 +1934,9 @@ static int hdsp_system_clock_mode(struct hdsp *hdsp) | |||
1940 | 1934 | ||
1941 | static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1935 | static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1942 | { | 1936 | { |
1943 | static char *texts[] = {"Master", "Slave" }; | 1937 | static const char * const texts[] = {"Master", "Slave" }; |
1944 | 1938 | ||
1945 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1939 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
1946 | uinfo->count = 1; | ||
1947 | uinfo->value.enumerated.items = 2; | ||
1948 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
1949 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
1950 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1951 | return 0; | ||
1952 | } | 1940 | } |
1953 | 1941 | ||
1954 | static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1942 | static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2049,19 +2037,16 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode) | |||
2049 | 2037 | ||
2050 | static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2038 | static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2051 | { | 2039 | { |
2052 | static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" }; | 2040 | static const char * const texts[] = { |
2041 | "AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", | ||
2042 | "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", | ||
2043 | "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", | ||
2044 | "Internal 192.0 KHz" | ||
2045 | }; | ||
2053 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2046 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2054 | 2047 | ||
2055 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2048 | return snd_ctl_enum_info(uinfo, 1, (hdsp->io_type == H9632) ? 10 : 7, |
2056 | uinfo->count = 1; | 2049 | texts); |
2057 | if (hdsp->io_type == H9632) | ||
2058 | uinfo->value.enumerated.items = 10; | ||
2059 | else | ||
2060 | uinfo->value.enumerated.items = 7; | ||
2061 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2062 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2063 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2064 | return 0; | ||
2065 | } | 2050 | } |
2066 | 2051 | ||
2067 | static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2052 | static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2165,15 +2150,9 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode) | |||
2165 | 2150 | ||
2166 | static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2151 | static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2167 | { | 2152 | { |
2168 | static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; | 2153 | static const char * const texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; |
2169 | 2154 | ||
2170 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2155 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
2171 | uinfo->count = 1; | ||
2172 | uinfo->value.enumerated.items = 3; | ||
2173 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2174 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2175 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2176 | return 0; | ||
2177 | } | 2156 | } |
2178 | 2157 | ||
2179 | static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2158 | static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2250,15 +2229,9 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode) | |||
2250 | 2229 | ||
2251 | static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2230 | static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2252 | { | 2231 | { |
2253 | static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; | 2232 | static const char * const texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; |
2254 | 2233 | ||
2255 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2234 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
2256 | uinfo->count = 1; | ||
2257 | uinfo->value.enumerated.items = 3; | ||
2258 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2259 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2260 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2261 | return 0; | ||
2262 | } | 2235 | } |
2263 | 2236 | ||
2264 | static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2237 | static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2335,15 +2308,9 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode) | |||
2335 | 2308 | ||
2336 | static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2309 | static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2337 | { | 2310 | { |
2338 | static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; | 2311 | static const char * const texts[] = {"0 dB", "-6 dB", "-12 dB"}; |
2339 | 2312 | ||
2340 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2313 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
2341 | uinfo->count = 1; | ||
2342 | uinfo->value.enumerated.items = 3; | ||
2343 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2344 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2345 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2346 | return 0; | ||
2347 | } | 2314 | } |
2348 | 2315 | ||
2349 | static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2316 | static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2439,31 +2406,28 @@ static int hdsp_set_pref_sync_ref(struct hdsp *hdsp, int pref) | |||
2439 | 2406 | ||
2440 | static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2407 | static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2441 | { | 2408 | { |
2442 | static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; | 2409 | static const char * const texts[] = { |
2410 | "Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" | ||
2411 | }; | ||
2443 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2412 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2444 | 2413 | int num_items; | |
2445 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
2446 | uinfo->count = 1; | ||
2447 | 2414 | ||
2448 | switch (hdsp->io_type) { | 2415 | switch (hdsp->io_type) { |
2449 | case Digiface: | 2416 | case Digiface: |
2450 | case H9652: | 2417 | case H9652: |
2451 | uinfo->value.enumerated.items = 6; | 2418 | num_items = 6; |
2452 | break; | 2419 | break; |
2453 | case Multiface: | 2420 | case Multiface: |
2454 | uinfo->value.enumerated.items = 4; | 2421 | num_items = 4; |
2455 | break; | 2422 | break; |
2456 | case H9632: | 2423 | case H9632: |
2457 | uinfo->value.enumerated.items = 3; | 2424 | num_items = 3; |
2458 | break; | 2425 | break; |
2459 | default: | 2426 | default: |
2460 | return -EINVAL; | 2427 | return -EINVAL; |
2461 | } | 2428 | } |
2462 | 2429 | ||
2463 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 2430 | return snd_ctl_enum_info(uinfo, 1, num_items, texts); |
2464 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2465 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2466 | return 0; | ||
2467 | } | 2431 | } |
2468 | 2432 | ||
2469 | static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2433 | static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2543,15 +2507,11 @@ static int hdsp_autosync_ref(struct hdsp *hdsp) | |||
2543 | 2507 | ||
2544 | static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2508 | static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2545 | { | 2509 | { |
2546 | static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; | 2510 | static const char * const texts[] = { |
2511 | "Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" | ||
2512 | }; | ||
2547 | 2513 | ||
2548 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2514 | return snd_ctl_enum_info(uinfo, 1, 7, texts); |
2549 | uinfo->count = 1; | ||
2550 | uinfo->value.enumerated.items = 7; | ||
2551 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2552 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2553 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2554 | return 0; | ||
2555 | } | 2515 | } |
2556 | 2516 | ||
2557 | static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2517 | static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2738,14 +2698,9 @@ static int snd_hdsp_put_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
2738 | 2698 | ||
2739 | static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2699 | static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2740 | { | 2700 | { |
2741 | static char *texts[] = {"No Lock", "Lock", "Sync" }; | 2701 | static const char * const texts[] = {"No Lock", "Lock", "Sync" }; |
2742 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2702 | |
2743 | uinfo->count = 1; | 2703 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
2744 | uinfo->value.enumerated.items = 3; | ||
2745 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2746 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2747 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2748 | return 0; | ||
2749 | } | 2704 | } |
2750 | 2705 | ||
2751 | static int hdsp_wc_sync_check(struct hdsp *hdsp) | 2706 | static int hdsp_wc_sync_check(struct hdsp *hdsp) |
@@ -3101,15 +3056,11 @@ static int snd_hdsp_put_rpm_input12(struct snd_kcontrol *kcontrol, struct snd_ct | |||
3101 | 3056 | ||
3102 | static int snd_hdsp_info_rpm_input(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 3057 | static int snd_hdsp_info_rpm_input(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
3103 | { | 3058 | { |
3104 | static char *texts[] = {"Phono +6dB", "Phono 0dB", "Phono -6dB", "Line 0dB", "Line -6dB"}; | 3059 | static const char * const texts[] = { |
3060 | "Phono +6dB", "Phono 0dB", "Phono -6dB", "Line 0dB", "Line -6dB" | ||
3061 | }; | ||
3105 | 3062 | ||
3106 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 3063 | return snd_ctl_enum_info(uinfo, 1, 5, texts); |
3107 | uinfo->count = 1; | ||
3108 | uinfo->value.enumerated.items = 5; | ||
3109 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
3110 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
3111 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
3112 | return 0; | ||
3113 | } | 3064 | } |
3114 | 3065 | ||
3115 | 3066 | ||
@@ -3234,15 +3185,9 @@ static int snd_hdsp_put_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl | |||
3234 | 3185 | ||
3235 | static int snd_hdsp_info_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 3186 | static int snd_hdsp_info_rpm_bypass(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
3236 | { | 3187 | { |
3237 | static char *texts[] = {"On", "Off"}; | 3188 | static const char * const texts[] = {"On", "Off"}; |
3238 | 3189 | ||
3239 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 3190 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
3240 | uinfo->count = 1; | ||
3241 | uinfo->value.enumerated.items = 2; | ||
3242 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
3243 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
3244 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
3245 | return 0; | ||
3246 | } | 3191 | } |
3247 | 3192 | ||
3248 | 3193 | ||
@@ -3291,15 +3236,9 @@ static int snd_hdsp_put_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd | |||
3291 | 3236 | ||
3292 | static int snd_hdsp_info_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 3237 | static int snd_hdsp_info_rpm_disconnect(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
3293 | { | 3238 | { |
3294 | static char *texts[] = {"On", "Off"}; | 3239 | static const char * const texts[] = {"On", "Off"}; |
3295 | 3240 | ||
3296 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 3241 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
3297 | uinfo->count = 1; | ||
3298 | uinfo->value.enumerated.items = 2; | ||
3299 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
3300 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
3301 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
3302 | return 0; | ||
3303 | } | 3242 | } |
3304 | 3243 | ||
3305 | static struct snd_kcontrol_new snd_hdsp_rpm_controls[] = { | 3244 | static struct snd_kcontrol_new snd_hdsp_rpm_controls[] = { |