Skip to content

Commit

Permalink
watchdog: mt7621: switch to using managed devm_watchdog_register_devi…
Browse files Browse the repository at this point in the history
…ce()

This does the necessary cleanup on driver unload automatically.

Signed-off-by: André Draszik <git@andred.net>
Cc: linux-watchdog@vger.kernel.org
Cc: John Crispin <john@phrozen.org>
Reviewed-by: Guenter Roeck <Linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
André Draszik authored and Wim Van Sebroeck committed Jan 21, 2018
1 parent 392d39a commit 1d2e5eb
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions drivers/watchdog/mt7621_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ static struct watchdog_device mt7621_wdt_dev = {
static int mt7621_wdt_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mt7621_wdt_base = devm_ioremap_resource(&pdev->dev, res);
Expand Down Expand Up @@ -164,16 +163,7 @@ static int mt7621_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &mt7621_wdt_dev.status);
}

ret = watchdog_register_device(&mt7621_wdt_dev);

return 0;
}

static int mt7621_wdt_remove(struct platform_device *pdev)
{
watchdog_unregister_device(&mt7621_wdt_dev);

return 0;
return devm_watchdog_register_device(&pdev->dev, &mt7621_wdt_dev);
}

static void mt7621_wdt_shutdown(struct platform_device *pdev)
Expand All @@ -189,7 +179,6 @@ MODULE_DEVICE_TABLE(of, mt7621_wdt_match);

static struct platform_driver mt7621_wdt_driver = {
.probe = mt7621_wdt_probe,
.remove = mt7621_wdt_remove,
.shutdown = mt7621_wdt_shutdown,
.driver = {
.name = KBUILD_MODNAME,
Expand Down

0 comments on commit 1d2e5eb

Please sign in to comment.