| .. | .. |
|---|
| 181 | 181 | |
|---|
| 182 | 182 | static int tegra_wdt_probe(struct platform_device *pdev) |
|---|
| 183 | 183 | { |
|---|
| 184 | + struct device *dev = &pdev->dev; |
|---|
| 184 | 185 | struct watchdog_device *wdd; |
|---|
| 185 | 186 | struct tegra_wdt *wdt; |
|---|
| 186 | | - struct resource *res; |
|---|
| 187 | 187 | void __iomem *regs; |
|---|
| 188 | 188 | int ret; |
|---|
| 189 | 189 | |
|---|
| 190 | 190 | /* This is the timer base. */ |
|---|
| 191 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 192 | | - regs = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 191 | + regs = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 193 | 192 | if (IS_ERR(regs)) |
|---|
| 194 | 193 | return PTR_ERR(regs); |
|---|
| 195 | 194 | |
|---|
| .. | .. |
|---|
| 197 | 196 | * Allocate our watchdog driver data, which has the |
|---|
| 198 | 197 | * struct watchdog_device nested within it. |
|---|
| 199 | 198 | */ |
|---|
| 200 | | - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); |
|---|
| 199 | + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); |
|---|
| 201 | 200 | if (!wdt) |
|---|
| 202 | 201 | return -ENOMEM; |
|---|
| 203 | 202 | |
|---|
| .. | .. |
|---|
| 212 | 211 | wdd->ops = &tegra_wdt_ops; |
|---|
| 213 | 212 | wdd->min_timeout = MIN_WDT_TIMEOUT; |
|---|
| 214 | 213 | wdd->max_timeout = MAX_WDT_TIMEOUT; |
|---|
| 215 | | - wdd->parent = &pdev->dev; |
|---|
| 214 | + wdd->parent = dev; |
|---|
| 216 | 215 | |
|---|
| 217 | 216 | watchdog_set_drvdata(wdd, wdt); |
|---|
| 218 | 217 | |
|---|
| 219 | 218 | watchdog_set_nowayout(wdd, nowayout); |
|---|
| 220 | 219 | |
|---|
| 221 | | - ret = devm_watchdog_register_device(&pdev->dev, wdd); |
|---|
| 222 | | - if (ret) { |
|---|
| 223 | | - dev_err(&pdev->dev, |
|---|
| 224 | | - "failed to register watchdog device\n"); |
|---|
| 220 | + watchdog_stop_on_unregister(wdd); |
|---|
| 221 | + ret = devm_watchdog_register_device(dev, wdd); |
|---|
| 222 | + if (ret) |
|---|
| 225 | 223 | return ret; |
|---|
| 226 | | - } |
|---|
| 227 | 224 | |
|---|
| 228 | 225 | platform_set_drvdata(pdev, wdt); |
|---|
| 229 | 226 | |
|---|
| 230 | | - dev_info(&pdev->dev, |
|---|
| 231 | | - "initialized (heartbeat = %d sec, nowayout = %d)\n", |
|---|
| 227 | + dev_info(dev, "initialized (heartbeat = %d sec, nowayout = %d)\n", |
|---|
| 232 | 228 | heartbeat, nowayout); |
|---|
| 233 | | - |
|---|
| 234 | | - return 0; |
|---|
| 235 | | -} |
|---|
| 236 | | - |
|---|
| 237 | | -static int tegra_wdt_remove(struct platform_device *pdev) |
|---|
| 238 | | -{ |
|---|
| 239 | | - struct tegra_wdt *wdt = platform_get_drvdata(pdev); |
|---|
| 240 | | - |
|---|
| 241 | | - tegra_wdt_stop(&wdt->wdd); |
|---|
| 242 | | - |
|---|
| 243 | | - dev_info(&pdev->dev, "removed wdt\n"); |
|---|
| 244 | 229 | |
|---|
| 245 | 230 | return 0; |
|---|
| 246 | 231 | } |
|---|
| .. | .. |
|---|
| 280 | 265 | |
|---|
| 281 | 266 | static struct platform_driver tegra_wdt_driver = { |
|---|
| 282 | 267 | .probe = tegra_wdt_probe, |
|---|
| 283 | | - .remove = tegra_wdt_remove, |
|---|
| 284 | 268 | .driver = { |
|---|
| 285 | 269 | .name = "tegra-wdt", |
|---|
| 286 | 270 | .pm = &tegra_wdt_pm_ops, |
|---|