summaryrefslogtreecommitdiffstats
path: root/drivers/video/auo_k190x.c
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2013-03-22 15:14:52 +0100
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-04 13:08:07 +0300
commit03fc1499f0fb28d4f70b83e8a05652129936486c (patch)
tree54f5ad60ae3d70b7bc47f4e469c325064ab96432 /drivers/video/auo_k190x.c
parent4e0ab85bb9097ecc422d4237f9eec155993f2902 (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>
Diffstat (limited to 'drivers/video/auo_k190x.c')
-rw-r--r--drivers/video/auo_k190x.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c
index 17f8d099b17..e078e20d4ad 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,
static int auok190xfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{
+ struct device *dev = info->device;
+ int size;
+
if (info->var.xres != var->xres || info->var.yres != var->yres ||
info->var.xres_virtual != var->xres_virtual ||
info->var.yres_virtual != var->yres_virtual) {
@@ -388,9 +391,10 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
* Memory limit
*/
- if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) {
- pr_info("%s: Memory Limit requested yres_virtual = %u\n",
- __func__, var->yres_virtual);
+ size = var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8;
+ if (size > info->fix.smem_len) {
+ dev_err(dev, "Memory limit exceeded, requested %dK\n",
+ size >> 10);
return -ENOMEM;
}