Skip to content

Commit

Permalink
ASoC: tegra+wm8903: simplify gpio tests in widget callbacks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Warren authored and Mark Brown committed Jun 3, 2012
1 parent 9f6328d commit 14df415
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/tegra/tegra_wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static int tegra_wm8903_event_int_spk(struct snd_soc_dapm_widget *w,
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
struct tegra_wm8903_platform_data *pdata = &machine->pdata;

if (!(machine->gpio_requested & GPIO_SPKR_EN))
if (!gpio_is_valid(pdata->gpio_spkr_en))
return 0;

gpio_set_value_cansleep(pdata->gpio_spkr_en,
Expand All @@ -170,7 +170,7 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w,
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
struct tegra_wm8903_platform_data *pdata = &machine->pdata;

if (!(machine->gpio_requested & GPIO_HP_MUTE))
if (!gpio_is_valid(pdata->gpio_hp_mute))
return 0;

gpio_set_value_cansleep(pdata->gpio_hp_mute,
Expand Down

0 comments on commit 14df415

Please sign in to comment.