aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorThomas Niederprüm <niederp@physik.uni-kl.de>2015-03-31 14:27:08 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-05-27 05:53:21 -0400
commitfacd94bc458af12e1ebab06cfc3b8e7a41906622 (patch)
treee4f173632c95076511b3216bb1b8e82b448ef244 /drivers/video
parent258c0ea21d3aa974b43e5ce6c2f7c94553a3b1cc (diff)
fbdev: ssd1307fb: Allocate page aligned video memory.
Currently the videomemory is allocated by kmalloc, making it a memory region that is not necessarily page aligend. This leads to problems upon mmap call, where the video memory's address gets aligned to the next page boundary. The result is that the userspace program that issued the mmap call is not able to access the video memory from the start to the next page boundary. This patch changes the allocation of the video memory to use __get_free_pages() in order to obtain memory that is aligned to page boundaries. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/ssd1307fb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 61e0ce866506..8d34c5651187 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -489,7 +489,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
489 489
490 vmem_size = par->width * par->height / 8; 490 vmem_size = par->width * par->height / 8;
491 491
492 vmem = devm_kzalloc(&client->dev, vmem_size, GFP_KERNEL); 492 vmem = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
493 get_order(vmem_size));
493 if (!vmem) { 494 if (!vmem) {
494 dev_err(&client->dev, "Couldn't allocate graphical memory.\n"); 495 dev_err(&client->dev, "Couldn't allocate graphical memory.\n");
495 ret = -ENOMEM; 496 ret = -ENOMEM;
@@ -573,6 +574,7 @@ static int ssd1307fb_remove(struct i2c_client *client)
573 if (par->ops->remove) 574 if (par->ops->remove)
574 par->ops->remove(par); 575 par->ops->remove(par);
575 fb_deferred_io_cleanup(info); 576 fb_deferred_io_cleanup(info);
577 __free_pages(__va(info->fix.smem_start), get_order(info->fix.smem_len));
576 framebuffer_release(info); 578 framebuffer_release(info);
577 579
578 return 0; 580 return 0;