From c3001644d7f193d40c920463ccd730334154f0d0 Mon Sep 17 00:00:00 2001 From: liuyc20 Date: Thu, 27 Jun 2019 17:03:35 +0800 Subject: [PATCH] vl53l1: fix get signal gpio value way pwren-gpio only use signal gpio to control. so it is better to use (of_get_named_gpio) API to get. API(of_property_read_u32_array) was used for getting mutil value. Change-Id: I7a8ea686e9f8dced4e39a6c3cb8991cfc39e4418 Signed-off-by: liuyc20 Reviewed-on: https://gerrit.mot.com/1377674 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiaojun Ji Reviewed-by: Wei Wei Reviewed-by: Huosheng Liao Reviewed-by: Dawei Wang Submit-Approved: Jira Key --- drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c b/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c index 79025a0ddc9e..348189376850 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c @@ -389,12 +389,10 @@ static int stmvl53l1_parse_tree(struct device *dev, struct i2c_data *i2c_data) if (IS_ERR(i2c_data->vdd) || i2c_data->vdd == NULL) { i2c_data->vdd = NULL; /* try gpio */ - rc = of_property_read_u32_array(dev->of_node, - "pwren-gpio", &i2c_data->pwren_gpio, 1); - if (rc) { + i2c_data->pwren_gpio = of_get_named_gpio(dev->of_node, "pwren-gpio", 0); + if (i2c_data->pwren_gpio < 0) { i2c_data->pwren_gpio = -1; - vl53l1_wanrmsg( - "no regulator, nor power gpio => power ctrl disabled"); + vl53l1_errmsg(" get i2c_data->pwren_gpio failed\n"); } }