From: Fabio Estevam <festevam@gmail.com>
To: FlorianSchandinat@gmx.de
Cc: akpm@linux-foundation.org, shawn.guo@linaro.org,
linux-kernel@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH] video: mxsfb: Convert to devm_ioremap_resource()
Date: Mon, 11 Mar 2013 20:52:17 -0300 [thread overview]
Message-ID: <1363045937-6740-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Converting to devm_ioremap_resource() can make the code cleaner and smaller.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/video/mxsfb.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 755556c..26cbc56 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -801,22 +801,17 @@ static int mxsfb_probe(struct platform_device *pdev)
return -ENODEV;
}
- if (!request_mem_region(res->start, resource_size(res), pdev->name))
- return -EBUSY;
-
fb_info = framebuffer_alloc(sizeof(struct mxsfb_info), &pdev->dev);
if (!fb_info) {
dev_err(&pdev->dev, "Failed to allocate fbdev\n");
- ret = -ENOMEM;
- goto error_alloc_info;
+ return -ENOMEM;
}
host = to_imxfb_host(fb_info);
- host->base = ioremap(res->start, resource_size(res));
- if (!host->base) {
- dev_err(&pdev->dev, "ioremap failed\n");
- ret = -ENOMEM;
+ host->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(host->base)) {
+ return PTR_ERR(host->base);
goto error_ioremap;
}
@@ -904,11 +899,8 @@ error_panel_enable:
clk_put(host->clk);
error_getclock:
error_getpin:
- iounmap(host->base);
error_ioremap:
framebuffer_release(fb_info);
-error_alloc_info:
- release_mem_region(res->start, resource_size(res));
return ret;
}
@@ -917,7 +909,6 @@ static int mxsfb_remove(struct platform_device *pdev)
{
struct fb_info *fb_info = platform_get_drvdata(pdev);
struct mxsfb_info *host = to_imxfb_host(fb_info);
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (host->enabled)
mxsfb_disable_controller(fb_info);
@@ -925,11 +916,9 @@ static int mxsfb_remove(struct platform_device *pdev)
unregister_framebuffer(fb_info);
kfree(fb_info->pseudo_palette);
mxsfb_free_videomem(host);
- iounmap(host->base);
clk_put(host->clk);
framebuffer_release(fb_info);
- release_mem_region(res->start, resource_size(res));
platform_set_drvdata(pdev, NULL);
--
1.7.9.5
next reply other threads:[~2013-03-11 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 23:52 Fabio Estevam [this message]
2013-03-12 12:06 ` [PATCH] video: mxsfb: Convert to devm_ioremap_resource() Shawn Guo
2013-03-12 12:29 ` Shawn Guo
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=1363045937-6740-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=FlorianSchandinat@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=fabio.estevam@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shawn.guo@linaro.org \
/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