gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
authorAxel Lin <axel.lin@ingics.com>
Mon, 11 Mar 2019 13:29:37 +0000 (21:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:26:27 +0000 (06:26 +0200)
commit6ebe03734361063f665fb3b2478406abedd8eb04
treed0dfe92d4cd830e7006e698252d8e0de34d85eda
parentb26f7e86d3cc0e8744cf198118e313911f20f1f6
gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input

commit c5bc6e526d3f217ed2cc3681d256dc4a2af4cc2b upstream.

Current code test wrong value so it does not verify if the written
data is correctly read back. Fix it.
Also make it return -EPERM if read value does not match written bit,
just like it done for adnp_gpio_direction_output().

Fixes: 5e969a401a01 ("gpio: Add Avionic Design N-bit GPIO expander support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpio-adnp.c