pinctrl: qcom-spmi-gpio: Fix input value report
authorIvan T. Ivanov <ivan.ivanov@linaro.org>
Thu, 9 Apr 2015 15:18:36 +0000 (18:18 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Apr 2015 12:51:45 +0000 (14:51 +0200)
Read input buffer when input is enabled, not when it is
disabled. Also fix interpretation of the pmic_gpio_read()
return code, negative value means an error.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c

index 4b21aac43216169bae6ff8308388cd4d686df066..e8b74c69222e57d5be78895c1573c417739731b7 100644 (file)
@@ -466,12 +466,13 @@ static void pmic_gpio_config_dbg_show(struct pinctrl_dev *pctldev,
                seq_puts(s, " ---");
        } else {
 
-               if (!pad->input_enabled) {
+               if (pad->input_enabled) {
                        ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS);
-                       if (!ret) {
-                               ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
-                               pad->out_value = ret;
-                       }
+                       if (ret < 0)
+                               return;
+
+                       ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
+                       pad->out_value = ret;
                }
 
                seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in");