diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-08-02 08:05:25 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-08-02 19:17:49 -0400 |
commit | 2e5155ecbb729d3a2e7d1cea7c18493516fec55a (patch) | |
tree | a608024b297cfb14ea4713fb409d9119dc454e68 | |
parent | 9a6a36d19c9d24479300511e23933876a4a9cf82 (diff) |
fbdev: vesafb: bind to platform-framebuffer device
x86 creates platform-framebuffer platform devices for every system
framebuffer. Use these instead of creating a dummy device.
This requires us to remove the __init annotations as hotplugging may occur
during runtime.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Link: http://lkml.kernel.org/r/1375445127-15480-7-git-send-email-dh.herrmann@gmail.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | drivers/video/vesafb.c | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 501b3406c6d5..bd83233ec227 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | /* --------------------------------------------------------------------- */ | 30 | /* --------------------------------------------------------------------- */ |
31 | 31 | ||
32 | static struct fb_var_screeninfo vesafb_defined __initdata = { | 32 | static struct fb_var_screeninfo vesafb_defined = { |
33 | .activate = FB_ACTIVATE_NOW, | 33 | .activate = FB_ACTIVATE_NOW, |
34 | .height = -1, | 34 | .height = -1, |
35 | .width = -1, | 35 | .width = -1, |
@@ -40,7 +40,7 @@ static struct fb_var_screeninfo vesafb_defined __initdata = { | |||
40 | .vmode = FB_VMODE_NONINTERLACED, | 40 | .vmode = FB_VMODE_NONINTERLACED, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct fb_fix_screeninfo vesafb_fix __initdata = { | 43 | static struct fb_fix_screeninfo vesafb_fix = { |
44 | .id = "VESA VGA", | 44 | .id = "VESA VGA", |
45 | .type = FB_TYPE_PACKED_PIXELS, | 45 | .type = FB_TYPE_PACKED_PIXELS, |
46 | .accel = FB_ACCEL_NONE, | 46 | .accel = FB_ACCEL_NONE, |
@@ -48,8 +48,8 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { | |||
48 | 48 | ||
49 | static int inverse __read_mostly; | 49 | static int inverse __read_mostly; |
50 | static int mtrr __read_mostly; /* disable mtrr */ | 50 | static int mtrr __read_mostly; /* disable mtrr */ |
51 | static int vram_remap __initdata; /* Set amount of memory to be used */ | 51 | static int vram_remap; /* Set amount of memory to be used */ |
52 | static int vram_total __initdata; /* Set total amount of memory */ | 52 | static int vram_total; /* Set total amount of memory */ |
53 | static int pmi_setpal __read_mostly = 1; /* pmi for palette changes ??? */ | 53 | static int pmi_setpal __read_mostly = 1; /* pmi for palette changes ??? */ |
54 | static int ypan __read_mostly; /* 0..nothing, 1..ypan, 2..ywrap */ | 54 | static int ypan __read_mostly; /* 0..nothing, 1..ypan, 2..ywrap */ |
55 | static void (*pmi_start)(void) __read_mostly; | 55 | static void (*pmi_start)(void) __read_mostly; |
@@ -192,7 +192,7 @@ static struct fb_ops vesafb_ops = { | |||
192 | .fb_imageblit = cfb_imageblit, | 192 | .fb_imageblit = cfb_imageblit, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static int __init vesafb_setup(char *options) | 195 | static int vesafb_setup(char *options) |
196 | { | 196 | { |
197 | char *this_opt; | 197 | char *this_opt; |
198 | 198 | ||
@@ -226,13 +226,18 @@ static int __init vesafb_setup(char *options) | |||
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | static int __init vesafb_probe(struct platform_device *dev) | 229 | static int vesafb_probe(struct platform_device *dev) |
230 | { | 230 | { |
231 | struct fb_info *info; | 231 | struct fb_info *info; |
232 | int i, err; | 232 | int i, err; |
233 | unsigned int size_vmode; | 233 | unsigned int size_vmode; |
234 | unsigned int size_remap; | 234 | unsigned int size_remap; |
235 | unsigned int size_total; | 235 | unsigned int size_total; |
236 | char *option = NULL; | ||
237 | |||
238 | /* ignore error return of fb_get_options */ | ||
239 | fb_get_options("vesafb", &option); | ||
240 | vesafb_setup(option); | ||
236 | 241 | ||
237 | if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) | 242 | if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) |
238 | return -ENODEV; | 243 | return -ENODEV; |
@@ -496,40 +501,12 @@ err: | |||
496 | } | 501 | } |
497 | 502 | ||
498 | static struct platform_driver vesafb_driver = { | 503 | static struct platform_driver vesafb_driver = { |
499 | .driver = { | 504 | .driver = { |
500 | .name = "vesafb", | 505 | .name = "vesa-framebuffer", |
506 | .owner = THIS_MODULE, | ||
501 | }, | 507 | }, |
508 | .probe = vesafb_probe, | ||
502 | }; | 509 | }; |
503 | 510 | ||
504 | static struct platform_device *vesafb_device; | 511 | module_platform_driver(vesafb_driver); |
505 | |||
506 | static int __init vesafb_init(void) | ||
507 | { | ||
508 | int ret; | ||
509 | char *option = NULL; | ||
510 | |||
511 | /* ignore error return of fb_get_options */ | ||
512 | fb_get_options("vesafb", &option); | ||
513 | vesafb_setup(option); | ||
514 | |||
515 | vesafb_device = platform_device_alloc("vesafb", 0); | ||
516 | if (!vesafb_device) | ||
517 | return -ENOMEM; | ||
518 | |||
519 | ret = platform_device_add(vesafb_device); | ||
520 | if (!ret) { | ||
521 | ret = platform_driver_probe(&vesafb_driver, vesafb_probe); | ||
522 | if (ret) | ||
523 | platform_device_del(vesafb_device); | ||
524 | } | ||
525 | |||
526 | if (ret) { | ||
527 | platform_device_put(vesafb_device); | ||
528 | vesafb_device = NULL; | ||
529 | } | ||
530 | |||
531 | return ret; | ||
532 | } | ||
533 | module_init(vesafb_init); | ||
534 | |||
535 | MODULE_LICENSE("GPL"); | 512 | MODULE_LICENSE("GPL"); |