diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-20 21:50:24 -1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-20 21:50:24 -1000 |
commit | e1d1ea549b57790a3d8cf6300e6ef86118d692a3 (patch) | |
tree | 0174210b1d2d00ab9f111aa8780b3d94238ccaf1 /drivers/video/fbdev/sa1100fb.c | |
parent | c633e898bde8990a34907c91b7d5245cab866c6e (diff) | |
parent | 5f215d252496543ba22299bccef5062d30d63cfe (diff) |
Merge tag 'fbdev-v4.15' of git://github.com/bzolnier/linux
Pull fbdev updates from Bartlomiej Zolnierkiewicz:
"There is nothing really major here (though removal of the dead igafb
driver stands out in diffstat).
Summary:
- convert timers to use timer_setup() (Kees Cook, Thierry Reding)
- fix panels support on iMX boards in mxsfb driver (Stefan Agner)
- fix timeout on EDID read in udlfb driver (Ladislav Michl)
- add missing modes to fix out of bounds access in controlfb driver
(Geert Uytterhoeven)
- update initialisation paths in sa1100fb driver to be more robust
(Russell King)
- fix error handling path of ->probe method in au1200fb driver
(Christophe JAILLET)
- fix handling of cases when either panel or crt is defined in
sm501fb driver (Sudip Mukherjee, Colin Ian King)
- add ability to the Goldfish FB driver to be recognized by OS via DT
(Aleksandar Markovic)
- structures constifications (Bhumika Goyal)
- misc fixes (Allen Pais, Gustavo A. R. Silva, Dan Carpenter)
- misc cleanups (Colin Ian King, Himanshu Jha, Markus Elfring)
- remove dead igafb driver"
* tag 'fbdev-v4.15' of git://github.com/bzolnier/linux: (42 commits)
OMAPFB: prevent buffer underflow in omapfb_parse_vram_param()
video: fbdev: sm501fb: fix potential null pointer dereference on fbi
fbcon: Initialize ops->info early
video: fbdev: Convert timers to use timer_setup()
video: fbdev: pxa3xx_gcu: Convert timers to use timer_setup()
fbdev: controlfb: Add missing modes to fix out of bounds access
video: fbdev: sis_main: mark expected switch fall-throughs
video: fbdev: cirrusfb: mark expected switch fall-throughs
video: fbdev: aty: radeon_pm: mark expected switch fall-throughs
video: fbdev: sm501fb: mark expected switch fall-through in sm501fb_blank_crt
video: fbdev: intelfb: remove redundant variables
video/fbdev/dnfb: Use common error handling code in dnfb_probe()
sm501fb: suspend and resume fb if it exists
sm501fb: unregister framebuffer only if registered
sm501fb: deallocate colormap only if allocated
video: goldfishfb: Add support for device tree bindings
Documentation: Add device tree binding for Goldfish FB driver
video: udlfb: Fix read EDID timeout
video: fbdev: remove dead igafb driver
video: fbdev: mxsfb: fix pixelclock polarity
...
Diffstat (limited to 'drivers/video/fbdev/sa1100fb.c')
-rw-r--r-- | drivers/video/fbdev/sa1100fb.c | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index fc2aaa5aca23..15ae50063296 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -323,13 +323,11 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, * according to the RGB bitfield information. */ if (regno < 16) { - u32 *pal = fbi->fb.pseudo_palette; - val = chan_to_field(red, &fbi->fb.var.red); val |= chan_to_field(green, &fbi->fb.var.green); val |= chan_to_field(blue, &fbi->fb.var.blue); - pal[regno] = val; + fbi->pseudo_palette[regno] = val; ret = 0; } break; @@ -1132,12 +1130,10 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct device *dev) struct sa1100fb_info *fbi; unsigned i; - fbi = kmalloc(sizeof(struct sa1100fb_info) + sizeof(u32) * 16, - GFP_KERNEL); + fbi = devm_kzalloc(dev, sizeof(struct sa1100fb_info), GFP_KERNEL); if (!fbi) return NULL; - memset(fbi, 0, sizeof(struct sa1100fb_info)); fbi->dev = dev; strcpy(fbi->fb.fix.id, SA1100_NAME); @@ -1159,7 +1155,7 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct device *dev) fbi->fb.fbops = &sa1100fb_ops; fbi->fb.flags = FBINFO_DEFAULT; fbi->fb.monspecs = monspecs; - fbi->fb.pseudo_palette = (fbi + 1); + fbi->fb.pseudo_palette = fbi->pseudo_palette; fbi->rgb[RGB_4] = &rgb_4; fbi->rgb[RGB_8] = &rgb_8; @@ -1218,48 +1214,42 @@ static int sa1100fb_probe(struct platform_device *pdev) return -EINVAL; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq(pdev, 0); - if (irq < 0 || !res) + if (irq < 0) return -EINVAL; - if (!request_mem_region(res->start, resource_size(res), "LCD")) - return -EBUSY; - fbi = sa1100fb_init_fbinfo(&pdev->dev); - ret = -ENOMEM; if (!fbi) - goto failed; - - fbi->clk = clk_get(&pdev->dev, NULL); - if (IS_ERR(fbi->clk)) { - ret = PTR_ERR(fbi->clk); - fbi->clk = NULL; - goto failed; - } + return -ENOMEM; - fbi->base = ioremap(res->start, resource_size(res)); - if (!fbi->base) - goto failed; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + fbi->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(fbi->base)) + return PTR_ERR(fbi->base); - /* Initialize video memory */ - ret = sa1100fb_map_video_memory(fbi); - if (ret) - goto failed; + fbi->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(fbi->clk)) + return PTR_ERR(fbi->clk); - ret = request_irq(irq, sa1100fb_handle_irq, 0, "LCD", fbi); + ret = devm_request_irq(&pdev->dev, irq, sa1100fb_handle_irq, 0, + "LCD", fbi); if (ret) { dev_err(&pdev->dev, "request_irq failed: %d\n", ret); - goto failed; + return ret; } if (machine_is_shannon()) { - ret = gpio_request_one(SHANNON_GPIO_DISP_EN, + ret = devm_gpio_request_one(&pdev->dev, SHANNON_GPIO_DISP_EN, GPIOF_OUT_INIT_LOW, "display enable"); if (ret) - goto err_free_irq; + return ret; } + /* Initialize video memory */ + ret = sa1100fb_map_video_memory(fbi); + if (ret) + return ret; + /* * This makes sure that our colour bitfield * descriptors are correctly initialised. @@ -1269,8 +1259,11 @@ static int sa1100fb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fbi); ret = register_framebuffer(&fbi->fb); - if (ret < 0) - goto err_reg_fb; + if (ret < 0) { + dma_free_wc(fbi->dev, fbi->map_size, fbi->map_cpu, + fbi->map_dma); + return ret; + } #ifdef CONFIG_CPU_FREQ fbi->freq_transition.notifier_call = sa1100fb_freq_transition; @@ -1281,20 +1274,6 @@ static int sa1100fb_probe(struct platform_device *pdev) /* This driver cannot be unloaded at the moment */ return 0; - - err_reg_fb: - if (machine_is_shannon()) - gpio_free(SHANNON_GPIO_DISP_EN); - err_free_irq: - free_irq(irq, fbi); - failed: - if (fbi) - iounmap(fbi->base); - if (fbi->clk) - clk_put(fbi->clk); - kfree(fbi); - release_mem_region(res->start, resource_size(res)); - return ret; } static struct platform_driver sa1100fb_driver = { |