diff options
author | Heiko Stübner <heiko@sntech.de> | 2013-03-22 10:14:52 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-04-04 06:08:07 -0400 |
commit | 03fc1499f0fb28d4f70b83e8a05652129936486c (patch) | |
tree | 54f5ad60ae3d70b7bc47f4e469c325064ab96432 | |
parent | 4e0ab85bb9097ecc422d4237f9eec155993f2902 (diff) |
AUO-K190x: make memory check in check_var more flexible
Use only information from the new var to calculate the amount
of memory needed.
Signed-off-by: Heiko Stübner <heiko@sntech.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/auo_k190x.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c index 17f8d099b177..e078e20d4ad6 100644 --- a/drivers/video/auo_k190x.c +++ b/drivers/video/auo_k190x.c | |||
@@ -376,6 +376,9 @@ static void auok190xfb_imageblit(struct fb_info *info, | |||
376 | static int auok190xfb_check_var(struct fb_var_screeninfo *var, | 376 | static int auok190xfb_check_var(struct fb_var_screeninfo *var, |
377 | struct fb_info *info) | 377 | struct fb_info *info) |
378 | { | 378 | { |
379 | struct device *dev = info->device; | ||
380 | int size; | ||
381 | |||
379 | if (info->var.xres != var->xres || info->var.yres != var->yres || | 382 | if (info->var.xres != var->xres || info->var.yres != var->yres || |
380 | info->var.xres_virtual != var->xres_virtual || | 383 | info->var.xres_virtual != var->xres_virtual || |
381 | info->var.yres_virtual != var->yres_virtual) { | 384 | info->var.yres_virtual != var->yres_virtual) { |
@@ -388,9 +391,10 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var, | |||
388 | * Memory limit | 391 | * Memory limit |
389 | */ | 392 | */ |
390 | 393 | ||
391 | if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) { | 394 | size = var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8; |
392 | pr_info("%s: Memory Limit requested yres_virtual = %u\n", | 395 | if (size > info->fix.smem_len) { |
393 | __func__, var->yres_virtual); | 396 | dev_err(dev, "Memory limit exceeded, requested %dK\n", |
397 | size >> 10); | ||
394 | return -ENOMEM; | 398 | return -ENOMEM; |
395 | } | 399 | } |
396 | 400 | ||