提交 9f6cd98f 编写于 作者: U Uwe Kleine-König 提交者: Sebastian Reichel

power: reset: ltc2952: use _optional variant of devm_gpiod_get

devm_gpiod_get_optional returns NULL if devm_gpiod_get would return an
ENOENT error pointer.

There is no semantic change intended.
Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NSebastian Reichel <sre@kernel.org>
上级 a34c0a8b
...@@ -202,16 +202,15 @@ static int ltc2952_poweroff_init(struct platform_device *pdev) ...@@ -202,16 +202,15 @@ static int ltc2952_poweroff_init(struct platform_device *pdev)
return ret; return ret;
} }
data->gpio_trigger = devm_gpiod_get(&pdev->dev, "trigger", GPIOD_IN); data->gpio_trigger = devm_gpiod_get_optional(&pdev->dev, "trigger",
GPIOD_IN);
if (IS_ERR(data->gpio_trigger)) { if (IS_ERR(data->gpio_trigger)) {
/* /*
* It's not a problem if the trigger gpio isn't available, but * It's not a problem if the trigger gpio isn't available, but
* it is worth a warning if its use was defined in the device * it is worth a warning if its use was defined in the device
* tree. * tree.
*/ */
if (PTR_ERR(data->gpio_trigger) != -ENOENT) dev_err(&pdev->dev, "unable to claim gpio \"trigger\"\n");
dev_err(&pdev->dev,
"unable to claim gpio \"trigger\"\n");
data->gpio_trigger = NULL; data->gpio_trigger = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册