Commit 256154fb authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

[PATCH] fbdev: statically link the framebuffer notification functions

The backlight and lcd subsystems can be notified by the framebuffer layer
of blanking events.  However, these subsystems, as a whole, can function
independently from the framebuffer layer.  But in order to enable to the
lcd and backlight subsystems, the framebuffer has to be compiled also,
effectively sucking in a huge amount of unneeded code.

To prevent dependency problems, separate out the framebuffer notification
mechanism from the framebuffer layer and permanently link it to the kernel.
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 834a9b8c
...@@ -1620,7 +1620,7 @@ if FB || SGI_NEWPORT_CONSOLE ...@@ -1620,7 +1620,7 @@ if FB || SGI_NEWPORT_CONSOLE
source "drivers/video/logo/Kconfig" source "drivers/video/logo/Kconfig"
endif endif
if FB && SYSFS if SYSFS
source "drivers/video/backlight/Kconfig" source "drivers/video/backlight/Kconfig"
endif endif
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# Each configuration option enables a list of files. # Each configuration option enables a list of files.
obj-y += fb_notify.o
obj-$(CONFIG_FB) += fb.o obj-$(CONFIG_FB) += fb.o
fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
modedb.o fbcvt.o modedb.o fbcvt.o
......
...@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT ...@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT
config BACKLIGHT_CLASS_DEVICE config BACKLIGHT_CLASS_DEVICE
tristate "Lowlevel Backlight controls" tristate "Lowlevel Backlight controls"
depends on BACKLIGHT_LCD_SUPPORT && FB depends on BACKLIGHT_LCD_SUPPORT
default m default m
help help
This framework adds support for low-level control of the LCD This framework adds support for low-level control of the LCD
...@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE ...@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE
config LCD_CLASS_DEVICE config LCD_CLASS_DEVICE
tristate "Lowlevel LCD controls" tristate "Lowlevel LCD controls"
depends on BACKLIGHT_LCD_SUPPORT && FB depends on BACKLIGHT_LCD_SUPPORT
default m default m
help help
This framework adds support for low-level control of LCD. This framework adds support for low-level control of LCD.
......
/*
* linux/drivers/video/fb_notify.c
*
* Copyright (C) 2006 Antonino Daplas <adaplas@pol.net>
*
* 2001 - Documented with DocBook
* - Brad Douglas <brad@neruo.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
#include <linux/fb.h>
#include <linux/notifier.h>
static BLOCKING_NOTIFIER_HEAD(fb_notifier_list);
/**
* fb_register_client - register a client notifier
* @nb: notifier block to callback on events
*/
int fb_register_client(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&fb_notifier_list, nb);
}
EXPORT_SYMBOL(fb_register_client);
/**
* fb_unregister_client - unregister a client notifier
* @nb: notifier block to callback on events
*/
int fb_unregister_client(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&fb_notifier_list, nb);
}
EXPORT_SYMBOL(fb_unregister_client);
/**
* fb_notifier_call_chain - notify clients of fb_events
*
*/
int fb_notifier_call_chain(unsigned long val, void *v)
{
return blocking_notifier_call_chain(&fb_notifier_list, val, v);
}
EXPORT_SYMBOL_GPL(fb_notifier_call_chain);
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#define FBPIXMAPSIZE (1024 * 8) #define FBPIXMAPSIZE (1024 * 8)
static BLOCKING_NOTIFIER_HEAD(fb_notifier_list);
struct fb_info *registered_fb[FB_MAX]; struct fb_info *registered_fb[FB_MAX];
int num_registered_fb; int num_registered_fb;
...@@ -791,8 +790,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) ...@@ -791,8 +790,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
event.info = info; event.info = info;
event.data = &mode1; event.data = &mode1;
ret = blocking_notifier_call_chain(&fb_notifier_list, ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event);
FB_EVENT_MODE_DELETE, &event);
} }
if (!ret) if (!ret)
...@@ -837,8 +835,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) ...@@ -837,8 +835,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
info->flags &= ~FBINFO_MISC_USEREVENT; info->flags &= ~FBINFO_MISC_USEREVENT;
event.info = info; event.info = info;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(evnt, &event);
evnt, &event);
} }
} }
} }
...@@ -861,8 +858,7 @@ fb_blank(struct fb_info *info, int blank) ...@@ -861,8 +858,7 @@ fb_blank(struct fb_info *info, int blank)
event.info = info; event.info = info;
event.data = &blank; event.data = &blank;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_BLANK, &event);
FB_EVENT_BLANK, &event);
} }
return ret; return ret;
...@@ -933,8 +929,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -933,8 +929,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
con2fb.framebuffer = -1; con2fb.framebuffer = -1;
event.info = info; event.info = info;
event.data = &con2fb; event.data = &con2fb;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
FB_EVENT_GET_CONSOLE_MAP, &event);
return copy_to_user(argp, &con2fb, return copy_to_user(argp, &con2fb,
sizeof(con2fb)) ? -EFAULT : 0; sizeof(con2fb)) ? -EFAULT : 0;
case FBIOPUT_CON2FBMAP: case FBIOPUT_CON2FBMAP:
...@@ -952,9 +947,8 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -952,9 +947,8 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return -EINVAL; return -EINVAL;
event.info = info; event.info = info;
event.data = &con2fb; event.data = &con2fb;
return blocking_notifier_call_chain(&fb_notifier_list, return fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP,
FB_EVENT_SET_CONSOLE_MAP, &event);
&event);
case FBIOBLANK: case FBIOBLANK:
acquire_console_sem(); acquire_console_sem();
info->flags |= FBINFO_MISC_USEREVENT; info->flags |= FBINFO_MISC_USEREVENT;
...@@ -1330,8 +1324,7 @@ register_framebuffer(struct fb_info *fb_info) ...@@ -1330,8 +1324,7 @@ register_framebuffer(struct fb_info *fb_info)
registered_fb[i] = fb_info; registered_fb[i] = fb_info;
event.info = fb_info; event.info = fb_info;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
FB_EVENT_FB_REGISTERED, &event);
return 0; return 0;
} }
...@@ -1365,29 +1358,10 @@ unregister_framebuffer(struct fb_info *fb_info) ...@@ -1365,29 +1358,10 @@ unregister_framebuffer(struct fb_info *fb_info)
fb_cleanup_class_device(fb_info); fb_cleanup_class_device(fb_info);
class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); class_device_destroy(fb_class, MKDEV(FB_MAJOR, i));
event.info = fb_info; event.info = fb_info;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
FB_EVENT_FB_UNREGISTERED, &event);
return 0; return 0;
} }
/**
* fb_register_client - register a client notifier
* @nb: notifier block to callback on events
*/
int fb_register_client(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&fb_notifier_list, nb);
}
/**
* fb_unregister_client - unregister a client notifier
* @nb: notifier block to callback on events
*/
int fb_unregister_client(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&fb_notifier_list, nb);
}
/** /**
* fb_set_suspend - low level driver signals suspend * fb_set_suspend - low level driver signals suspend
* @info: framebuffer affected * @info: framebuffer affected
...@@ -1403,13 +1377,11 @@ void fb_set_suspend(struct fb_info *info, int state) ...@@ -1403,13 +1377,11 @@ void fb_set_suspend(struct fb_info *info, int state)
event.info = info; event.info = info;
if (state) { if (state) {
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_SUSPEND, &event);
FB_EVENT_SUSPEND, &event);
info->state = FBINFO_STATE_SUSPENDED; info->state = FBINFO_STATE_SUSPENDED;
} else { } else {
info->state = FBINFO_STATE_RUNNING; info->state = FBINFO_STATE_RUNNING;
blocking_notifier_call_chain(&fb_notifier_list, fb_notifier_call_chain(FB_EVENT_RESUME, &event);
FB_EVENT_RESUME, &event);
} }
} }
...@@ -1480,9 +1452,7 @@ int fb_new_modelist(struct fb_info *info) ...@@ -1480,9 +1452,7 @@ int fb_new_modelist(struct fb_info *info)
if (!list_empty(&info->modelist)) { if (!list_empty(&info->modelist)) {
event.info = info; event.info = info;
err = blocking_notifier_call_chain(&fb_notifier_list, err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
FB_EVENT_NEW_MODELIST,
&event);
} }
return err; return err;
...@@ -1594,8 +1564,6 @@ EXPORT_SYMBOL(fb_blank); ...@@ -1594,8 +1564,6 @@ EXPORT_SYMBOL(fb_blank);
EXPORT_SYMBOL(fb_pan_display); EXPORT_SYMBOL(fb_pan_display);
EXPORT_SYMBOL(fb_get_buffer_offset); EXPORT_SYMBOL(fb_get_buffer_offset);
EXPORT_SYMBOL(fb_set_suspend); EXPORT_SYMBOL(fb_set_suspend);
EXPORT_SYMBOL(fb_register_client);
EXPORT_SYMBOL(fb_unregister_client);
EXPORT_SYMBOL(fb_get_options); EXPORT_SYMBOL(fb_get_options);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -524,7 +524,7 @@ struct fb_event { ...@@ -524,7 +524,7 @@ struct fb_event {
extern int fb_register_client(struct notifier_block *nb); extern int fb_register_client(struct notifier_block *nb);
extern int fb_unregister_client(struct notifier_block *nb); extern int fb_unregister_client(struct notifier_block *nb);
extern int fb_notifier_call_chain(unsigned long val, void *v);
/* /*
* Pixmap structure definition * Pixmap structure definition
* *
......
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