diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-11 17:40:31 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-12 08:44:47 +0100 |
commit | bc759721fb44bc07e4f82445cc378a9d2724651f (patch) | |
tree | 6f096f37647a91f4cb5f6c4ceed9d07e08822682 /sound/pci/hda/hda_hwdep.c | |
parent | 09b70e8509862debff5a033052f8adbd7402fa4e (diff) |
ALSA: hda - Add snd_hda_get_int_hint() helper function
It'll be used in hda_generic.c, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_hwdep.c')
-rw-r--r-- | sound/pci/hda/hda_hwdep.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 2dddf7fbebcc..ce67608734b5 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -644,6 +644,26 @@ int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) } EXPORT_SYMBOL_HDA(snd_hda_get_bool_hint); +int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp) +{ + const char *p; + unsigned long val; + int ret; + + mutex_lock(&codec->user_mutex); + p = snd_hda_get_hint(codec, key); + if (!p) + ret = -ENOENT; + else if (strict_strtoul(p, 0, &val)) + ret = -EINVAL; + else { + *valp = val; + ret = 0; + } + mutex_unlock(&codec->user_mutex); + return ret; +} +EXPORT_SYMBOL_HDA(snd_hda_get_int_hint); #endif /* CONFIG_SND_HDA_RECONFIG */ #ifdef CONFIG_SND_HDA_PATCH_LOADER |