.. | .. |
---|
89 | 89 | |
---|
90 | 90 | static int stmp3xxx_wdt_probe(struct platform_device *pdev) |
---|
91 | 91 | { |
---|
| 92 | + struct device *dev = &pdev->dev; |
---|
92 | 93 | int ret; |
---|
93 | 94 | |
---|
94 | | - watchdog_set_drvdata(&stmp3xxx_wdd, &pdev->dev); |
---|
| 95 | + watchdog_set_drvdata(&stmp3xxx_wdd, dev); |
---|
95 | 96 | |
---|
96 | 97 | stmp3xxx_wdd.timeout = clamp_t(unsigned, heartbeat, 1, STMP3XXX_MAX_TIMEOUT); |
---|
97 | | - stmp3xxx_wdd.parent = &pdev->dev; |
---|
| 98 | + stmp3xxx_wdd.parent = dev; |
---|
98 | 99 | |
---|
99 | | - ret = watchdog_register_device(&stmp3xxx_wdd); |
---|
100 | | - if (ret < 0) { |
---|
101 | | - dev_err(&pdev->dev, "cannot register watchdog device\n"); |
---|
| 100 | + ret = devm_watchdog_register_device(dev, &stmp3xxx_wdd); |
---|
| 101 | + if (ret < 0) |
---|
102 | 102 | return ret; |
---|
103 | | - } |
---|
104 | 103 | |
---|
105 | 104 | if (register_reboot_notifier(&wdt_notifier)) |
---|
106 | | - dev_warn(&pdev->dev, "cannot register reboot notifier\n"); |
---|
| 105 | + dev_warn(dev, "cannot register reboot notifier\n"); |
---|
107 | 106 | |
---|
108 | | - dev_info(&pdev->dev, "initialized watchdog with heartbeat %ds\n", |
---|
109 | | - stmp3xxx_wdd.timeout); |
---|
| 107 | + dev_info(dev, "initialized watchdog with heartbeat %ds\n", |
---|
| 108 | + stmp3xxx_wdd.timeout); |
---|
110 | 109 | return 0; |
---|
111 | 110 | } |
---|
112 | 111 | |
---|
113 | 112 | static int stmp3xxx_wdt_remove(struct platform_device *pdev) |
---|
114 | 113 | { |
---|
115 | 114 | unregister_reboot_notifier(&wdt_notifier); |
---|
116 | | - watchdog_unregister_device(&stmp3xxx_wdd); |
---|
117 | 115 | return 0; |
---|
118 | 116 | } |
---|
119 | 117 | |
---|