Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dp: use flags argument of devm_gpiod_get to set direction

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Use this to simplify the driver. Furthermore this is one caller less
that stops us making the flags argument to gpiod_get*() mandatory.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -15
+2 -15
drivers/gpu/drm/msm/edp/edp_ctrl.c
··· 373 373 struct device *dev = &ctrl->pdev->dev; 374 374 int ret; 375 375 376 - ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd"); 376 + ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd", GPIOD_IN); 377 377 if (IS_ERR(ctrl->panel_hpd_gpio)) { 378 378 ret = PTR_ERR(ctrl->panel_hpd_gpio); 379 379 ctrl->panel_hpd_gpio = NULL; ··· 381 381 return ret; 382 382 } 383 383 384 - ret = gpiod_direction_input(ctrl->panel_hpd_gpio); 385 - if (ret) { 386 - pr_err("%s: Set direction for hpd failed, %d\n", __func__, ret); 387 - return ret; 388 - } 389 - 390 - ctrl->panel_en_gpio = devm_gpiod_get(dev, "panel-en"); 384 + ctrl->panel_en_gpio = devm_gpiod_get(dev, "panel-en", GPIOD_OUT_LOW); 391 385 if (IS_ERR(ctrl->panel_en_gpio)) { 392 386 ret = PTR_ERR(ctrl->panel_en_gpio); 393 387 ctrl->panel_en_gpio = NULL; 394 388 pr_err("%s: cannot get panel-en-gpios, %d\n", __func__, ret); 395 - return ret; 396 - } 397 - 398 - ret = gpiod_direction_output(ctrl->panel_en_gpio, 0); 399 - if (ret) { 400 - pr_err("%s: Set direction for panel_en failed, %d\n", 401 - __func__, ret); 402 389 return ret; 403 390 } 404 391