The patch titled Subject: drivers/rtc/rtc-pxa.c: use devm_* APIs has been added to the -mm tree. Its filename is drivers-rtc-rtc-pxac-use-devm_-apis.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Sachin Kamat <sachin.kamat@xxxxxxxxxx> Subject: drivers/rtc/rtc-pxa.c: use devm_* APIs devm_* functions are device managed and make cleanup code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx> Acked-by: Robert Jarzmik <robert.jarzmik@xxxxxxx> Cc: Jingoo Han <jg1.han@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/rtc/rtc-pxa.c | 41 +++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff -puN drivers/rtc/rtc-pxa.c~drivers-rtc-rtc-pxac-use-devm_-apis drivers/rtc/rtc-pxa.c --- a/drivers/rtc/rtc-pxa.c~drivers-rtc-rtc-pxac-use-devm_-apis +++ a/drivers/rtc/rtc-pxa.c @@ -364,7 +364,7 @@ static int __init pxa_rtc_probe(struct p int ret; u32 rttr; - pxa_rtc = kzalloc(sizeof(struct pxa_rtc), GFP_KERNEL); + pxa_rtc = devm_kzalloc(dev, sizeof(struct pxa_rtc), GFP_KERNEL); if (!pxa_rtc) return -ENOMEM; rtc_info = pxa_rtc; @@ -375,37 +375,37 @@ static int __init pxa_rtc_probe(struct p pxa_rtc->ress = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!pxa_rtc->ress) { dev_err(dev, "No I/O memory resource defined\n"); - goto err_ress; + return ret; } pxa_rtc->ress_psbr = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (!pxa_rtc->ress_psbr) { dev_err(dev, "No I/O memory resource defined\n"); - goto err_ress; + return ret; } pxa_rtc->irq_1Hz = platform_get_irq(pdev, 0); if (pxa_rtc->irq_1Hz < 0) { dev_err(dev, "No 1Hz IRQ resource defined\n"); - goto err_ress; + return ret; } pxa_rtc->irq_Alrm = platform_get_irq(pdev, 1); if (pxa_rtc->irq_Alrm < 0) { dev_err(dev, "No alarm IRQ resource defined\n"); - goto err_ress; + return ret; } ret = -ENOMEM; - pxa_rtc->base = ioremap(pxa_rtc->ress->start, + pxa_rtc->base = devm_ioremap(&pdev->dev, pxa_rtc->ress->start, resource_size(pxa_rtc->ress)); if (!pxa_rtc->base) { dev_err(&pdev->dev, "Unable to map pxa RTC I/O memory\n"); - goto err_map; + return ret; } - pxa_rtc->base_psbr = ioremap(pxa_rtc->ress_psbr->start, + pxa_rtc->base_psbr = devm_ioremap(&pdev->dev, pxa_rtc->ress_psbr->start, resource_size(pxa_rtc->ress_psbr)); if (!pxa_rtc->base_psbr) { dev_err(&pdev->dev, "Unable to map pxa RTC PSBR I/O memory\n"); - goto err_map; + return ret; } /* * If the clock divider is uninitialized then reset it to the @@ -420,41 +420,24 @@ static int __init pxa_rtc_probe(struct p rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE); - pxa_rtc->rtc = rtc_device_register("pxa-rtc", &pdev->dev, &pxa_rtc_ops, - THIS_MODULE); + pxa_rtc->rtc = devm_rtc_device_register(&pdev->dev, "pxa-rtc", + &pxa_rtc_ops, THIS_MODULE); ret = PTR_ERR(pxa_rtc->rtc); if (IS_ERR(pxa_rtc->rtc)) { dev_err(dev, "Failed to register RTC device -> %d\n", ret); - goto err_rtc_reg; + return ret; } device_init_wakeup(dev, 1); pxa_rtc_open(dev); return 0; - -err_rtc_reg: - iounmap(pxa_rtc->base); -err_ress: -err_map: - kfree(pxa_rtc); - return ret; } static int __exit pxa_rtc_remove(struct platform_device *pdev) { - struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); - struct device *dev = &pdev->dev; pxa_rtc_release(dev); - rtc_device_unregister(pxa_rtc->rtc); - - spin_lock_irq(&pxa_rtc->lock); - iounmap(pxa_rtc->base); - spin_unlock_irq(&pxa_rtc->lock); - - kfree(pxa_rtc); - return 0; } _ Patches currently in -mm which might be from sachin.kamat@xxxxxxxxxx are linux-next.patch drivers-video-exynos-exynos_mipi_dsic-convert-to-devm_ioremap_resource.patch drivers-rtc-rtc-tps6586xc-remove-incorrect-use-of-rtc_device_unregister.patch drivers-rtc-rtc-tps65910c-fix-incorrect-return-value-on-error.patch drivers-rtc-rtc-max8997c-fix-incorrect-return-value-on-error.patch drivers-rtc-rtc-max77686c-fix-incorrect-return-value-on-error.patch drivers-rtc-rtc-max8907c-remove-redundant-code.patch drivers-rtc-rtc-max77686c-use-devm_regmap_init_i2c.patch drivers-rtc-rtc-88pm860xc-use-devm_-apis.patch drivers-rtc-rtc-at32ap700xc-use-devm_-apis.patch drivers-rtc-rtc-ds1305c-use-devm_-apis.patch drivers-rtc-rtc-ds1374c-use-devm_-apis.patch drivers-rtc-rtc-ds3232c-use-devm_-apis.patch drivers-rtc-rtc-m48t35c-use-devm_-apis.patch drivers-rtc-rtc-max8925c-use-devm_-apis.patch drivers-rtc-rtc-pxac-use-devm_-apis.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html