All of lore.kernel.org
 help / color / mirror / Atom feed
* Geode now shows up in sysfs.
@ 2005-07-01 23:37 James Simmons
  2005-07-04 10:09 ` David Vrabel
  0 siblings, 1 reply; 6+ messages in thread
From: James Simmons @ 2005-07-01 23:37 UTC (permalink / raw)
  To: Linux Fbdev development list
  Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz


Going through the drivers I noticed two drivers using framebuffer_alloc 
without a sturct device, Mach64 for atari and geode. Here is a patch for 
geode. The mach64 will take a bit longer to figure. Please test. Thank 
you.

diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/gx1fb_core.c fbdev-2.6/drivers/video/geode/gx1fb_core.c
--- linus-2.6/drivers/video/geode/gx1fb_core.c	2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/gx1fb_core.c	2005-07-01 09:18:25.000000000 -0700
@@ -216,13 +216,13 @@
 	.fb_cursor	= soft_cursor,
 };
 
-static struct fb_info * __init gx1fb_init_fbinfo(void)
+static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
 {
-	struct fb_info *info;
 	struct geodefb_par *par;
-
+	struct fb_info *info;
+	
 	/* Alloc enough space for the pseudo palette. */
-	info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, NULL);
+	info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev);
 	if (!info)
 		return NULL;
 
@@ -263,25 +263,16 @@
 	return info;
 }
 
-
-static struct fb_info *gx1fb_info;
-
-static int __init gx1fb_init(void)
+static int __init gx1fb_probe(struct device *device)
 {
+	struct platform_device *dev = to_platform_device(device);
+	struct geodefb_par *par;
 	struct fb_info *info;
-        struct geodefb_par *par;
 	int ret;
 
-#ifndef MODULE
-	if (fb_get_options("gx1fb", NULL))
-		return -ENODEV;
-#endif
-
-	info = gx1fb_init_fbinfo();
+	info = gx1fb_init_fbinfo(&dev->dev);
 	if (!info)
 		return -ENOMEM;
-	gx1fb_info = info;
-
 	par = info->par;
 
 	/* GX1 display controller and CS5530 video device */
@@ -310,6 +301,7 @@
 		ret = -EINVAL;
 		goto err;
 	}
+	dev_set_drvdata(&dev->dev, info);
 	printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
 	return 0;
 
@@ -327,10 +319,10 @@
 	return ret;
 }
 
-static void __exit gx1fb_cleanup(void)
+static int gx1fb_remove(struct device *device)
 {
-	struct fb_info *info = gx1fb_info;
-	struct geodefb_par *par = gx1fb_info->par;
+	struct fb_info *info = dev_get_drvdata(device);
+	struct geodefb_par *par = info->par;
 
 	unregister_framebuffer(info);
 
@@ -341,6 +333,40 @@
 	pci_dev_put(par->vid_dev);
 
 	framebuffer_release(info);
+	return 0;
+}
+
+static struct platform_device *gx1fb_device;
+
+static struct device_driver gx1fb_driver = {
+	.name	= "geodefb",
+	.bus	= &platform_bus_type,
+	.probe	= gx1fb_probe,
+	.remove = gx1fb_remove,
+};
+
+static int __init gx1fb_init(void)
+{
+	int ret = 0;
+
+#ifndef MODULE
+	if (fb_get_options("gx1fb", NULL))
+		return -ENODEV;
+#endif
+	gx1fb_device = platform_device_register_simple("geodefb", -1, NULL, 0);
+	if (IS_ERR(gx1fb_device))
+		return PTR_ERR(gx1fb_device);
+
+	ret = driver_register(&gx1fb_driver);
+	if (ret < 0)
+		platform_device_unregister(gx1fb_device);
+	return ret;
+}
+
+static void __exit gx1fb_cleanup(void)
+{
+	platform_device_unregister(gx1fb_device);
+	driver_unregister(&gx1fb_driver);
 }
 
 module_init(gx1fb_init);


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-07-07 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-01 23:37 Geode now shows up in sysfs James Simmons
2005-07-04 10:09 ` David Vrabel
2005-07-06 22:31   ` James Simmons
2005-07-06 23:04     ` James Simmons
2005-07-07 16:09     ` David Vrabel
2005-07-07 19:55       ` James Simmons

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.