| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) Nokia Corporation |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Written by Timo Kokkonen <timo.t.kokkonen at nokia.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 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 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 70 | 57 | |
|---|
| 71 | 58 | static int twl4030_wdt_probe(struct platform_device *pdev) |
|---|
| 72 | 59 | { |
|---|
| 73 | | - int ret = 0; |
|---|
| 60 | + struct device *dev = &pdev->dev; |
|---|
| 74 | 61 | struct watchdog_device *wdt; |
|---|
| 75 | 62 | |
|---|
| 76 | | - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); |
|---|
| 63 | + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); |
|---|
| 77 | 64 | if (!wdt) |
|---|
| 78 | 65 | return -ENOMEM; |
|---|
| 79 | 66 | |
|---|
| .. | .. |
|---|
| 83 | 70 | wdt->timeout = 30; |
|---|
| 84 | 71 | wdt->min_timeout = 1; |
|---|
| 85 | 72 | wdt->max_timeout = 30; |
|---|
| 86 | | - wdt->parent = &pdev->dev; |
|---|
| 73 | + wdt->parent = dev; |
|---|
| 87 | 74 | |
|---|
| 88 | 75 | watchdog_set_nowayout(wdt, nowayout); |
|---|
| 89 | 76 | platform_set_drvdata(pdev, wdt); |
|---|
| 90 | 77 | |
|---|
| 91 | 78 | twl4030_wdt_stop(wdt); |
|---|
| 92 | 79 | |
|---|
| 93 | | - ret = watchdog_register_device(wdt); |
|---|
| 94 | | - if (ret) |
|---|
| 95 | | - return ret; |
|---|
| 96 | | - |
|---|
| 97 | | - return 0; |
|---|
| 98 | | -} |
|---|
| 99 | | - |
|---|
| 100 | | -static int twl4030_wdt_remove(struct platform_device *pdev) |
|---|
| 101 | | -{ |
|---|
| 102 | | - struct watchdog_device *wdt = platform_get_drvdata(pdev); |
|---|
| 103 | | - |
|---|
| 104 | | - watchdog_unregister_device(wdt); |
|---|
| 105 | | - |
|---|
| 106 | | - return 0; |
|---|
| 80 | + return devm_watchdog_register_device(dev, wdt); |
|---|
| 107 | 81 | } |
|---|
| 108 | 82 | |
|---|
| 109 | 83 | #ifdef CONFIG_PM |
|---|
| .. | .. |
|---|
| 137 | 111 | |
|---|
| 138 | 112 | static struct platform_driver twl4030_wdt_driver = { |
|---|
| 139 | 113 | .probe = twl4030_wdt_probe, |
|---|
| 140 | | - .remove = twl4030_wdt_remove, |
|---|
| 141 | 114 | .suspend = twl4030_wdt_suspend, |
|---|
| 142 | 115 | .resume = twl4030_wdt_resume, |
|---|
| 143 | 116 | .driver = { |
|---|