aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-27 07:53:24 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-27 07:53:24 -0500
commit014c41fce1bd5cec381e70fc6f58fdfc96cdaf69 (patch)
tree148d95c1f27acaee25991e6b1cb9e606d91f899d /sound/pci
parentb82855a0d76ebda1cc14c00040560d77bfa042ce (diff)
ALSA: hda - Use strict_strtoul()
Rewrite the codes to use strict_strtoul() instead of simple_strtoul(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_hwdep.c7
-rw-r--r--sound/pci/hda/patch_sigmatel.c48
2 files changed, 31 insertions, 24 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 40ccb419b6e9..b36919c0d363 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -293,8 +293,11 @@ static ssize_t type##_store(struct device *dev, \
293{ \ 293{ \
294 struct snd_hwdep *hwdep = dev_get_drvdata(dev); \ 294 struct snd_hwdep *hwdep = dev_get_drvdata(dev); \
295 struct hda_codec *codec = hwdep->private_data; \ 295 struct hda_codec *codec = hwdep->private_data; \
296 char *after; \ 296 unsigned long val; \
297 codec->type = simple_strtoul(buf, &after, 0); \ 297 int err = strict_strtoul(buf, 0, &val); \
298 if (err < 0) \
299 return err; \
300 codec->type = val; \
298 return count; \ 301 return count; \
299} 302}
300 303
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index dc1d9f124578..e28c810bc00c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4159,43 +4159,47 @@ static void stac92xx_power_down(struct hda_codec *codec)
4159static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 4159static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4160 int enable); 4160 int enable);
4161 4161
4162static inline int get_int_hint(struct hda_codec *codec, const char *key,
4163 int *valp)
4164{
4165 const char *p;
4166 p = snd_hda_get_hint(codec, key);
4167 if (p) {
4168 unsigned long val;
4169 if (!strict_strtoul(p, 0, &val)) {
4170 *valp = val;
4171 return 1;
4172 }
4173 }
4174 return 0;
4175}
4176
4162/* override some hints from the hwdep entry */ 4177/* override some hints from the hwdep entry */
4163static void stac_store_hints(struct hda_codec *codec) 4178static void stac_store_hints(struct hda_codec *codec)
4164{ 4179{
4165 struct sigmatel_spec *spec = codec->spec; 4180 struct sigmatel_spec *spec = codec->spec;
4166 const char *p;
4167 int val; 4181 int val;
4168 4182
4169 val = snd_hda_get_bool_hint(codec, "hp_detect"); 4183 val = snd_hda_get_bool_hint(codec, "hp_detect");
4170 if (val >= 0) 4184 if (val >= 0)
4171 spec->hp_detect = val; 4185 spec->hp_detect = val;
4172 p = snd_hda_get_hint(codec, "gpio_mask"); 4186 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
4173 if (p) {
4174 spec->gpio_mask = simple_strtoul(p, NULL, 0);
4175 spec->eapd_mask = spec->gpio_dir = spec->gpio_data = 4187 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
4176 spec->gpio_mask; 4188 spec->gpio_mask;
4177 } 4189 }
4178 p = snd_hda_get_hint(codec, "gpio_dir"); 4190 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
4179 if (p) 4191 spec->gpio_mask &= spec->gpio_mask;
4180 spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4192 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
4181 p = snd_hda_get_hint(codec, "gpio_data"); 4193 spec->gpio_dir &= spec->gpio_mask;
4182 if (p) 4194 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
4183 spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4195 spec->eapd_mask &= spec->gpio_mask;
4184 p = snd_hda_get_hint(codec, "eapd_mask"); 4196 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
4185 if (p) 4197 spec->gpio_mute &= spec->gpio_mask;
4186 spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
4187 p = snd_hda_get_hint(codec, "gpio_mute");
4188 if (p)
4189 spec->gpio_mute = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
4190 val = snd_hda_get_bool_hint(codec, "eapd_switch"); 4198 val = snd_hda_get_bool_hint(codec, "eapd_switch");
4191 if (val >= 0) 4199 if (val >= 0)
4192 spec->eapd_switch = val; 4200 spec->eapd_switch = val;
4193 p = snd_hda_get_hint(codec, "gpio_led_polarity"); 4201 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
4194 if (p) 4202 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4195 spec->gpio_led_polarity = simple_strtoul(p, NULL, 0);
4196 p = snd_hda_get_hint(codec, "gpio_led");
4197 if (p) {
4198 spec->gpio_led = simple_strtoul(p, NULL, 0);
4199 spec->gpio_mask |= spec->gpio_led; 4203 spec->gpio_mask |= spec->gpio_led;
4200 spec->gpio_dir |= spec->gpio_led; 4204 spec->gpio_dir |= spec->gpio_led;
4201 if (spec->gpio_led_polarity) 4205 if (spec->gpio_led_polarity)