diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2006-07-30 06:04:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-31 16:28:44 -0400 |
commit | 256154fbc31c25a8df4d398232acfa9d4892224c (patch) | |
tree | 278582add1a28766a1f3f4dba2f250cdbb191e0a /drivers/video | |
parent | 834a9b8ca7a01c34570be021f88e18884a29f048 (diff) |
[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: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/Kconfig | 2 | ||||
-rw-r--r-- | drivers/video/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/backlight/Kconfig | 4 | ||||
-rw-r--r-- | drivers/video/fb_notify.c | 46 | ||||
-rw-r--r-- | drivers/video/fbmem.c | 54 |
5 files changed, 61 insertions, 46 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 82288a7218d4..728cb5677725 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1620,7 +1620,7 @@ if FB || SGI_NEWPORT_CONSOLE | |||
1620 | source "drivers/video/logo/Kconfig" | 1620 | source "drivers/video/logo/Kconfig" |
1621 | endif | 1621 | endif |
1622 | 1622 | ||
1623 | if FB && SYSFS | 1623 | if SYSFS |
1624 | source "drivers/video/backlight/Kconfig" | 1624 | source "drivers/video/backlight/Kconfig" |
1625 | endif | 1625 | endif |
1626 | 1626 | ||
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 95563c9c6b9c..481c6c9695f8 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-y += fb_notify.o | ||
7 | obj-$(CONFIG_FB) += fb.o | 8 | obj-$(CONFIG_FB) += fb.o |
8 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ | 9 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ |
9 | modedb.o fbcvt.o | 10 | modedb.o fbcvt.o |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 022f9d3473f5..02f15297a021 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT | |||
10 | 10 | ||
11 | config BACKLIGHT_CLASS_DEVICE | 11 | config BACKLIGHT_CLASS_DEVICE |
12 | tristate "Lowlevel Backlight controls" | 12 | tristate "Lowlevel Backlight controls" |
13 | depends on BACKLIGHT_LCD_SUPPORT && FB | 13 | depends on BACKLIGHT_LCD_SUPPORT |
14 | default m | 14 | default m |
15 | help | 15 | help |
16 | This framework adds support for low-level control of the LCD | 16 | This framework adds support for low-level control of the LCD |
@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE | |||
26 | 26 | ||
27 | config LCD_CLASS_DEVICE | 27 | config LCD_CLASS_DEVICE |
28 | tristate "Lowlevel LCD controls" | 28 | tristate "Lowlevel LCD controls" |
29 | depends on BACKLIGHT_LCD_SUPPORT && FB | 29 | depends on BACKLIGHT_LCD_SUPPORT |
30 | default m | 30 | default m |
31 | help | 31 | help |
32 | This framework adds support for low-level control of LCD. | 32 | This framework adds support for low-level control of LCD. |
diff --git a/drivers/video/fb_notify.c b/drivers/video/fb_notify.c new file mode 100644 index 000000000000..8c020389e4fa --- /dev/null +++ b/drivers/video/fb_notify.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/fb_notify.c | ||
3 | * | ||
4 | * Copyright (C) 2006 Antonino Daplas <adaplas@pol.net> | ||
5 | * | ||
6 | * 2001 - Documented with DocBook | ||
7 | * - Brad Douglas <brad@neruo.com> | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file COPYING in the main directory of this archive | ||
11 | * for more details. | ||
12 | */ | ||
13 | #include <linux/fb.h> | ||
14 | #include <linux/notifier.h> | ||
15 | |||
16 | static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); | ||
17 | |||
18 | /** | ||
19 | * fb_register_client - register a client notifier | ||
20 | * @nb: notifier block to callback on events | ||
21 | */ | ||
22 | int fb_register_client(struct notifier_block *nb) | ||
23 | { | ||
24 | return blocking_notifier_chain_register(&fb_notifier_list, nb); | ||
25 | } | ||
26 | EXPORT_SYMBOL(fb_register_client); | ||
27 | |||
28 | /** | ||
29 | * fb_unregister_client - unregister a client notifier | ||
30 | * @nb: notifier block to callback on events | ||
31 | */ | ||
32 | int fb_unregister_client(struct notifier_block *nb) | ||
33 | { | ||
34 | return blocking_notifier_chain_unregister(&fb_notifier_list, nb); | ||
35 | } | ||
36 | EXPORT_SYMBOL(fb_unregister_client); | ||
37 | |||
38 | /** | ||
39 | * fb_notifier_call_chain - notify clients of fb_events | ||
40 | * | ||
41 | */ | ||
42 | int fb_notifier_call_chain(unsigned long val, void *v) | ||
43 | { | ||
44 | return blocking_notifier_call_chain(&fb_notifier_list, val, v); | ||
45 | } | ||
46 | EXPORT_SYMBOL_GPL(fb_notifier_call_chain); | ||
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 4fc9df426c1a..17961e3ecaa0 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -52,7 +52,6 @@ | |||
52 | 52 | ||
53 | #define FBPIXMAPSIZE (1024 * 8) | 53 | #define FBPIXMAPSIZE (1024 * 8) |
54 | 54 | ||
55 | static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); | ||
56 | struct fb_info *registered_fb[FB_MAX]; | 55 | struct fb_info *registered_fb[FB_MAX]; |
57 | int num_registered_fb; | 56 | int num_registered_fb; |
58 | 57 | ||
@@ -791,8 +790,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
791 | 790 | ||
792 | event.info = info; | 791 | event.info = info; |
793 | event.data = &mode1; | 792 | event.data = &mode1; |
794 | ret = blocking_notifier_call_chain(&fb_notifier_list, | 793 | ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); |
795 | FB_EVENT_MODE_DELETE, &event); | ||
796 | } | 794 | } |
797 | 795 | ||
798 | if (!ret) | 796 | if (!ret) |
@@ -837,8 +835,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
837 | 835 | ||
838 | info->flags &= ~FBINFO_MISC_USEREVENT; | 836 | info->flags &= ~FBINFO_MISC_USEREVENT; |
839 | event.info = info; | 837 | event.info = info; |
840 | blocking_notifier_call_chain(&fb_notifier_list, | 838 | fb_notifier_call_chain(evnt, &event); |
841 | evnt, &event); | ||
842 | } | 839 | } |
843 | } | 840 | } |
844 | } | 841 | } |
@@ -861,8 +858,7 @@ fb_blank(struct fb_info *info, int blank) | |||
861 | 858 | ||
862 | event.info = info; | 859 | event.info = info; |
863 | event.data = ␣ | 860 | event.data = ␣ |
864 | blocking_notifier_call_chain(&fb_notifier_list, | 861 | fb_notifier_call_chain(FB_EVENT_BLANK, &event); |
865 | FB_EVENT_BLANK, &event); | ||
866 | } | 862 | } |
867 | 863 | ||
868 | return ret; | 864 | return ret; |
@@ -933,8 +929,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
933 | con2fb.framebuffer = -1; | 929 | con2fb.framebuffer = -1; |
934 | event.info = info; | 930 | event.info = info; |
935 | event.data = &con2fb; | 931 | event.data = &con2fb; |
936 | blocking_notifier_call_chain(&fb_notifier_list, | 932 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); |
937 | FB_EVENT_GET_CONSOLE_MAP, &event); | ||
938 | return copy_to_user(argp, &con2fb, | 933 | return copy_to_user(argp, &con2fb, |
939 | sizeof(con2fb)) ? -EFAULT : 0; | 934 | sizeof(con2fb)) ? -EFAULT : 0; |
940 | case FBIOPUT_CON2FBMAP: | 935 | case FBIOPUT_CON2FBMAP: |
@@ -952,9 +947,8 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
952 | return -EINVAL; | 947 | return -EINVAL; |
953 | event.info = info; | 948 | event.info = info; |
954 | event.data = &con2fb; | 949 | event.data = &con2fb; |
955 | return blocking_notifier_call_chain(&fb_notifier_list, | 950 | return fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, |
956 | FB_EVENT_SET_CONSOLE_MAP, | 951 | &event); |
957 | &event); | ||
958 | case FBIOBLANK: | 952 | case FBIOBLANK: |
959 | acquire_console_sem(); | 953 | acquire_console_sem(); |
960 | info->flags |= FBINFO_MISC_USEREVENT; | 954 | info->flags |= FBINFO_MISC_USEREVENT; |
@@ -1330,8 +1324,7 @@ register_framebuffer(struct fb_info *fb_info) | |||
1330 | registered_fb[i] = fb_info; | 1324 | registered_fb[i] = fb_info; |
1331 | 1325 | ||
1332 | event.info = fb_info; | 1326 | event.info = fb_info; |
1333 | blocking_notifier_call_chain(&fb_notifier_list, | 1327 | fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); |
1334 | FB_EVENT_FB_REGISTERED, &event); | ||
1335 | return 0; | 1328 | return 0; |
1336 | } | 1329 | } |
1337 | 1330 | ||
@@ -1365,30 +1358,11 @@ unregister_framebuffer(struct fb_info *fb_info) | |||
1365 | fb_cleanup_class_device(fb_info); | 1358 | fb_cleanup_class_device(fb_info); |
1366 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); | 1359 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
1367 | event.info = fb_info; | 1360 | event.info = fb_info; |
1368 | blocking_notifier_call_chain(&fb_notifier_list, | 1361 | fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); |
1369 | FB_EVENT_FB_UNREGISTERED, &event); | ||
1370 | return 0; | 1362 | return 0; |
1371 | } | 1363 | } |
1372 | 1364 | ||
1373 | /** | 1365 | /** |
1374 | * fb_register_client - register a client notifier | ||
1375 | * @nb: notifier block to callback on events | ||
1376 | */ | ||
1377 | int fb_register_client(struct notifier_block *nb) | ||
1378 | { | ||
1379 | return blocking_notifier_chain_register(&fb_notifier_list, nb); | ||
1380 | } | ||
1381 | |||
1382 | /** | ||
1383 | * fb_unregister_client - unregister a client notifier | ||
1384 | * @nb: notifier block to callback on events | ||
1385 | */ | ||
1386 | int fb_unregister_client(struct notifier_block *nb) | ||
1387 | { | ||
1388 | return blocking_notifier_chain_unregister(&fb_notifier_list, nb); | ||
1389 | } | ||
1390 | |||
1391 | /** | ||
1392 | * fb_set_suspend - low level driver signals suspend | 1366 | * fb_set_suspend - low level driver signals suspend |
1393 | * @info: framebuffer affected | 1367 | * @info: framebuffer affected |
1394 | * @state: 0 = resuming, !=0 = suspending | 1368 | * @state: 0 = resuming, !=0 = suspending |
@@ -1403,13 +1377,11 @@ void fb_set_suspend(struct fb_info *info, int state) | |||
1403 | 1377 | ||
1404 | event.info = info; | 1378 | event.info = info; |
1405 | if (state) { | 1379 | if (state) { |
1406 | blocking_notifier_call_chain(&fb_notifier_list, | 1380 | fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); |
1407 | FB_EVENT_SUSPEND, &event); | ||
1408 | info->state = FBINFO_STATE_SUSPENDED; | 1381 | info->state = FBINFO_STATE_SUSPENDED; |
1409 | } else { | 1382 | } else { |
1410 | info->state = FBINFO_STATE_RUNNING; | 1383 | info->state = FBINFO_STATE_RUNNING; |
1411 | blocking_notifier_call_chain(&fb_notifier_list, | 1384 | fb_notifier_call_chain(FB_EVENT_RESUME, &event); |
1412 | FB_EVENT_RESUME, &event); | ||
1413 | } | 1385 | } |
1414 | } | 1386 | } |
1415 | 1387 | ||
@@ -1480,9 +1452,7 @@ int fb_new_modelist(struct fb_info *info) | |||
1480 | 1452 | ||
1481 | if (!list_empty(&info->modelist)) { | 1453 | if (!list_empty(&info->modelist)) { |
1482 | event.info = info; | 1454 | event.info = info; |
1483 | err = blocking_notifier_call_chain(&fb_notifier_list, | 1455 | err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); |
1484 | FB_EVENT_NEW_MODELIST, | ||
1485 | &event); | ||
1486 | } | 1456 | } |
1487 | 1457 | ||
1488 | return err; | 1458 | return err; |
@@ -1594,8 +1564,6 @@ EXPORT_SYMBOL(fb_blank); | |||
1594 | EXPORT_SYMBOL(fb_pan_display); | 1564 | EXPORT_SYMBOL(fb_pan_display); |
1595 | EXPORT_SYMBOL(fb_get_buffer_offset); | 1565 | EXPORT_SYMBOL(fb_get_buffer_offset); |
1596 | EXPORT_SYMBOL(fb_set_suspend); | 1566 | EXPORT_SYMBOL(fb_set_suspend); |
1597 | EXPORT_SYMBOL(fb_register_client); | ||
1598 | EXPORT_SYMBOL(fb_unregister_client); | ||
1599 | EXPORT_SYMBOL(fb_get_options); | 1567 | EXPORT_SYMBOL(fb_get_options); |
1600 | 1568 | ||
1601 | MODULE_LICENSE("GPL"); | 1569 | MODULE_LICENSE("GPL"); |