mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Afzal Mohammed <afzal@ti.com>
To: <linux-fbdev@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Mike Turquette <mturquette@linaro.org>
Subject: [PATCH v3 04/12] video: da8xx-fb: use devres
Date: Tue, 22 Jan 2013 22:22:25 +0530	[thread overview]
Message-ID: <fdfc4d782dc176cf9543fb6dc38f7fbc8ae957ac.1358871750.git.afzal@ti.com> (raw)
In-Reply-To: <cover.1358871750.git.afzal@ti.com>

Replace existing resource handling in the driver with managed device
resource.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 drivers/video/da8xx-fb.c | 35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index ca69e01..7a32e83 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1036,12 +1036,9 @@ static int fb_remove(struct platform_device *dev)
 				  par->p_palette_base);
 		dma_free_coherent(NULL, par->vram_size, par->vram_virt,
 				  par->vram_phys);
-		free_irq(par->irq, par);
 		pm_runtime_put_sync(&dev->dev);
 		pm_runtime_disable(&dev->dev);
 		framebuffer_release(info);
-		iounmap(da8xx_fb_reg_base);
-		release_mem_region(lcdc_regs->start, resource_size(lcdc_regs));
 
 	}
 	return 0;
@@ -1265,7 +1262,6 @@ static int fb_probe(struct platform_device *device)
 	struct fb_info *da8xx_fb_info;
 	struct clk *fb_clk = NULL;
 	struct da8xx_fb_par *par;
-	resource_size_t len;
 	int ret, i;
 	unsigned long ulcm;
 
@@ -1275,29 +1271,16 @@ static int fb_probe(struct platform_device *device)
 	}
 
 	lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0);
-	if (!lcdc_regs) {
-		dev_err(&device->dev,
-			"Can not get memory resource for LCD controller\n");
-		return -ENOENT;
-	}
-
-	len = resource_size(lcdc_regs);
-
-	lcdc_regs = request_mem_region(lcdc_regs->start, len, lcdc_regs->name);
-	if (!lcdc_regs)
-		return -EBUSY;
-
-	da8xx_fb_reg_base = ioremap(lcdc_regs->start, len);
+	da8xx_fb_reg_base = devm_request_and_ioremap(&device->dev, lcdc_regs);
 	if (!da8xx_fb_reg_base) {
-		ret = -EBUSY;
-		goto err_request_mem;
+		dev_err(&device->dev, "memory resource setup failed\n");
+		return -EADDRNOTAVAIL;
 	}
 
-	fb_clk = clk_get(&device->dev, "fck");
+	fb_clk = devm_clk_get(&device->dev, "fck");
 	if (IS_ERR(fb_clk)) {
 		dev_err(&device->dev, "Can not get device clock\n");
-		ret = -ENODEV;
-		goto err_ioremap;
+		return -ENODEV;
 	}
 
 	pm_runtime_enable(&device->dev);
@@ -1458,7 +1441,7 @@ static int fb_probe(struct platform_device *device)
 		lcdc_irq_handler = lcdc_irq_handler_rev02;
 	}
 
-	ret = request_irq(par->irq, lcdc_irq_handler, 0,
+	ret = devm_request_irq(&device->dev, par->irq, lcdc_irq_handler, 0,
 			DRIVER_NAME, par);
 	if (ret)
 		goto irq_freq;
@@ -1488,12 +1471,6 @@ err_pm_runtime_disable:
 	pm_runtime_put_sync(&device->dev);
 	pm_runtime_disable(&device->dev);
 
-err_ioremap:
-	iounmap(da8xx_fb_reg_base);
-
-err_request_mem:
-	release_mem_region(lcdc_regs->start, len);
-
 	return ret;
 }
 
-- 
1.7.12


  parent reply	other threads:[~2013-01-22 16:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 16:51 [PATCH v3 00/12] video: da8xx-fb: am335x DT support Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 01/12] video: da8xx-fb: make io operations safe Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 02/12] video: da8xx-fb: fix 24bpp raster configuration Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 03/12] video: da8xx-fb: enable sync lost intr for v2 ip Afzal Mohammed
2013-01-22 16:52 ` Afzal Mohammed [this message]
2013-01-22 16:52 ` [PATCH v3 05/12] video: da8xx-fb: ensure non-null cfg in pdata Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 06/12] video: da8xx-fb: reorganize panel detection Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 07/12] video: da8xx-fb: minimal dt support Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 08/12] video: da8xx-fb: invoke platform callback safely Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 09/12] video: da8xx-fb: obtain fb_videomode info from dt Afzal Mohammed
2013-01-22 16:52 ` [PATCH v3 10/12] video: da8xx-fb: ensure pdata only for non-dt Afzal Mohammed
2013-01-22 16:53 ` [PATCH v3 11/12] video: da8xx-fb: setup struct lcd_ctrl_config for dt Afzal Mohammed
2013-01-22 16:53 ` [PATCH v3 12/12] video: da8xx-fb: CCF clock divider handling Afzal Mohammed
2013-01-22 17:03 ` [PATCH v3 00/12] video: da8xx-fb: am335x DT support Koen Kooi
2013-01-22 18:45   ` Rob Clark
2013-01-23 12:27     ` Mohammed, Afzal
2013-01-23 14:25       ` Rob Clark

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=fdfc4d782dc176cf9543fb6dc38f7fbc8ae957ac.1358871750.git.afzal@ti.com \
    --to=afzal@ti.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=s.trumtrar@pengutronix.de \
    --cc=tomi.valkeinen@ti.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

all inboxes | Powered by JetHome®