public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Johannes Thumshirn <johannes.thumshirn@men.de>,
	Doug Thompson <dougthompson@xmission.com>
Cc: <linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] cpc925_eadc: Use devm_ioremap_resource()
Date: Tue, 10 Jun 2014 09:57:56 +0800	[thread overview]
Message-ID: <53966624.5060206@huawei.com> (raw)
In-Reply-To: <1402324818-12300-1-git-send-email-wangkefeng.wang@huawei.com>

Convert to devm_ioremap_resource() to simplify code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/edac/cpc925_edac.c |   30 ++++++------------------------
 1 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index df6575f..b335c14 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -950,28 +950,12 @@ static int cpc925_probe(struct platform_device *pdev)
        }

        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!r) {
-               cpc925_printk(KERN_ERR, "Unable to get resource\n");
-               res = -ENOENT;
+       vbase = devm_ioremap_resource(&pdev->dev, r);
+       if (IS_ERR(vbase)) {
+               res = PTR_ERR(vbase);
                goto err1;
        }

-       if (!devm_request_mem_region(&pdev->dev,
-                                    r->start,
-                                    resource_size(r),
-                                    pdev->name)) {
-               cpc925_printk(KERN_ERR, "Unable to request mem region\n");
-               res = -EBUSY;
-               goto err1;
-       }
-
-       vbase = devm_ioremap(&pdev->dev, r->start, resource_size(r));
-       if (!vbase) {
-               cpc925_printk(KERN_ERR, "Unable to ioremap device\n");
-               res = -ENOMEM;
-               goto err2;
-       }
-
        nr_channels = cpc925_mc_get_channels(vbase) + 1;

        layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
@@ -985,7 +969,7 @@ static int cpc925_probe(struct platform_device *pdev)
        if (!mci) {
                cpc925_printk(KERN_ERR, "No memory for mem_ctl_info\n");
                res = -ENOMEM;
-               goto err2;
+               goto err1;
        }

        pdata = mci->pvt_info;
@@ -1018,7 +1002,7 @@ static int cpc925_probe(struct platform_device *pdev)

        if (edac_mc_add_mc(mci) > 0) {
                cpc925_mc_printk(mci, KERN_ERR, "Failed edac_mc_add_mc()\n");
-               goto err3;
+               goto err2;
        }

        cpc925_add_edac_devices(vbase);
@@ -1029,11 +1013,9 @@ static int cpc925_probe(struct platform_device *pdev)
        res = 0;
        goto out;

-err3:
+err2:
        cpc925_mc_exit(mci);
        edac_mc_free(mci);
-err2:
-       devm_release_mem_region(&pdev->dev, r->start, resource_size(r));
 err1:
        devres_release_group(&pdev->dev, cpc925_probe);
 out:
-- 
1.7.1


  reply	other threads:[~2014-06-10  1:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 14:40 [PATCH] cpc925_edac: Use module_platform_driver() Kefeng Wang
2014-06-10  1:57 ` Kefeng Wang [this message]
2014-07-03 13:22   ` [PATCH] cpc925_eadc: Use devm_ioremap_resource() Borislav Petkov
2014-06-10  2:44 ` [PATCH] cpc925_edac: Use module_platform_driver() Xie XiuQi
2014-07-03 11:49 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53966624.5060206@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=dougthompson@xmission.com \
    --cc=johannes.thumshirn@men.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox