Skip to contentSkip to conversation

iio: proximity: sx9500: Use devm_gpiod_get()

PATCH In review Andy Shevchenko 2 participants 2 messages Jun 10, 2017 – Jun 11, 2017 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: proximity: sx9500: Use devm_gpiod_get()

Since index is always 0 replace devm_gpiod_get_index() by devm_gpiod_get().

---
 drivers/iio/proximity/sx9500.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/proximity/sx9500.c +1 -2
index 9ea147f1a50d..f42b3a1c75ff 100644
@@ -878,8 +878,7 @@ static void sx9500_gpio_probe(struct i2c_client *client,
 
 	dev = &client->dev;
 
-	data->gpiod_rst = devm_gpiod_get_index(dev, SX9500_GPIO_RESET,
-					       0, GPIOD_OUT_HIGH);
+	data->gpiod_rst = devm_gpiod_get(dev, SX9500_GPIO_RESET, GPIOD_OUT_HIGH);
 	if (IS_ERR(data->gpiod_rst)) {
 		dev_warn(dev, "gpio get reset pin failed\n");
 		data->gpiod_rst = NULL;
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 3 lines · On Sat, 10 Jun 2017 22:08:21 +0300 Andy Shevchenko…

Since index is always 0 replace devm_gpiod_get_index() by devm_gpiod_get().

Hi Andy,

Good little tidy up. Looks like a classic use for a coccinelle patch if you have time to take it further. Sort of thing that will sneak in within future drivers so good to tidy up all cases automatically ;)

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 18 lines
---
 drivers/iio/proximity/sx9500.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/proximity/sx9500.c +1 -2
index 9ea147f1a50d..f42b3a1c75ff 100644
@@ -878,8 +878,7 @@ static void sx9500_gpio_probe(struct i2c_client *client,
 
 	dev = &client->dev;
 
-	data->gpiod_rst = devm_gpiod_get_index(dev, SX9500_GPIO_RESET,
-					       0, GPIOD_OUT_HIGH);
+	data->gpiod_rst = devm_gpiod_get(dev, SX9500_GPIO_RESET, GPIOD_OUT_HIGH);
 	if (IS_ERR(data->gpiod_rst)) {
 		dev_warn(dev, "gpio get reset pin failed\n");
 		data->gpiod_rst = NULL;