linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesse Barnes <jesse.barnes@intel.com>
To: linux-kernel@vger.kernel.org
Cc: "Antonino A. Daplas" <adaplas@gmail.com>,
	James Simmons <jsimmons@pentafluge.infradead.org>,
	Dave Airlie <airlied@gmail.com>,
	"Jakob Bornecrantz" <wallbraker@gmail.com>,
	dri-devel@lists.sourceforge.net
Subject: [PATCH 1/3] allow console unregistration
Date: Thu, 17 May 2007 15:32:28 -0700	[thread overview]
Message-ID: <200705171532.28799.jesse.barnes@intel.com> (raw)
In-Reply-To: <200705171423.46748.jesse.barnes@intel.com>

Randy just informed me that the patch limits are bigger now, so here are the
actual patches.

This patch allows for proper console unregistration via the VT layer, and
updates the FB layer to use it.  This makes debugging new console drivers
much easier, since you can properly clean them up before unloading.
Antonio already checked it out (and suggested a tweak for the fbcon side)
so I think it's on its way already via the FB tree.

Jesse

--- linux-2.6.21-rc4/drivers/video/fbmem.c	2007-03-15 17:20:01.000000000 -0700
+++ linux-2.6.21-rc4-modesetting/drivers/video/fbmem.c	2007-04-26 18:16:52.000000000 -0700
@@ -1349,6 +1349,8 @@
 	if (!registered_fb[i])
 		return -EINVAL;
 
+	event.info = fb_info;
+	fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
 	if (fb_info->pixmap.addr &&
 	    (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
 		kfree(fb_info->pixmap.addr);
--- linux-2.6.21-rc4/include/linux/fb.h	2007-03-15 17:20:01.000000000 -0700
+++ linux-2.6.21-rc4-modesetting/include/linux/fb.h	2007-04-26 17:33:07.000000000 -0700
@@ -525,6 +525,8 @@
 #define FB_EVENT_MODE_CHANGE_ALL	0x0B
 /*	A software display blank change occured */
 #define FB_EVENT_CONBLANK               0x0C
+/*      Unbind from the console if possible */
+#define FB_EVENT_FB_UNBIND              0x0E
 
 struct fb_event {
 	struct fb_info *info;
--- linux-2.6.21-rc4/include/linux/console.h	2007-03-15 17:20:01.000000000 -0700
+++ linux-2.6.21-rc4-modesetting/include/linux/console.h	2007-04-26 17:56:31.000000000 -0700
@@ -64,6 +64,7 @@
 extern const struct consw newport_con;	/* SGI Newport console  */
 extern const struct consw prom_con;	/* SPARC PROM console */
 
+int unbind_con_driver(const struct consw *csw, int first, int last, int deflt);
 int con_is_bound(const struct consw *csw);
 int register_con_driver(const struct consw *csw, int first, int last);
 int unregister_con_driver(const struct consw *csw);
--- linux-2.6.21-rc4/drivers/video/console/fbcon.c	2007-03-15 17:20:01.000000000 -0700
+++ linux-2.6.21-rc4-modesetting/drivers/video/console/fbcon.c	2007-04-26 18:15:49.000000000 -0700
@@ -563,8 +563,10 @@
 	for (i = first_fb_vc; i <= last_fb_vc; i++)
 		con2fb_map[i] = info_idx;
 
+	printk(KERN_ERR "calling take_over_console, return value: ");
 	err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
 				fbcon_is_default);
+	printk(KERN_ERR "%d\n", err);
 
 	if (err) {
 		for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -2896,6 +2898,13 @@
 	return found;
 }
 
+static int fbcon_fb_unbind(int idx)
+{
+	unbind_con_driver(&fb_con, 0, MAX_NR_CONSOLES - 1, 0);
+
+	return 0;
+}
+
 static int fbcon_fb_unregistered(int idx)
 {
 	int i;
@@ -2933,6 +2942,7 @@
 {
 	int ret = 0, i;
 
+	printk(KERN_ERR "fbcon registration called\n");
 	if (info_idx == -1) {
 		for (i = first_fb_vc; i <= last_fb_vc; i++) {
 			if (con2fb_map_boot[i] == idx) {
@@ -2941,8 +2951,10 @@
 			}
 		}
 
-		if (info_idx != -1)
+		if (info_idx != -1) {
+			printk(KERN_ERR "fb taking over console\n");
 			ret = fbcon_takeover(1);
+		}
 	} else {
 		for (i = first_fb_vc; i <= last_fb_vc; i++) {
 			if (con2fb_map_boot[i] == idx &&
@@ -3036,6 +3048,9 @@
 		mode = event->data;
 		ret = fbcon_mode_deleted(info, mode);
 		break;
+	case FB_EVENT_FB_UNBIND:
+		ret = fbcon_fb_unbind(info->node);
+		break;
 	case FB_EVENT_FB_REGISTERED:
 		ret = fbcon_fb_registered(info->node);
 		break;
--- linux-2.6.21-rc4/drivers/char/vt.c	2007-03-15 17:20:01.000000000 -0700
+++ linux-2.6.21-rc4-modesetting/drivers/char/vt.c	2007-04-26 18:22:42.000000000 -0700
@@ -2832,8 +2832,24 @@
 	return retval;
 }
 
-static int unbind_con_driver(const struct consw *csw, int first, int last,
-			     int deflt)
+/**
+ * unbind_con_driver - unbind a console driver
+ * @csw: pointer to console driver to unregister
+ * @first: first in range of consoles that @csw should be unbound from
+ * @last: last in range of consoles that @csw should be unbound from
+ * @deflt: should next bound console driver be default after @csw is unbound?
+ * 
+ * To unbind a driver from all possible consoles, pass 0 as @first and
+ * %MAX_NR_CONSOLES as @last.
+ *
+ * @deflt controls whether the console that ends up replacing @csw should be
+ * the default console.
+ *
+ * RETURNS:
+ * -ENODEV if @csw isn't a registered console driver or can't be unregistered
+ * or 0 on success.
+ */
+int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
 {
 	struct module *owner = csw->owner;
 	const struct consw *defcsw = NULL;
@@ -2918,6 +2934,7 @@
 	return retval;
 
 }
+EXPORT_SYMBOL(unbind_con_driver);
 
 static int vt_bind(struct con_driver *con)
 {

  reply	other threads:[~2007-05-17 22:32 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 21:23 [RFC] enhancing the kernel's graphics subsystem Jesse Barnes
2007-05-17 22:32 ` Jesse Barnes [this message]
2007-05-17 22:47   ` [PATCH 1/3] allow console unregistration Jesse Barnes
2007-05-17 23:23   ` Antonino A. Daplas
2007-05-18  0:56     ` Jesse Barnes
2007-05-22 21:43     ` [PATCH 1/2] " Jesse Barnes
2007-05-23  0:49       ` Antonino A. Daplas
2007-05-22 21:44     ` [PATCH 2/2] make fbcon unregister when unloaded Jesse Barnes
2007-05-22 22:05       ` Randy Dunlap
2007-05-22 22:14         ` Jesse Barnes
2007-05-23  0:47           ` Antonino A. Daplas
2007-05-30  0:00   ` [PATCH 1/3] allow console unregistration Antonino A. Daplas
2007-05-30  6:26     ` Geert Uytterhoeven
2007-05-17 22:37 ` [PATCH 2/3] drm modesetting core Jesse Barnes
2007-05-17 22:48   ` Jesse Barnes
2007-05-17 23:41   ` Luca Tettamanti
2007-05-18  1:04     ` Jesse Barnes
2007-05-18 19:33       ` Luca Tettamanti
2007-05-18 21:06         ` Jesse Barnes
2007-05-17 22:40 ` [PATCH 3/3] Intel support for DRM modesetting Jesse Barnes
2007-05-17 22:48   ` Jesse Barnes
2007-05-20 17:42 ` [RFC] enhancing the kernel's graphics subsystem Jon Smirl
2007-05-20 23:10   ` Jesse Barnes
2007-05-21  0:47     ` Jon Smirl
2007-05-21  1:29       ` Jeff Garzik
2007-05-21 15:34         ` Jon Smirl
2007-05-21 16:15           ` Arjan van de Ven
2007-05-21 15:09       ` Jesse Barnes
2007-05-21 16:01         ` Jon Smirl
2007-05-21 16:14           ` Jesse Barnes
2007-05-21 16:34             ` Jesse Barnes
2007-05-21 17:05               ` Jon Smirl
2007-05-21 17:14                 ` Dave Airlie
2007-05-21 17:29                   ` Jon Smirl
2007-05-21 17:42                   ` Jon Smirl
2007-05-21 17:47                     ` Dave Airlie
2007-05-21 18:04                       ` Jon Smirl
2007-05-21 18:44                         ` Dave Airlie
2007-05-21 19:10                           ` Jon Smirl
2007-05-21 19:20                             ` Dave Airlie
2007-05-21 23:24                             ` Jeff Garzik
2007-05-22  0:08                               ` Jon Smirl
2007-05-22  0:20                     ` Benjamin Herrenschmidt
2007-05-21 23:21                   ` Jeff Garzik
2007-05-22  0:35                     ` Alan Cox
2007-05-22  0:33                       ` Jeff Garzik
2007-05-22  0:45                       ` Jon Smirl
2007-05-22  0:56                         ` Jon Smirl
2007-05-22  8:21                           ` Dave Airlie
2007-05-22  8:07                     ` Dave Airlie
2007-05-22  8:16                       ` Jeff Garzik
2007-05-22  8:27                         ` Dave Airlie
2007-05-22 16:06                         ` Jon Smirl
2007-05-22 16:19                           ` Alan Cox
2007-05-22 16:34                           ` Jeff Garzik
2007-05-22  0:15                   ` Benjamin Herrenschmidt
2007-05-21 17:32                 ` Jesse Barnes
2007-05-21 23:18                 ` Jeff Garzik
2007-05-22  0:26                   ` Jon Smirl
2007-05-22  1:56                     ` Jesse Barnes
2007-05-22 14:27                       ` Jon Smirl
2007-05-22 14:35                         ` Dave Airlie
2007-05-22 15:13                           ` Jon Smirl
2007-05-22 17:25                             ` Dave Airlie
2007-05-22 19:58                               ` Jon Smirl
2007-05-28 20:12                                 ` Pavel Machek
2007-05-28 20:57                                   ` Jon Smirl
2007-05-29 14:26                                     ` Pavel Machek
2007-05-29 16:51                                       ` Jon Smirl
2007-05-22 14:54                         ` Alan Cox
2007-05-22 15:16                           ` Jon Smirl
2007-05-22 15:46                             ` Jesse Barnes
2007-05-22 16:02                               ` Jon Smirl
2007-05-22 16:14                                 ` Alan Cox
2007-05-22 16:15                                 ` Jesse Barnes
2007-05-22 16:32                                   ` Jon Smirl
2007-05-22 16:35                                     ` Jeff Garzik
2007-05-22 16:51                                     ` Jesse Barnes
2007-05-22 15:59                             ` Matthew Garrett
2007-05-21 16:16           ` Dave Airlie
2007-05-21  8:27   ` Dave Airlie
2007-05-21  9:09     ` Helge Hafting
2007-05-21  9:27       ` Dave Airlie
2007-05-21  9:44         ` Helge Hafting
2007-05-21 15:57           ` Jesse Barnes
2007-05-21 16:07             ` Jon Smirl
2007-05-21 16:27               ` Dave Airlie
2007-05-21 16:50                 ` Xavier Bestel
2007-05-22  0:09 ` Benjamin Herrenschmidt
2007-05-22  0:51   ` Keith Packard
2007-05-22  2:48     ` Benjamin Herrenschmidt
2007-05-22 15:39   ` Jesse Barnes
2007-05-22 23:26     ` Benjamin Herrenschmidt
2007-05-22 23:36       ` Jesse Barnes
2007-05-23  0:40         ` Antonino A. Daplas
2007-05-23 12:19       ` Helge Hafting
2007-05-22 16:29   ` Philipp Klaus Krause
2007-05-22 16:57     ` Jesse Barnes
2007-05-22 18:18     ` Dave Airlie
2007-05-22  2:56 ` l l

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705171532.28799.jesse.barnes@intel.com \
    --to=jesse.barnes@intel.com \
    --cc=adaplas@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=jsimmons@pentafluge.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wallbraker@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).