* [PATCH 4/9] AUO-K190x: make memory check in check_var more flexible
@ 2013-03-22 14:14 Heiko Stübner
0 siblings, 0 replies; only message in thread
From: Heiko Stübner @ 2013-03-22 14:14 UTC (permalink / raw)
To: linux-fbdev
Use only information from the new var to calculate the amount
of memory needed.
Signed-off-by: Heiko Stübner <heiko@sntech.de>
---
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 954b781..9cd9b7e 100644
--- a/drivers/video/auo_k190x.c
+++ b/drivers/video/auo_k190x.c
@@ -375,6 +375,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) {
@@ -387,9 +390,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;
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-03-22 14:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22 14:14 [PATCH 4/9] AUO-K190x: make memory check in check_var more flexible Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox