Commit 1a6c2119 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Clean up framebuffer initialization

This patch probably deserves discussion among developers.

Currently, the framebuffer system is initialized in a roundabout manner.
First, drivers/char/mem.c calls fbmem_init().  fbmem_init() will then
iterate over an array of individual drivers' xxxfb_init(), then each driver
registers its presence back to fbmem.  During console_init(),
drivers/char/vt.c will call fb_console_init().  fbcon will check for
registered drivers, and if any are present, will call take_over_console()
in drivers/char/vt.c.

This patch changes the initialization sequence so it proceeds in this
manner: Each driver has its own module_init().  Each driver calls
register_framebuffer() in fbmem.c.  fbmem.c will then notify fbcon of the
driver registration.  Upon notification, fbcon calls take_over_console() in
vt.c.

The following are the changes brought about by this patch:

- Each subsystem (fbcon, fbmem, xxxfb) will have their own module_init. 
  Thus, explicit calls to each subsystem's init functions are eliminated.

- The struct fb_drivers array in fbmem.c can be removed.  This slashes
  around 400 lines in fbmem.c

- Parsing of kernel boot options were done by fbmem.c calling each
  driver's xxxfb_setup() function.  Because this is not possible with this
  patch, drivers can choose to either:

  - have their own __setup() routine

  - call fb_get_options("xxxfb") and pass the return value to
    xxxfb_setup().  This is to maintain compatibility with the
    'video=xxxfb:<options>' semantics.

- Getting a framebuffer console will occur a bit late during the boot
  process since the initialization sequence will depend upon the link
  order.  So, 'video/' is moved up in drivers/Makefile, shortly after
  'pci/'

- Because driver initialization will be dependent on the link order,
  hardware that depends on other subsystems (agpgart, usb, serial, etc) may
  choose to initialize after the subsystems they depend on. 
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f5ec16b7
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
obj-$(CONFIG_PCI) += pci/ obj-$(CONFIG_PCI) += pci/
obj-$(CONFIG_PARISC) += parisc/ obj-$(CONFIG_PARISC) += parisc/
obj-y += video/
obj-$(CONFIG_ACPI_BOOT) += acpi/ obj-$(CONFIG_ACPI_BOOT) += acpi/
# PnP must come after ACPI since it will eventually need to check if acpi # PnP must come after ACPI since it will eventually need to check if acpi
# was used and do nothing if so # was used and do nothing if so
...@@ -26,7 +27,7 @@ obj-$(CONFIG_FC4) += fc4/ ...@@ -26,7 +27,7 @@ obj-$(CONFIG_FC4) += fc4/
obj-$(CONFIG_SCSI) += scsi/ obj-$(CONFIG_SCSI) += scsi/
obj-$(CONFIG_FUSION) += message/ obj-$(CONFIG_FUSION) += message/
obj-$(CONFIG_IEEE1394) += ieee1394/ obj-$(CONFIG_IEEE1394) += ieee1394/
obj-y += cdrom/ video/ obj-y += cdrom/
obj-$(CONFIG_MTD) += mtd/ obj-$(CONFIG_MTD) += mtd/
obj-$(CONFIG_PCMCIA) += pcmcia/ obj-$(CONFIG_PCMCIA) += pcmcia/
obj-$(CONFIG_DIO) += dio/ obj-$(CONFIG_DIO) += dio/
......
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
# include <linux/efi.h> # include <linux/efi.h>
#endif #endif
#ifdef CONFIG_FB
extern void fbmem_init(void);
#endif
#if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR) #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
extern void tapechar_init(void); extern void tapechar_init(void);
#endif #endif
...@@ -730,9 +727,6 @@ static int __init chr_dev_init(void) ...@@ -730,9 +727,6 @@ static int __init chr_dev_init(void)
S_IFCHR | devlist[i].mode, devlist[i].name); S_IFCHR | devlist[i].mode, devlist[i].name);
} }
#if defined (CONFIG_FB)
fbmem_init();
#endif
return 0; return 0;
} }
......
...@@ -136,9 +136,6 @@ extern void prom_con_init(void); ...@@ -136,9 +136,6 @@ extern void prom_con_init(void);
#ifdef CONFIG_MDA_CONSOLE #ifdef CONFIG_MDA_CONSOLE
extern int mda_console_init(void); extern int mda_console_init(void);
#endif #endif
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
extern int fb_console_init(void);
#endif
struct vc vc_cons [MAX_NR_CONSOLES]; struct vc vc_cons [MAX_NR_CONSOLES];
...@@ -2671,9 +2668,6 @@ int __init vty_init(void) ...@@ -2671,9 +2668,6 @@ int __init vty_init(void)
#endif #endif
#ifdef CONFIG_MDA_CONSOLE #ifdef CONFIG_MDA_CONSOLE
mda_console_init(); mda_console_init();
#endif
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
fb_console_init();
#endif #endif
return 0; return 0;
} }
......
...@@ -13,6 +13,7 @@ ifeq ($(CONFIG_FB),y) ...@@ -13,6 +13,7 @@ ifeq ($(CONFIG_FB),y)
obj-$(CONFIG_PPC) += macmodes.o obj-$(CONFIG_PPC) += macmodes.o
endif endif
obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_ACORN) += acornfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_ACORN) += acornfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o
...@@ -40,16 +41,12 @@ obj-$(CONFIG_FB_3DFX) += cfbfillrect.o cfbcopyarea.o ...@@ -40,16 +41,12 @@ obj-$(CONFIG_FB_3DFX) += cfbfillrect.o cfbcopyarea.o
endif endif
obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_IMSTT) += imsttfb.o cfbimgblt.o obj-$(CONFIG_FB_IMSTT) += imsttfb.o cfbimgblt.o
obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_TRIDENT) += tridentfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_TRIDENT) += tridentfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_S3TRIO) += S3triofb.o obj-$(CONFIG_FB_S3TRIO) += S3triofb.o
obj-$(CONFIG_FB_TGA) += tgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_TGA) += tgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VGA16) += vga16fb.o cfbfillrect.o cfbcopyarea.o \
cfbimgblt.o vgastate.o
obj-$(CONFIG_FB_VIRGE) += virgefb.o obj-$(CONFIG_FB_VIRGE) += virgefb.o
obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
...@@ -71,7 +68,6 @@ obj-$(CONFIG_FB_I810) += i810/ cfbfillrect.o cfbcopyarea.o \ ...@@ -71,7 +68,6 @@ obj-$(CONFIG_FB_I810) += i810/ cfbfillrect.o cfbcopyarea.o \
obj-$(CONFIG_FB_SUN3) += sun3fb.o obj-$(CONFIG_FB_SUN3) += sun3fb.o
obj-$(CONFIG_FB_HGA) += hgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_HGA) += hgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbimgblt.o obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_PVR2) += pvr2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
...@@ -94,3 +90,7 @@ obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o cfbimgblt.o cfbcopyarea.o ...@@ -94,3 +90,7 @@ obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \
cfbfillrect.o cfbfillrect.o
obj-$(CONFIG_FB_PXA) += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o obj-$(CONFIG_FB_PXA) += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o
obj-$(CONFIG_FB_VGA16) += vga16fb.o cfbfillrect.o cfbcopyarea.o \
cfbimgblt.o vgastate.o
obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
...@@ -2860,6 +2860,8 @@ int __init fb_console_init(void) ...@@ -2860,6 +2860,8 @@ int __init fb_console_init(void)
return 0; return 0;
} }
module_init(fb_console_init);
#ifdef MODULE #ifdef MODULE
void __exit fb_console_exit(void) void __exit fb_console_exit(void)
...@@ -2870,7 +2872,6 @@ void __exit fb_console_exit(void) ...@@ -2870,7 +2872,6 @@ void __exit fb_console_exit(void)
give_up_console(&fb_con); give_up_console(&fb_con);
} }
module_init(fb_console_init);
module_exit(fb_console_exit); module_exit(fb_console_exit);
#endif #endif
......
This diff is collapsed.
...@@ -708,6 +708,7 @@ extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, ...@@ -708,6 +708,7 @@ extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
extern void fb_load_cursor_image(struct fb_info *); extern void fb_load_cursor_image(struct fb_info *);
extern void fb_set_suspend(struct fb_info *info, int state); extern void fb_set_suspend(struct fb_info *info, int state);
extern int fb_get_color_depth(struct fb_info *info); extern int fb_get_color_depth(struct fb_info *info);
extern char* fb_get_options(char *name);
extern struct fb_info *registered_fb[FB_MAX]; extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb; extern int num_registered_fb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment