From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754191AbbDHNmK (ORCPT ); Wed, 8 Apr 2015 09:42:10 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:17591 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753919AbbDHNmH (ORCPT ); Wed, 8 Apr 2015 09:42:07 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Wed, 08 Apr 2015 06:39:28 -0700 From: Laxman Dewangan To: , CC: , Laxman Dewangan Subject: [PATCH] regulator: max8973: get rid of extra variable for gpio validity Date: Wed, 8 Apr 2015 19:08:00 +0530 Message-ID: <1428500280-3421-1-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 1.8.1.5 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To find that dvs-gpio is valid or not, gpio API gpio_is_valid() can be directly used instead of intermediate variable. Removing the extra variable and using the gpio_is_valid(). Signed-off-by: Laxman Dewangan --- drivers/regulator/max8973-regulator.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index c3d55c2..1890808 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -100,7 +100,6 @@ struct max8973_chip { int curr_vout_val[MAX8973_MAX_VOUT_REG]; int curr_vout_reg; int curr_gpio_val; - bool valid_dvs_gpio; struct regulator_ops ops; }; @@ -174,7 +173,7 @@ static int max8973_dcdc_set_voltage_sel(struct regulator_dev *rdev, * If gpios are available to select the VOUT register then least * recently used register for new configuration. */ - if (max->valid_dvs_gpio) + if (gpio_is_valid(max->dvs_gpio)) found = find_voltage_set_register(max, vsel, &vout_reg, &gpio_val); @@ -191,7 +190,7 @@ static int max8973_dcdc_set_voltage_sel(struct regulator_dev *rdev, } /* Select proper VOUT register vio gpios */ - if (max->valid_dvs_gpio) { + if (gpio_is_valid(max->dvs_gpio)) { gpio_set_value_cansleep(max->dvs_gpio, gpio_val & 0x1); max->curr_gpio_val = gpio_val; } @@ -434,7 +433,6 @@ static int max8973_probe(struct i2c_client *client, max->dvs_gpio, ret); return ret; } - max->valid_dvs_gpio = true; /* * Initialize the lru index with vout_reg id @@ -444,8 +442,6 @@ static int max8973_probe(struct i2c_client *client, max->lru_index[i] = i; max->lru_index[0] = max->curr_vout_reg; max->lru_index[max->curr_vout_reg] = 0; - } else { - max->valid_dvs_gpio = false; } if (pdata) { -- 1.8.1.5