diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-12-30 22:01:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-02 08:08:39 -0500 |
commit | 385bd9379babaf0982c76e4c073d928e830df6ad (patch) | |
tree | fac1e175101fe097bd5c2f2ba98bbb62b44184ce /sound/soc/codecs | |
parent | 3c3f51f6a37ff9c3f8ffef2ab600d1482a9f30c8 (diff) |
ASoC: Fix return value of wm8903_gpio_direction_in() and wm8903_gpio_direction_out()
We can't just pass back the return value of snd_soc_update_bits() as it
will be 1 if a bit changed rather than zero.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/wm8903.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index d88b727d7f99..c91fb2f99c13 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1777,13 +1777,18 @@ static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset) | |||
1777 | struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); | 1777 | struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); |
1778 | struct snd_soc_codec *codec = wm8903->codec; | 1778 | struct snd_soc_codec *codec = wm8903->codec; |
1779 | unsigned int mask, val; | 1779 | unsigned int mask, val; |
1780 | int ret; | ||
1780 | 1781 | ||
1781 | mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK; | 1782 | mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK; |
1782 | val = (WM8903_GPn_FN_GPIO_INPUT << WM8903_GP1_FN_SHIFT) | | 1783 | val = (WM8903_GPn_FN_GPIO_INPUT << WM8903_GP1_FN_SHIFT) | |
1783 | WM8903_GP1_DIR; | 1784 | WM8903_GP1_DIR; |
1784 | 1785 | ||
1785 | return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, | 1786 | ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, |
1786 | mask, val); | 1787 | mask, val); |
1788 | if (ret < 0) | ||
1789 | return ret; | ||
1790 | |||
1791 | return 0; | ||
1787 | } | 1792 | } |
1788 | 1793 | ||
1789 | static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) | 1794 | static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) |
@@ -1803,13 +1808,18 @@ static int wm8903_gpio_direction_out(struct gpio_chip *chip, | |||
1803 | struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); | 1808 | struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); |
1804 | struct snd_soc_codec *codec = wm8903->codec; | 1809 | struct snd_soc_codec *codec = wm8903->codec; |
1805 | unsigned int mask, val; | 1810 | unsigned int mask, val; |
1811 | int ret; | ||
1806 | 1812 | ||
1807 | mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK; | 1813 | mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK; |
1808 | val = (WM8903_GPn_FN_GPIO_OUTPUT << WM8903_GP1_FN_SHIFT) | | 1814 | val = (WM8903_GPn_FN_GPIO_OUTPUT << WM8903_GP1_FN_SHIFT) | |
1809 | (value << WM8903_GP2_LVL_SHIFT); | 1815 | (value << WM8903_GP2_LVL_SHIFT); |
1810 | 1816 | ||
1811 | return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, | 1817 | ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, |
1812 | mask, val); | 1818 | mask, val); |
1819 | if (ret < 0) | ||
1820 | return ret; | ||
1821 | |||
1822 | return 0; | ||
1813 | } | 1823 | } |
1814 | 1824 | ||
1815 | static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 1825 | static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |