Commit 7a5da030 authored by Jingoo Han's avatar Jingoo Han Committed by Wim Van Sebroeck

watchdog: wm831x_wdt: use devm_gpio_request_one()

Use devm_gpio_request_one() to make cleanup paths simpler.
Also, GPIOF_DIR_OUT | GPIOF_INIT_LOW is replaced with
GPIOF_OUT_INIT_LOW.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent d3a33a95
...@@ -247,9 +247,10 @@ static int wm831x_wdt_probe(struct platform_device *pdev) ...@@ -247,9 +247,10 @@ static int wm831x_wdt_probe(struct platform_device *pdev)
reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT; reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT;
if (pdata->update_gpio) { if (pdata->update_gpio) {
ret = gpio_request_one(pdata->update_gpio, ret = devm_gpio_request_one(&pdev->dev,
GPIOF_DIR_OUT | GPIOF_INIT_LOW, pdata->update_gpio,
"Watchdog update"); GPIOF_OUT_INIT_LOW,
"Watchdog update");
if (ret < 0) { if (ret < 0) {
dev_err(wm831x->dev, dev_err(wm831x->dev,
"Failed to request update GPIO: %d\n", "Failed to request update GPIO: %d\n",
...@@ -270,7 +271,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) ...@@ -270,7 +271,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev)
} else { } else {
dev_err(wm831x->dev, dev_err(wm831x->dev,
"Failed to unlock security key: %d\n", ret); "Failed to unlock security key: %d\n", ret);
goto err_gpio; goto err;
} }
} }
...@@ -278,16 +279,13 @@ static int wm831x_wdt_probe(struct platform_device *pdev) ...@@ -278,16 +279,13 @@ static int wm831x_wdt_probe(struct platform_device *pdev)
if (ret != 0) { if (ret != 0) {
dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n", dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n",
ret); ret);
goto err_gpio; goto err;
} }
dev_set_drvdata(&pdev->dev, driver_data); dev_set_drvdata(&pdev->dev, driver_data);
return 0; return 0;
err_gpio:
if (driver_data->update_gpio)
gpio_free(driver_data->update_gpio);
err: err:
return ret; return ret;
} }
...@@ -298,9 +296,6 @@ static int wm831x_wdt_remove(struct platform_device *pdev) ...@@ -298,9 +296,6 @@ static int wm831x_wdt_remove(struct platform_device *pdev)
watchdog_unregister_device(&driver_data->wdt); watchdog_unregister_device(&driver_data->wdt);
if (driver_data->update_gpio)
gpio_free(driver_data->update_gpio);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment