greybus: db3-platform: get rid of redundant gpio tests

In apb_ctrl_get_devtree_data(), the value returned by
of_get_named_gpio() has a redundant test for a negative
return value.  GPIO numbers are non-negative, so this
test is redundant--testing gpio_is_valid() is sufficient.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Alex Elder 2015-10-22 13:03:26 -05:00 committed by Greg Kroah-Hartman
parent ed8fbc2d56
commit 76be20a2f3
1 changed files with 5 additions and 10 deletions

View File

@ -189,35 +189,30 @@ static int apb_ctrl_get_devtree_data(struct device *dev,
/* fetch control signals */ /* fetch control signals */
apb_data->ctrl.wake_detect = of_get_named_gpio(np, "wake-detect-gpios", 0); apb_data->ctrl.wake_detect = of_get_named_gpio(np, "wake-detect-gpios", 0);
if (apb_data->ctrl.wake_detect < 0 || if (!gpio_is_valid(apb_data->ctrl.wake_detect)) {
!gpio_is_valid(apb_data->ctrl.wake_detect)) {
dev_err(dev, "failed to get wake detect gpio\n"); dev_err(dev, "failed to get wake detect gpio\n");
return apb_data->ctrl.wake_detect; return apb_data->ctrl.wake_detect;
} }
apb_data->ctrl.reset = of_get_named_gpio(np, "reset-gpios", 0); apb_data->ctrl.reset = of_get_named_gpio(np, "reset-gpios", 0);
if (apb_data->ctrl.reset < 0 || if (!gpio_is_valid(apb_data->ctrl.reset)) {
!gpio_is_valid(apb_data->ctrl.reset)) {
dev_err(dev, "failed to get reset gpio\n"); dev_err(dev, "failed to get reset gpio\n");
return apb_data->ctrl.reset; return apb_data->ctrl.reset;
} }
apb_data->ctrl.boot_ret = of_get_named_gpio(np, "boot-ret-gpios", 0); apb_data->ctrl.boot_ret = of_get_named_gpio(np, "boot-ret-gpios", 0);
if (apb_data->ctrl.boot_ret < 0 || if (!gpio_is_valid(apb_data->ctrl.boot_ret)) {
!gpio_is_valid(apb_data->ctrl.boot_ret)) {
dev_err(dev, "failed to get boot retention gpio\n"); dev_err(dev, "failed to get boot retention gpio\n");
return apb_data->ctrl.boot_ret; return apb_data->ctrl.boot_ret;
} }
/* It's not mandatory to support power management interface */ /* It's not mandatory to support power management interface */
apb_data->ctrl.pwroff = of_get_named_gpio(np, "pwr-off-gpios", 0); apb_data->ctrl.pwroff = of_get_named_gpio(np, "pwr-off-gpios", 0);
if (apb_data->ctrl.pwroff < 0 || if (!gpio_is_valid(apb_data->ctrl.pwroff))
!gpio_is_valid(apb_data->ctrl.pwroff))
dev_info(dev, "failed to get power off gpio\n"); dev_info(dev, "failed to get power off gpio\n");
apb_data->ctrl.pwrdn = of_get_named_gpio(np, "pwr-down-gpios", 0); apb_data->ctrl.pwrdn = of_get_named_gpio(np, "pwr-down-gpios", 0);
if (apb_data->ctrl.pwrdn < 0 || if (!gpio_is_valid(apb_data->ctrl.pwrdn))
!gpio_is_valid(apb_data->ctrl.pwrdn))
dev_info(dev, "failed to get power down gpio\n"); dev_info(dev, "failed to get power down gpio\n");
/* Regulators are optional, as we may have fixed supply coming in */ /* Regulators are optional, as we may have fixed supply coming in */