diff options
Diffstat (limited to 'drivers/rtc/rtc-vt8500.c')
-rw-r--r-- | drivers/rtc/rtc-vt8500.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index 2730533e2d2d..a000bc0a8bff 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c | |||
@@ -231,20 +231,21 @@ static int vt8500_rtc_probe(struct platform_device *pdev) | |||
231 | return -ENXIO; | 231 | return -ENXIO; |
232 | } | 232 | } |
233 | 233 | ||
234 | vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start, | 234 | vt8500_rtc->res = devm_request_mem_region(&pdev->dev, |
235 | resource_size(vt8500_rtc->res), | 235 | vt8500_rtc->res->start, |
236 | "vt8500-rtc"); | 236 | resource_size(vt8500_rtc->res), |
237 | "vt8500-rtc"); | ||
237 | if (vt8500_rtc->res == NULL) { | 238 | if (vt8500_rtc->res == NULL) { |
238 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | 239 | dev_err(&pdev->dev, "failed to request I/O memory\n"); |
239 | return -EBUSY; | 240 | return -EBUSY; |
240 | } | 241 | } |
241 | 242 | ||
242 | vt8500_rtc->regbase = ioremap(vt8500_rtc->res->start, | 243 | vt8500_rtc->regbase = devm_ioremap(&pdev->dev, vt8500_rtc->res->start, |
243 | resource_size(vt8500_rtc->res)); | 244 | resource_size(vt8500_rtc->res)); |
244 | if (!vt8500_rtc->regbase) { | 245 | if (!vt8500_rtc->regbase) { |
245 | dev_err(&pdev->dev, "Unable to map RTC I/O memory\n"); | 246 | dev_err(&pdev->dev, "Unable to map RTC I/O memory\n"); |
246 | ret = -EBUSY; | 247 | ret = -EBUSY; |
247 | goto err_release; | 248 | goto err_return; |
248 | } | 249 | } |
249 | 250 | ||
250 | /* Enable RTC and set it to 24-hour mode */ | 251 | /* Enable RTC and set it to 24-hour mode */ |
@@ -257,11 +258,11 @@ static int vt8500_rtc_probe(struct platform_device *pdev) | |||
257 | ret = PTR_ERR(vt8500_rtc->rtc); | 258 | ret = PTR_ERR(vt8500_rtc->rtc); |
258 | dev_err(&pdev->dev, | 259 | dev_err(&pdev->dev, |
259 | "Failed to register RTC device -> %d\n", ret); | 260 | "Failed to register RTC device -> %d\n", ret); |
260 | goto err_unmap; | 261 | goto err_return; |
261 | } | 262 | } |
262 | 263 | ||
263 | ret = request_irq(vt8500_rtc->irq_alarm, vt8500_rtc_irq, 0, | 264 | ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm, |
264 | "rtc alarm", vt8500_rtc); | 265 | vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc); |
265 | if (ret < 0) { | 266 | if (ret < 0) { |
266 | dev_err(&pdev->dev, "can't get irq %i, err %d\n", | 267 | dev_err(&pdev->dev, "can't get irq %i, err %d\n", |
267 | vt8500_rtc->irq_alarm, ret); | 268 | vt8500_rtc->irq_alarm, ret); |
@@ -272,11 +273,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev) | |||
272 | 273 | ||
273 | err_unreg: | 274 | err_unreg: |
274 | rtc_device_unregister(vt8500_rtc->rtc); | 275 | rtc_device_unregister(vt8500_rtc->rtc); |
275 | err_unmap: | 276 | err_return: |
276 | iounmap(vt8500_rtc->regbase); | ||
277 | err_release: | ||
278 | release_mem_region(vt8500_rtc->res->start, | ||
279 | resource_size(vt8500_rtc->res)); | ||
280 | return ret; | 277 | return ret; |
281 | } | 278 | } |
282 | 279 | ||
@@ -284,15 +281,10 @@ static int vt8500_rtc_remove(struct platform_device *pdev) | |||
284 | { | 281 | { |
285 | struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); | 282 | struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); |
286 | 283 | ||
287 | free_irq(vt8500_rtc->irq_alarm, vt8500_rtc); | ||
288 | |||
289 | rtc_device_unregister(vt8500_rtc->rtc); | 284 | rtc_device_unregister(vt8500_rtc->rtc); |
290 | 285 | ||
291 | /* Disable alarm matching */ | 286 | /* Disable alarm matching */ |
292 | writel(0, vt8500_rtc->regbase + VT8500_RTC_IS); | 287 | writel(0, vt8500_rtc->regbase + VT8500_RTC_IS); |
293 | iounmap(vt8500_rtc->regbase); | ||
294 | release_mem_region(vt8500_rtc->res->start, | ||
295 | resource_size(vt8500_rtc->res)); | ||
296 | 288 | ||
297 | platform_set_drvdata(pdev, NULL); | 289 | platform_set_drvdata(pdev, NULL); |
298 | 290 | ||