ctljack.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) ctljack.c (75b1a8f9d62e50f05d0e4e9f3c8bcde32527ffc1)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Helper functions for jack-detection kcontrols
4 *
5 * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
6 */
7
8#include <linux/kernel.h>

--- 21 unchanged lines hidden (view full) ---

30static int get_available_index(struct snd_card *card, const char *name)
31{
32 struct snd_ctl_elem_id sid;
33
34 memset(&sid, 0, sizeof(sid));
35
36 sid.index = 0;
37 sid.iface = SNDRV_CTL_ELEM_IFACE_CARD;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Helper functions for jack-detection kcontrols
4 *
5 * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
6 */
7
8#include <linux/kernel.h>

--- 21 unchanged lines hidden (view full) ---

30static int get_available_index(struct snd_card *card, const char *name)
31{
32 struct snd_ctl_elem_id sid;
33
34 memset(&sid, 0, sizeof(sid));
35
36 sid.index = 0;
37 sid.iface = SNDRV_CTL_ELEM_IFACE_CARD;
38 strlcpy(sid.name, name, sizeof(sid.name));
38 strscpy(sid.name, name, sizeof(sid.name));
39
40 while (snd_ctl_find_id(card, &sid)) {
41 sid.index++;
42 /* reset numid; otherwise snd_ctl_find_id() hits this again */
43 sid.numid = 0;
44 }
45
46 return sid.index;

--- 38 unchanged lines hidden ---
39
40 while (snd_ctl_find_id(card, &sid)) {
41 sid.index++;
42 /* reset numid; otherwise snd_ctl_find_id() hits this again */
43 sid.numid = 0;
44 }
45
46 return sid.index;

--- 38 unchanged lines hidden ---