| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Kontron PLD watchdog driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010-2013 Kontron Europe GmbH |
|---|
| 5 | 6 | * Author: Michael Brunner <michael.brunner@kontron.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License 2 as published |
|---|
| 9 | | - * by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 7 | * |
|---|
| 16 | 8 | * Note: From the PLD watchdog point of view timeout and pretimeout are |
|---|
| 17 | 9 | * defined differently than in the kernel. |
|---|
| .. | .. |
|---|
| 467 | 459 | KEMPLD_WDT_CFG_GLOBAL_LOCK)) { |
|---|
| 468 | 460 | if (!nowayout) |
|---|
| 469 | 461 | dev_warn(dev, |
|---|
| 470 | | - "Forcing nowayout - watchdog lock enabled!\n"); |
|---|
| 462 | + "Forcing nowayout - watchdog lock enabled!\n"); |
|---|
| 471 | 463 | nowayout = true; |
|---|
| 472 | 464 | } |
|---|
| 473 | 465 | |
|---|
| .. | .. |
|---|
| 492 | 484 | } |
|---|
| 493 | 485 | |
|---|
| 494 | 486 | platform_set_drvdata(pdev, wdt_data); |
|---|
| 495 | | - ret = watchdog_register_device(wdd); |
|---|
| 487 | + watchdog_stop_on_reboot(wdd); |
|---|
| 488 | + watchdog_stop_on_unregister(wdd); |
|---|
| 489 | + ret = devm_watchdog_register_device(dev, wdd); |
|---|
| 496 | 490 | if (ret) |
|---|
| 497 | 491 | return ret; |
|---|
| 498 | 492 | |
|---|
| 499 | 493 | dev_info(dev, "Watchdog registered with %ds timeout\n", wdd->timeout); |
|---|
| 500 | 494 | |
|---|
| 501 | 495 | return 0; |
|---|
| 502 | | -} |
|---|
| 503 | | - |
|---|
| 504 | | -static void kempld_wdt_shutdown(struct platform_device *pdev) |
|---|
| 505 | | -{ |
|---|
| 506 | | - struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); |
|---|
| 507 | | - |
|---|
| 508 | | - kempld_wdt_stop(&wdt_data->wdd); |
|---|
| 509 | | -} |
|---|
| 510 | | - |
|---|
| 511 | | -static int kempld_wdt_remove(struct platform_device *pdev) |
|---|
| 512 | | -{ |
|---|
| 513 | | - struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); |
|---|
| 514 | | - struct watchdog_device *wdd = &wdt_data->wdd; |
|---|
| 515 | | - int ret = 0; |
|---|
| 516 | | - |
|---|
| 517 | | - if (!nowayout) |
|---|
| 518 | | - ret = kempld_wdt_stop(wdd); |
|---|
| 519 | | - watchdog_unregister_device(wdd); |
|---|
| 520 | | - |
|---|
| 521 | | - return ret; |
|---|
| 522 | 496 | } |
|---|
| 523 | 497 | |
|---|
| 524 | 498 | #ifdef CONFIG_PM |
|---|
| .. | .. |
|---|
| 567 | 541 | .name = "kempld-wdt", |
|---|
| 568 | 542 | }, |
|---|
| 569 | 543 | .probe = kempld_wdt_probe, |
|---|
| 570 | | - .remove = kempld_wdt_remove, |
|---|
| 571 | | - .shutdown = kempld_wdt_shutdown, |
|---|
| 572 | 544 | .suspend = kempld_wdt_suspend, |
|---|
| 573 | 545 | .resume = kempld_wdt_resume, |
|---|
| 574 | 546 | }; |
|---|