Patchwork Re: [PATCH 1/3] rtc: rtc-spear: Use devm_*() routines

login
register
mail settings
Submitter viresh kumar
Date Nov. 9, 2012, 3:07 a.m.
Message ID <CAKohpomLbNhLhs3rgVaHp=R0kHVSN-sFePN_Nc205RxXczmu3A@mail.gmail.com>
Download mbox | patch
Permalink /patch/197918/
State New
Headers show

Comments

viresh kumar - Nov. 9, 2012, 3:07 a.m.
On 8 November 2012 20:07, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> This patch frees rtc-spear driver from tension of freeing resources :)
> devm_* derivatives of multiple routines are used while allocating resources,
> which would be freed automatically by kernel.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Hi Andrew,

Can you please apply this fixup to this patch?

commit ad4a753df699e525d9c91a353f4406fd0e363599
Author: Viresh Kumar <viresh.kumar@linaro.org>
Date:   Fri Nov 9 08:36:29 2012 +0530

    fixup! rtc: rtc-spear: Use devm_*() routines
---
 drivers/rtc/rtc-spear.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

        if (!config) {
@@ -390,10 +385,9 @@ static int __devinit spear_rtc_probe(struct
platform_device *pdev)
                return status;
        }

-       config->ioaddr = devm_ioremap(&pdev->dev, res->start,
-                       resource_size(res));
+       config->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
        if (!config->ioaddr) {
-               dev_err(&pdev->dev, "ioremap fail\n");
+               dev_err(&pdev->dev, "request-ioremap fail\n");
                return -ENOMEM;
        }

Patch

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 0c4805c..141fc94 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -363,11 +363,6 @@  static int __devinit spear_rtc_probe(struct
platform_device *pdev)
                dev_err(&pdev->dev, "no resource defined\n");
                return -EBUSY;
        }
-       if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
-                               pdev->name)) {
-               dev_err(&pdev->dev, "rtc region already claimed\n");
-               return -EBUSY;
-       }

        config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);