watchdog: mtx1-wdt: use devm_gpio_request_one()
Subsystems (2)
PATCH 1/2 watchdog: mtx1-wdt: use devm_gpio_request_one()
Use devm_gpio_request_one() to make cleanup paths simpler.
Signed-off-by Jingoo Han <[email protected]>
--- drivers/watchdog/mtx-1_wdt.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/watchdog/mtx-1_wdt.c +1 -2
@@ -209,7 +209,7 @@ static int mtx1_wdt_probe(struct platform_device *pdev)int ret; mtx1_wdt_device.gpio = pdev->resource[0 ].start; - ret =gpio_request_one (mtx1_wdt_device.gpio, + ret =devm_gpio_request_one (&pdev->dev, mtx1_wdt_device.gpio,GPIOF_OUT_INIT_HIGH ,"mtx1-wdt" );if (ret <0 ) {dev_err (&pdev->dev,"failed to request gpio" );
@@ -241,7 +241,6 @@ static int mtx1_wdt_remove(struct platform_device *pdev)wait_for_completion (&mtx1_wdt_device.stop); } -gpio_free (mtx1_wdt_device.gpio);misc_deregister (&mtx1_wdt_misc);return 0 ; }
Signature · 1 line
1.7.2.5
PATCH 2/2 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 Jingoo Han <[email protected]>
--- drivers/watchdog/wm831x_wdt.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-)
drivers/watchdog/wm831x_wdt.c +6 -11
@@ -247,9 +247,10 @@ static int wm831x_wdt_probe(struct platform_device *pdev) reg |= pdata->software <<WM831X_WDOG_RST_SRC_SHIFT ;if (pdata->update_gpio) { - ret =gpio_request_one (pdata->update_gpio, -GPIOF_DIR_OUT |GPIOF_INIT_LOW , -"Watchdog update" ); + ret =devm_gpio_request_one (&pdev->dev, + pdata->update_gpio, +GPIOF_OUT_INIT_LOW , +"Watchdog update" );if (ret <0 ) { dev_err(wm831x->dev, "Failed to request update GPIO: %d\n",
@@ -270,7 +271,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) }else {dev_err (wm831x->dev,"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)if (ret !=0 ) {dev_err (wm831x->dev,"watchdog_register_device() failed: %d\n" , ret); - goto err_gpio; + goto err; }dev_set_drvdata (&pdev->dev, driver_data);return 0 ; -err_gpio: -if (driver_data->update_gpio) -gpio_free (driver_data->update_gpio); err:return ret; }
@@ -298,9 +296,6 @@ static int wm831x_wdt_remove(struct platform_device *pdev)watchdog_unregister_device (&driver_data->wdt); -if (driver_data->update_gpio) -gpio_free (driver_data->update_gpio); -return 0 ; }
Signature · 1 line
1.7.2.5