Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tegra+wm8903: simplify gpio tests in widget callbacks

By the time any widget callbacks could be called, if the GPIO ID they
will manipulate is valid, it must have already been requested, or the
card would have failed to probe or initialize. So, testing for GPIO
validity is equivalent to testing whether the GPIO was successfully
requested at this point in the code. Making this change will allow later
patches to remove the gpio_requested variable.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Stephen Warren and committed by
Mark Brown
14df415a 9f6328d9

+2 -2
+2 -2
sound/soc/tegra/tegra_wm8903.c
··· 153 153 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 154 154 struct tegra_wm8903_platform_data *pdata = &machine->pdata; 155 155 156 - if (!(machine->gpio_requested & GPIO_SPKR_EN)) 156 + if (!gpio_is_valid(pdata->gpio_spkr_en)) 157 157 return 0; 158 158 159 159 gpio_set_value_cansleep(pdata->gpio_spkr_en, ··· 170 170 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 171 171 struct tegra_wm8903_platform_data *pdata = &machine->pdata; 172 172 173 - if (!(machine->gpio_requested & GPIO_HP_MUTE)) 173 + if (!gpio_is_valid(pdata->gpio_hp_mute)) 174 174 return 0; 175 175 176 176 gpio_set_value_cansleep(pdata->gpio_hp_mute,