Thread (2 messages) 2 messages, 2 authors, 2003-09-15

Re: [PATCH] cyber2000fb: New framebuffer_alloc API and class_dev changes

From: Kronos <hidden>
Date: 2003-09-15 22:19:00

Possibly related (same subject, not in this thread)

Il Mon, Sep 15, 2003 at 10:40:42PM +0100, Russell King ha scritto: 
quoted
+static void release_cfb_info(struct fb_info *info) {
+	struct cfb_info *cfb = info->par;
+
+	iounmap(cfb->region);
+	fb_alloc_cmap(&info->cmap, 0, 0);
+
+	if (cfb->dev)
+		pci_release_regions(cfb->dev);
+}
+
 static void __devexit cyberpro_pci_remove(struct pci_dev *dev)
 {
 	struct cfb_info *cfb = pci_get_drvdata(dev);
@@ -1645,12 +1658,10 @@
 		 * we will be leaving hooks that could cause
 		 * oopsen laying around.
 		 */
-		if (unregister_framebuffer(&cfb->fb))
+		if (unregister_framebuffer(cfb->fb))
 			printk(KERN_WARNING "%s: danger Will Robinson, "
 				"danger danger!  Oopsen imminent!\n",
-				cfb->fb.fix.id);
-		iounmap(cfb->region);
-		cyberpro_free_fb_info(cfb);
+				cfb->fb->fix.id);
 
 		/*
 		 * Ensure that the driver data is no longer
@@ -1659,8 +1670,6 @@
 		pci_set_drvdata(dev, NULL);
 		if (cfb == int_cfb_info)
 			int_cfb_info = NULL;
-
-		pci_release_regions(dev);
 	}
 }
There is another reason why the above is fundamentally flawed - who says
that "release_cfb_info" will still be in module space by the time you
need to call it?

Eg, you unload your framebuffer driver module immediately after the device
has gone away, but someone is keeping the sysfs files associated with
the fb_info open.
I'm quite sure that this can't happen. If someone is keeping a sysfs
file open module use count won't be zero. Right?

Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Alcuni pensano che io sia una persona orribile, ma non vero. Ho il
cuore di un ragazzino - in un vaso sulla scrivania.


-------------------------------------------------------
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