aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-02 10:58:38 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-10-30 06:49:01 -0400
commit498f6d3660e8c3343b26a5f8e2707b642bcf3fc8 (patch)
tree6b2951e6972aa146d6ca8c99e60724ccb8a84ef6
parentcc9fd77c08940c869cdfa38442f32458c5be900c (diff)
simplefb: fix unmapping fb during destruction
Unfortunately, fbdev does not create its own "struct device" for framebuffers. Instead, it attaches to the device of the parent layer. This has the side-effect that devm_* managed resources are not cleaned up on framebuffer-destruction but rather during destruction of the parent-device. In case of fbdev this might be too late, though. remove_conflicting_framebuffer() may remove fbdev devices but keep the parent device as it is. Therefore, we now use plain ioremap() and unmap the framebuffer in the fb_destroy() callback. Note that we must not free the device here as this might race with the parent-device removal. Instead, we rely on unregister_framebuffer() as barrier and we're safe. Reported-by: Tom Gundersen <teg@jklm.no> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/simplefb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 08c764cfeff3..129ab19732c7 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -66,8 +66,15 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
66 return 0; 66 return 0;
67} 67}
68 68
69static void simplefb_destroy(struct fb_info *info)
70{
71 if (info->screen_base)
72 iounmap(info->screen_base);
73}
74
69static struct fb_ops simplefb_ops = { 75static struct fb_ops simplefb_ops = {
70 .owner = THIS_MODULE, 76 .owner = THIS_MODULE,
77 .fb_destroy = simplefb_destroy,
71 .fb_setcolreg = simplefb_setcolreg, 78 .fb_setcolreg = simplefb_setcolreg,
72 .fb_fillrect = cfb_fillrect, 79 .fb_fillrect = cfb_fillrect,
73 .fb_copyarea = cfb_copyarea, 80 .fb_copyarea = cfb_copyarea,
@@ -212,8 +219,8 @@ static int simplefb_probe(struct platform_device *pdev)
212 219
213 info->fbops = &simplefb_ops; 220 info->fbops = &simplefb_ops;
214 info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; 221 info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE;
215 info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start, 222 info->screen_base = ioremap(info->fix.smem_start,
216 info->fix.smem_len); 223 info->fix.smem_len);
217 if (!info->screen_base) { 224 if (!info->screen_base) {
218 framebuffer_release(info); 225 framebuffer_release(info);
219 return -ENODEV; 226 return -ENODEV;
@@ -231,6 +238,7 @@ static int simplefb_probe(struct platform_device *pdev)
231 ret = register_framebuffer(info); 238 ret = register_framebuffer(info);
232 if (ret < 0) { 239 if (ret < 0) {
233 dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); 240 dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
241 iounmap(info->screen_base);
234 framebuffer_release(info); 242 framebuffer_release(info);
235 return ret; 243 return ret;
236 } 244 }