Return-Path: <adaplas@hotpop.com>
Received: from localhost (bix [127.0.0.1])
	by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i7LDXvZS009593
	for <akpm@localhost>; Sat, 21 Aug 2004 06:34:00 -0700
Received: from bix [127.0.0.1]
	by localhost with POP3 (fetchmail-6.2.0)
	for akpm@localhost (single-drop); Sat, 21 Aug 2004 06:34:00 -0700 (PDT)
Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i7LDYa123710
	for <akpm@mail.gateway.osdl.net>; Sat, 21 Aug 2004 06:34:36 -0700
Received: from smtp-out.hotpop.com (smtp-out.hotpop.com [38.113.3.51])
	by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id i7LDYZSe000384
	for <akpm@osdl.org>; Sat, 21 Aug 2004 06:34:35 -0700
Received: from hotpop.com (kubrick.hotpop.com [38.113.3.103])
	by smtp-out.hotpop.com (Postfix) with SMTP id BFE1671A10
	for <akpm@osdl.org>; Sat, 21 Aug 2004 13:34:25 +0000 (UTC)
Received: from 203.177.116.184 (unknown [203.177.116.184])
	by smtp-2.hotpop.com (Postfix) with ESMTP
	id AF302749BF2; Sat, 21 Aug 2004 13:34:17 +0000 (UTC)
From: "Antonino A. Daplas" <adaplas@hotpop.com>
Reply-To: adaplas@pol.net
To: Andrew Morton <akpm@osdl.org>
Subject: [PATCH 1/9][FBDEV]: Do the deletion of mode entries at fbdev level
Date: Sat, 21 Aug 2004 21:33:04 +0800
User-Agent: KMail/1.5.4
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
MIME-Version: 1.0
Content-Disposition: inline
Message-Id: <200408212042.48584.adaplas@hotpop.com>
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-HotPOP: -----------------------------------------------
                   Sent By HotPOP.com FREE Email
             Get your FREE POP email at www.HotPOP.com
          -----------------------------------------------
X-MIMEDefang-Filter: osdl$Revision: 1.73 $
X-Scanned-By: MIMEDefang 2.36
X-Spam-Status: No, hits=-4.9 required=1.0 tests=BAYES_00 autolearn=ham 
	version=2.60
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on bix

Hi,

If a request for deletion of an entry in the mode database is requested, do 
it at core fbdev level instead of doing it at the console level.

Tony

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 console/fbcon.c |   12 ++++++------
 fbmem.c         |   24 ++++++++++++++++--------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff -uprN linux-2.6.8.1-mm3-orig/drivers/video/console/fbcon.c linux-2.6.8.1-mm3/drivers/video/console/fbcon.c
--- linux-2.6.8.1-mm3-orig/drivers/video/console/fbcon.c	2004-08-21 18:26:53.000000000 +0800
+++ linux-2.6.8.1-mm3/drivers/video/console/fbcon.c	2004-08-21 18:36:27.045024320 +0800
@@ -2671,8 +2671,8 @@ static void fbcon_modechanged(struct fb_
 	}
 }
 
-static void fbcon_mode_deleted(struct fb_info *info,
-			       struct fb_videomode *mode)
+static int fbcon_mode_deleted(struct fb_info *info,
+			      struct fb_videomode *mode)
 {
 	struct fb_info *fb_info;
 	struct display *p;
@@ -2694,8 +2694,7 @@ static void fbcon_mode_deleted(struct fb
 			break;
 		}
 	}
-	if (!found)
-		fb_delete_videomode(mode, &info->monspecs.modelist);
+	return found;
 }
 
 static int fbcon_event_notify(struct notifier_block *self, 
@@ -2704,6 +2703,7 @@ static int fbcon_event_notify(struct not
 	struct fb_event *event = (struct fb_event *) data;
 	struct fb_info *info = event->info;
 	struct fb_videomode *mode;
+	int ret = 0;
 
 	switch(action) {
 	case FB_EVENT_SUSPEND:
@@ -2717,11 +2717,11 @@ static int fbcon_event_notify(struct not
 		break;
 	case FB_EVENT_MODE_DELETE:
 		mode = (struct fb_videomode *) event->data;
-		fbcon_mode_deleted(info, mode);
+		ret = fbcon_mode_deleted(info, mode);
 		break;
 	}
 
-	return 0;
+	return ret;
 }
 
 /*
diff -uprN linux-2.6.8.1-mm3-orig/drivers/video/fbmem.c linux-2.6.8.1-mm3/drivers/video/fbmem.c
--- linux-2.6.8.1-mm3-orig/drivers/video/fbmem.c	2004-08-21 18:26:53.000000000 +0800
+++ linux-2.6.8.1-mm3/drivers/video/fbmem.c	2004-08-21 18:36:27.048023864 +0800
@@ -1089,18 +1089,26 @@ fb_set_var(struct fb_info *info, struct 
 
 	if (var->activate & FB_ACTIVATE_INV_MODE) {
 		struct fb_videomode mode1, mode2;
-		struct fb_event event;
+		int ret = 0;
 
 		fb_var_to_videomode(&mode1, var);
 		fb_var_to_videomode(&mode2, &info->var);
 		/* make sure we don't delete the videomode of current var */
-		if (fb_mode_is_equal(&mode1, &mode2))
-			return -EINVAL;
-		event.info = info;
-		event.data = &mode1;
-		notifier_call_chain(&fb_notifier_list, FB_EVENT_MODE_DELETE,
-				    &event);
-		return 0;
+		ret = fb_mode_is_equal(&mode1, &mode2);
+
+		if (!ret) {
+		    struct fb_event event;
+
+		    event.info = info;
+		    event.data = &mode1;
+		    ret = notifier_call_chain(&fb_notifier_list,
+					      FB_EVENT_MODE_DELETE, &event);
+		}
+
+		if (!ret)
+		    fb_delete_videomode(&mode1, &info->monspecs.modelist);
+
+		return ret;
 	}
 
 	if ((var->activate & FB_ACTIVATE_FORCE) ||
