Module unloading

2 messages, 2 authors, 2002-11-09 · open the first message on its own page

Module unloading

From: Antonino Daplas <hidden>
Date: 2002-11-02 21:36:31

Hi James,

Regarding your latest patch, if the framebuffer console is not defined,
then the module_use_count should not be incremented and the device
should not be opened.  This will prevent the module from being unloaded.

Attached is a patch against 2.5.45 + your fbdev.diff.

Tony

diff -Naur linux-2.5.45-fbdev/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.5.45-fbdev/drivers/video/fbmem.c	Sat Nov  2 21:21:06 2002
+++ linux/drivers/video/fbmem.c	Sat Nov  2 21:24:29 2002
@@ -726,8 +726,8 @@
 int
 register_framebuffer(struct fb_info *fb_info)
 {
-	static int fb_ever_opened[FB_MAX];
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
+	static int fb_ever_opened[FB_MAX];
 	static int first = 1;
 	int j;
 #endif
@@ -743,9 +743,9 @@
 	fb_info->node = mk_kdev(FB_MAJOR, i);
 	fb_info->currcon = -1;
 	registered_fb[i] = fb_info;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
 	if (!fb_ever_opened[i]) {
 		struct module *owner = fb_info->fbops->owner;
-#ifdef CONFIG_FRAMEBUFFER_CONSOLE
 		/*
 		 *  We assume initial frame buffer devices can be opened this
 		 *  many times
@@ -767,14 +767,6 @@
 	if (first) {
 		first = 0;
 		take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
-	}
-#else
-		if (owner) {
-			__MOD_INC_USE_COUNT(owner);
-			if (fb_info->fbops->fb_open && fb_info->fbops->fb_open(fb_info,0))
-				__MOD_DEC_USE_COUNT(owner);
-		}
-		fb_ever_opened[i] = 1;
 	}
 #endif
 	sprintf (name_buf, "%d", i);





-------------------------------------------------------
This SF.net email is sponsored by: ApacheCon, November 18-21 in
Las Vegas (supported by COMDEX), the only Apache event to be
fully supported by the ASF. http://www.apachecon.com

Re: Module unloading

From: James Simmons <hidden>
Date: 2002-11-09 00:45:29

Regarding your latest patch, if the framebuffer console is not defined,
then the module_use_count should not be incremented and the device
should not be opened.  This will prevent the module from being unloaded.

Attached is a patch against 2.5.45 + your fbdev.diff.
Applied and tested. I could insmod and rmmod various fbdev drivers. 
Yeah!!!





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help