aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at32ap700x.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-12-17 19:19:50 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-17 22:28:15 -0500
commit8d431dbef4e63d54f1965c3ed6ca5f91ee4512de (patch)
tree47683f614c6d3c8d07d55bc4b03169e189ffe8fa /drivers/rtc/rtc-at32ap700x.c
parentfe4304baf26e9580ada52e4579b1b7273434d8dd (diff)
rtc-at32ap700x: fix irq init oops
Reorder at32_rtc_probe() so that it's safe (no oopsing) to fire the IRQ handler the instant that it's registered. (Bug noted via "Debug shared IRQ handlers" kernel debug option.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: <hcegtvedt@atmel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-at32ap700x.c')
-rw-r--r--drivers/rtc/rtc-at32ap700x.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 2999214ca534..d3b9b14267ab 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -225,18 +225,12 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
225 goto out; 225 goto out;
226 } 226 }
227 227
228 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
229 if (ret) {
230 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
231 goto out;
232 }
233
234 rtc->irq = irq; 228 rtc->irq = irq;
235 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1); 229 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1);
236 if (!rtc->regs) { 230 if (!rtc->regs) {
237 ret = -ENOMEM; 231 ret = -ENOMEM;
238 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 232 dev_dbg(&pdev->dev, "could not map I/O memory\n");
239 goto out_free_irq; 233 goto out;
240 } 234 }
241 spin_lock_init(&rtc->lock); 235 spin_lock_init(&rtc->lock);
242 236
@@ -253,12 +247,18 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
253 | RTC_BIT(CTRL_EN)); 247 | RTC_BIT(CTRL_EN));
254 } 248 }
255 249
250 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
251 if (ret) {
252 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
253 goto out_iounmap;
254 }
255
256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
257 &at32_rtc_ops, THIS_MODULE); 257 &at32_rtc_ops, THIS_MODULE);
258 if (IS_ERR(rtc->rtc)) { 258 if (IS_ERR(rtc->rtc)) {
259 dev_dbg(&pdev->dev, "could not register rtc device\n"); 259 dev_dbg(&pdev->dev, "could not register rtc device\n");
260 ret = PTR_ERR(rtc->rtc); 260 ret = PTR_ERR(rtc->rtc);
261 goto out_iounmap; 261 goto out_free_irq;
262 } 262 }
263 263
264 platform_set_drvdata(pdev, rtc); 264 platform_set_drvdata(pdev, rtc);
@@ -268,10 +268,10 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
268 268
269 return 0; 269 return 0;
270 270
271out_iounmap:
272 iounmap(rtc->regs);
273out_free_irq: 271out_free_irq:
274 free_irq(irq, rtc); 272 free_irq(irq, rtc);
273out_iounmap:
274 iounmap(rtc->regs);
275out: 275out:
276 kfree(rtc); 276 kfree(rtc);
277 return ret; 277 return ret;