linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	linux-fbdev@vger.kernel.org, David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH 5/9] video: vesafb: use sysfb bus
Date: Sun, 17 Feb 2013 17:59:07 +0000	[thread overview]
Message-ID: <1361123951-587-6-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1361123951-587-1-git-send-email-dh.herrmann@gmail.com>

Instead of using our own platform device, we now register as sysfb driver
and get notified whenever we are loaded on a system VBE device. This
allows other VBE drivers to be loaded at the same time and users can
bind/unbind drivers via sysfs. We also no longer need to fake a
platform-device because the sysfb bus provides all devices now.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/video/Kconfig  |  1 +
 drivers/video/vesafb.c | 49 +++++++++++++++----------------------------------
 2 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d5723c2..5c23d32 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -776,6 +776,7 @@ config FB_VESA
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
 	select FB_BOOT_VESA_SUPPORT
+	select SYSFB
 	help
 	  This is the frame buffer device driver for generic VESA 2.0
 	  compliant graphic cards. The older VESA 1.2 cards are not supported.
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 4ad7b40..652858f 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -19,6 +19,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/screen_info.h>
+#include <linux/sysfb.h>
 
 #include <video/vga.h>
 #include <asm/io.h>
@@ -214,7 +215,7 @@ static int vesafb_setup(char *options)
 	return 0;
 }
 
-static int vesafb_probe(struct platform_device *dev)
+static int vesafb_probe(struct sysfb_device *dev)
 {
 	struct fb_info *info;
 	struct vesafb_par *par;
@@ -491,7 +492,7 @@ static int vesafb_probe(struct platform_device *dev)
 	}
 	printk(KERN_INFO "fb%d: %s frame buffer device\n",
 	       info->node, info->fix.id);
-	platform_set_drvdata(dev, info);
+	dev_set_drvdata(&dev->dev, info);
 	return 0;
 err:
 	if (info->screen_base)
@@ -501,59 +502,39 @@ err:
 	return err;
 }
 
-static int vesafb_remove(struct platform_device *dev)
+static void vesafb_remove(struct sysfb_device *dev)
 {
-	struct fb_info *info = platform_get_drvdata(dev);
+	struct fb_info *info = dev_get_drvdata(&dev->dev);
 
 	unregister_framebuffer(info);
-	return 0;
 }
 
-static struct platform_driver vesafb_driver = {
+static struct sysfb_driver vesafb_driver = {
+	.type_mask = SYSFB_VBE,
+	.allow_tainted = false,
+	.driver = {
+		.name = "vesafb",
+		.owner = THIS_MODULE,
+		.mod_name = KBUILD_MODNAME,
+	},
 	.probe = vesafb_probe,
 	.remove = vesafb_remove,
-	.driver	= {
-		.name	= "vesafb",
-	},
 };
 
-static struct platform_device *vesafb_device;
-
 static int __init vesafb_init(void)
 {
-	int ret;
 	char *option = NULL;
 
 	/* ignore error return of fb_get_options */
 	fb_get_options("vesafb", &option);
 	vesafb_setup(option);
 
-	vesafb_device = platform_device_alloc("vesafb", -1);
-	if (!vesafb_device)
-		return -ENOMEM;
-
-	ret = platform_driver_register(&vesafb_driver);
-	if (ret)
-		goto err_dev;
-
-	ret = platform_device_add(vesafb_device);
-	if (ret)
-		goto err_drv;
-
-	return 0;
-
-err_drv:
-	platform_driver_unregister(&vesafb_driver);
-err_dev:
-	platform_device_put(vesafb_device);
-	return ret;
+	return sysfb_register_driver(&vesafb_driver);
 }
 
 static void __exit vesafb_exit(void)
 {
-	platform_device_del(vesafb_device);
-	platform_device_put(vesafb_device);
-	platform_driver_unregister(&vesafb_driver);
+	sysfb_unregister_driver(&vesafb_driver);
 }
 
 module_init(vesafb_init);
-- 
1.8.1.3


  parent reply	other threads:[~2013-02-17 17:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-17 17:59 [PATCH 0/9] System Framebuffer Bus (sysfb) David Herrmann
2013-02-17 17:59 ` [PATCH 1/9] video: introduce system framebuffer bus David Herrmann
2013-02-17 17:59 ` [PATCH 2/9] video: sysfb: new vbefb device type David Herrmann
2013-02-17 17:59 ` [PATCH 3/9] video: sysfb: always provide vbefb device David Herrmann
2013-02-17 17:59 ` [PATCH 4/9] video: vesafb: allow building as module David Herrmann
2013-02-17 17:59 ` David Herrmann [this message]
2013-02-17 17:59 ` [PATCH 6/9] drm: new sysfb DRM bus module David Herrmann
2013-02-17 17:59 ` [PATCH 7/9] drm: new VESA BIOS Extension DRM driver stub David Herrmann
2013-02-17 17:59 ` [PATCH 8/9] drm: dvbe: implement VBE/VESA blitting backend David Herrmann
2013-02-17 17:59 ` [PATCH 9/9] drm: dvbe: add optional fbdev frontend David Herrmann
2013-02-17 22:02 ` [PATCH 0/9] System Framebuffer Bus (sysfb) Dave Airlie
2013-02-17 23:35   ` David Herrmann
2013-02-17 23:47     ` Dave Airlie
2013-02-28 12:20       ` David Herrmann
2013-02-28 13:22         ` Geert Uytterhoeven

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=1361123951-587-6-git-send-email-dh.herrmann@gmail.com \
    --to=dh.herrmann@gmail.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).