ARM: NUC900: add rtc controller driver support for NUC900
PATCH 1/1 ARM: NUC900: add rtc controller driver support for NUC900
In reply to a message not in the archiveHi jack,
2009/11/23 jack wang <[email protected]>:
Quoted 10 lines
(quoted diff) +10
-0+static int __devinit nuc900_rtc_probe(struct platform_device *pdev) +{ + ? ? ? struct resource *res; + ? ? ? struct nuc900_rtc *nuc900_rtc; + ? ? ? int err; + + ? ? ? nuc900_rtc = kzalloc(sizeof(struct nuc900_rtc), GFP_KERNEL); + ? ? ? if (!nuc900_rtc) { + ? ? ? ? ? ? ? err = -ENOMEM; + ? ? ? ? ? ? ? goto fail1;
Quoted 2 lines
[jack] Here goto fail1 is not quite right, You'd better just return err instead or just use if (!nu900_rtc) return
-ENOMEM;
Hmmm, good, it is right, but why did not 'CC' other people? :)
Thanks !
[Jack]I am not subscribe arm dev list, just review from
http://www.spinics.net/lists , but now CC'ing added :-)
Wang Jinpu
Quoted 46 lines
+ ? ? ? }
(quoted diff) +28
-0+ + ? ? ? res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + ? ? ? if (!res) { + ? ? ? ? ? ? ? err = -ENXIO; + ? ? ? ? ? ? ? goto fail1; + ? ? ? } + + ? ? ? if (!request_mem_region(res->start, resource_size(res), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pdev->name)) { + ? ? ? ? ? ? ? err = -EBUSY; + ? ? ? ? ? ? ? goto fail1; + ? ? ? } + + ? ? ? nuc900_rtc->rtc_reg = ioremap(res->start, resource_size(res)); + ? ? ? if (!nuc900_rtc->rtc_reg) { + ? ? ? ? ? ? ? err = -ENOMEM; + ? ? ? ? ? ? ? goto fail2; + ? ? ? } + + ? ? ? nuc900_rtc->irq_num = platform_get_irq(pdev, 0); + ? ? ? if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt, + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) { + ? ? ? ? ? ? ? err = -EBUSY; + ? ? ? ? ? ? ? goto fail3; + ? ? ? } + + ? ? ? nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &nuc900_rtc_ops,
THIS_MODULE);
+ ? ? ? if (IS_ERR(nuc900_rtc->rtcdev)) {
+ ? ? ? ? ? ? ? err =PTR_ERR(nuc900_rtc->rtcdev);
+ ? ? ? ? ? ? ? goto fail4;
+ ? ? ? }(quoted diff) +12
-0+ + ? ? ? platform_set_drvdata(pdev, nuc900_rtc->rtcdev); + ? ? ? nuc900_rtc_enbale_timeirq(nuc900_rtc, 1); + + ? ? ? return 0; + +fail4: free_irq(nuc900_rtc->irq_num, nuc900_rtc); +fail3: iounmap(nuc900_rtc->rtc_reg); +fail2: release_mem_region(res->start, resource_size(res)); +fail1: kfree(nuc900_rtc); + ? ? ? return err; +}
PATCH 1/1 ARM: NUC900: add rtc controller driver support for NUC900
Okay, thanks a lot for your reviewing.
2009/11/23 jack wang <[email protected]>:
Quoted 74 lines
Hi jack,
2009/11/23 jack wang <[email protected]>:
Quoted 10 lines
(quoted diff) +10
-0+static int __devinit nuc900_rtc_probe(struct platform_device *pdev) +{ + ? ? ? struct resource *res; + ? ? ? struct nuc900_rtc *nuc900_rtc; + ? ? ? int err; + + ? ? ? nuc900_rtc = kzalloc(sizeof(struct nuc900_rtc), GFP_KERNEL); + ? ? ? if (!nuc900_rtc) { + ? ? ? ? ? ? ? err = -ENOMEM; + ? ? ? ? ? ? ? goto fail1;Quoted 2 lines
[jack] Here goto fail1 is not quite right, You'd better just return err instead or just use if (!nu900_rtc) return
-ENOMEM;Hmmm, good, it is right, but why did not 'CC' other people? :)
Thanks !
[Jack]I am not subscribe arm dev list, just review from
http://www.spinics.net/lists , but now CC'ing added :-)Wang Jinpu
Quoted 46 lines
+ ? ? ? }
(quoted diff) +28
-0+ + ? ? ? res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + ? ? ? if (!res) { + ? ? ? ? ? ? ? err = -ENXIO; + ? ? ? ? ? ? ? goto fail1; + ? ? ? } + + ? ? ? if (!request_mem_region(res->start, resource_size(res), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pdev->name)) { + ? ? ? ? ? ? ? err = -EBUSY; + ? ? ? ? ? ? ? goto fail1; + ? ? ? } + + ? ? ? nuc900_rtc->rtc_reg = ioremap(res->start, resource_size(res)); + ? ? ? if (!nuc900_rtc->rtc_reg) { + ? ? ? ? ? ? ? err = -ENOMEM; + ? ? ? ? ? ? ? goto fail2; + ? ? ? } + + ? ? ? nuc900_rtc->irq_num = platform_get_irq(pdev, 0); + ? ? ? if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt, + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) { + ? ? ? ? ? ? ? err = -EBUSY; + ? ? ? ? ? ? ? goto fail3; + ? ? ? } + + ? ? ? nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &nuc900_rtc_ops,
THIS_MODULE);
+ ? ? ? if (IS_ERR(nuc900_rtc->rtcdev)) {
+ ? ? ? ? ? ? ? err =PTR_ERR(nuc900_rtc->rtcdev);
+ ? ? ? ? ? ? ? goto fail4;
+ ? ? ? }(quoted diff) +12
-0+ + ? ? ? platform_set_drvdata(pdev, nuc900_rtc->rtcdev); + ? ? ? nuc900_rtc_enbale_timeirq(nuc900_rtc, 1); + + ? ? ? return 0; + +fail4: free_irq(nuc900_rtc->irq_num, nuc900_rtc); +fail3: iounmap(nuc900_rtc->rtc_reg); +fail2: release_mem_region(res->start, resource_size(res)); +fail1: kfree(nuc900_rtc); + ? ? ? return err; +}
Signature · 3 lines
linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel