Message ID | 1433842982-26819-1-git-send-email-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | 26a5bd26499f |
Headers | show |
On 06/09/2015 06:43 PM, Uwe Kleine-König wrote: > 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. > > Furthermore there is devm_gpiod_get_optional which is designed to get > optional gpios. > > Simplify driver accordingly. Nice! Acked-by: Alexandre Courbot <acourbot@nvidia.com>
On Wed, Jun 10, 2015 at 11:25:25AM +0900, Alexandre Courbot wrote: > On 06/09/2015 06:43 PM, Uwe Kleine-König wrote: > >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. > > > >Furthermore there is devm_gpiod_get_optional which is designed to get > >optional gpios. > > > >Simplify driver accordingly. > > Nice! > > Acked-by: Alexandre Courbot <acourbot@nvidia.com> By the way, my tree based on 4.1-rc7 has all instances fixed and I sent out all required patches. So I'd say we can make the flags argument mandatory for 4.3. Best regards Uwe
On 06/10/2015 03:59 PM, Uwe Kleine-König wrote: > On Wed, Jun 10, 2015 at 11:25:25AM +0900, Alexandre Courbot wrote: >> On 06/09/2015 06:43 PM, Uwe Kleine-König wrote: >>> 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. >>> >>> Furthermore there is devm_gpiod_get_optional which is designed to get >>> optional gpios. >>> >>> Simplify driver accordingly. >> >> Nice! >> >> Acked-by: Alexandre Courbot <acourbot@nvidia.com> > By the way, my tree based on 4.1-rc7 has all instances fixed and I sent > out all required patches. So I'd say we can make the flags argument > mandatory for 4.3. Great, let's go for it then! Feel free to send a patch removing the hackish macros once things are clean in -next.
On Tue, Jun 9, 2015 at 11:43 AM, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote: > 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. > > Furthermore there is devm_gpiod_get_optional which is designed to get > optional gpios. > > Simplify driver accordingly. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
Hello, On Tue, Jun 09, 2015 at 11:43:02AM +0200, Uwe Kleine-König wrote: > 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. > > Furthermore there is devm_gpiod_get_optional which is designed to get > optional gpios. > > Simplify driver accordingly. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Same question as for the drm/msm/dp patch: I intend to make the flags parameter mandatory for 4.3. So if this patch doesn't make it in for 4.2-rc1 I'd like to take it as part of the respective gpio change via the gpio tree. What's your plan regarding this change? Best regards Uwe
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 7a0315855e90..0af8bed7ce1e 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -375,25 +375,17 @@ static int panel_probe(struct platform_device *pdev) dev_info(&pdev->dev, "found backlight\n"); } - panel_mod->enable_gpio = devm_gpiod_get(&pdev->dev, "enable"); + panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", + GPIOD_OUT_LOW); if (IS_ERR(panel_mod->enable_gpio)) { ret = PTR_ERR(panel_mod->enable_gpio); - if (ret != -ENOENT) { - dev_err(&pdev->dev, "failed to request enable GPIO\n"); - goto fail_backlight; - } - - /* Optional GPIO is not here, continue silently. */ - panel_mod->enable_gpio = NULL; - } else { - ret = gpiod_direction_output(panel_mod->enable_gpio, 0); - if (ret < 0) { - dev_err(&pdev->dev, "failed to setup GPIO\n"); - goto fail_backlight; - } - dev_info(&pdev->dev, "found enable GPIO\n"); + dev_err(&pdev->dev, "failed to request enable GPIO\n"); + goto fail_backlight; } + if (panel_mod->enable_gpio) + dev_info(&pdev->dev, "found enable GPIO\n"); + mod = &panel_mod->base; pdev->dev.platform_data = mod;
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. Furthermore there is devm_gpiod_get_optional which is designed to get optional gpios. Simplify driver accordingly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/gpu/drm/tilcdc/tilcdc_panel.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)