diff options
author | Darren Etheridge <detheridge@ti.com> | 2013-08-05 17:02:33 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-08-09 14:02:42 +0300 |
commit | c45757f0f2c7655ae838e0f500c99794bdd6f33a (patch) | |
tree | 697902d0fd90d55039ac178b7f34ec6f9a45c961 | |
parent | e4008e2240605a64d595f3b9e070bfaf5a6950ff (diff) | |
download | linux-c45757f0f2c7655ae838e0f500c99794bdd6f33a.tar.gz linux-c45757f0f2c7655ae838e0f500c99794bdd6f33a.tar.bz2 linux-c45757f0f2c7655ae838e0f500c99794bdd6f33a.zip |
video: da8xx-fb: use devres
Replace existing resource handling in the driver with managed device
resource.
v2: implement some changes as recommended by
Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/da8xx-fb.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 8384455164d7..c620a32e5ac9 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c @@ -133,7 +133,6 @@ #define PALETTE_SIZE 256 static void __iomem *da8xx_fb_reg_base; -static struct resource *lcdc_regs; static unsigned int lcd_revision; static irq_handler_t lcdc_irq_handler; static wait_queue_head_t frame_done_wq; @@ -1039,12 +1038,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; @@ -1261,12 +1257,12 @@ static int fb_probe(struct platform_device *device) { struct da8xx_lcdc_platform_data *fb_pdata = device->dev.platform_data; + static struct resource *lcdc_regs; struct lcd_ctrl_config *lcd_cfg; struct fb_videomode *lcdc_info; 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; @@ -1276,29 +1272,14 @@ 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 = devm_ioremap_resource(&device->dev, lcdc_regs); + if (IS_ERR(da8xx_fb_reg_base)) + return PTR_ERR(da8xx_fb_reg_base); - da8xx_fb_reg_base = ioremap(lcdc_regs->start, len); - if (!da8xx_fb_reg_base) { - ret = -EBUSY; - goto err_request_mem; - } - - 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 PTR_ERR(fb_clk); } pm_runtime_enable(&device->dev); @@ -1459,8 +1440,8 @@ static int fb_probe(struct platform_device *device) lcdc_irq_handler = lcdc_irq_handler_rev02; } - ret = request_irq(par->irq, lcdc_irq_handler, 0, - DRIVER_NAME, par); + ret = devm_request_irq(&device->dev, par->irq, lcdc_irq_handler, 0, + DRIVER_NAME, par); if (ret) goto irq_freq; return 0; @@ -1489,12 +1470,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; } |