Skip to content

Commit e095882

Browse files
krzkchanwoochoi
authored andcommitted
extcon: ptn5150: Simplify getting vbus-gpios with flags
Instead of obtaining GPIO as input and configuring it right after to output-low, just use proper GPIOD_OUT_LOW flag. Code is smaller and simpler. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 45ce36f commit e095882

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎drivers/extcon/extcon-ptn5150.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,11 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c,
239239

240240
info->dev = &i2c->dev;
241241
info->i2c = i2c;
242-
info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_IN);
242+
info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_OUT_LOW);
243243
if (IS_ERR(info->vbus_gpiod)) {
244244
dev_err(dev, "failed to get VBUS GPIO\n");
245245
return PTR_ERR(info->vbus_gpiod);
246246
}
247-
ret = gpiod_direction_output(info->vbus_gpiod, 0);
248-
if (ret) {
249-
dev_err(dev, "failed to set VBUS GPIO direction\n");
250-
return -EINVAL;
251-
}
252247

253248
mutex_init(&info->mutex);
254249

0 commit comments

Comments
 (0)