Commit 256154fbc31c25a8df4d398232acfa9d4892224c
Committed by
Linus Torvalds
1 parent
834a9b8ca7
[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>
Showing 6 changed files with 62 additions and 47 deletions Side-by-side Diff
drivers/video/Kconfig
drivers/video/Makefile
drivers/video/backlight/Kconfig
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | |
11 | 11 | config BACKLIGHT_CLASS_DEVICE |
12 | 12 | tristate "Lowlevel Backlight controls" |
13 | - depends on BACKLIGHT_LCD_SUPPORT && FB | |
13 | + depends on BACKLIGHT_LCD_SUPPORT | |
14 | 14 | default m |
15 | 15 | help |
16 | 16 | This framework adds support for low-level control of the LCD |
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | |
27 | 27 | config LCD_CLASS_DEVICE |
28 | 28 | tristate "Lowlevel LCD controls" |
29 | - depends on BACKLIGHT_LCD_SUPPORT && FB | |
29 | + depends on BACKLIGHT_LCD_SUPPORT | |
30 | 30 | default m |
31 | 31 | help |
32 | 32 | This framework adds support for low-level control of LCD. |
drivers/video/fb_notify.c
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); |
drivers/video/fbmem.c
... | ... | @@ -52,7 +52,6 @@ |
52 | 52 | |
53 | 53 | #define FBPIXMAPSIZE (1024 * 8) |
54 | 54 | |
55 | -static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); | |
56 | 55 | struct fb_info *registered_fb[FB_MAX]; |
57 | 56 | int num_registered_fb; |
58 | 57 | |
... | ... | @@ -791,8 +790,7 @@ |
791 | 790 | |
792 | 791 | event.info = info; |
793 | 792 | event.data = &mode1; |
794 | - ret = blocking_notifier_call_chain(&fb_notifier_list, | |
795 | - FB_EVENT_MODE_DELETE, &event); | |
793 | + ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); | |
796 | 794 | } |
797 | 795 | |
798 | 796 | if (!ret) |
... | ... | @@ -837,8 +835,7 @@ |
837 | 835 | |
838 | 836 | info->flags &= ~FBINFO_MISC_USEREVENT; |
839 | 837 | event.info = info; |
840 | - blocking_notifier_call_chain(&fb_notifier_list, | |
841 | - evnt, &event); | |
838 | + fb_notifier_call_chain(evnt, &event); | |
842 | 839 | } |
843 | 840 | } |
844 | 841 | } |
... | ... | @@ -861,8 +858,7 @@ |
861 | 858 | |
862 | 859 | event.info = info; |
863 | 860 | event.data = ␣ |
864 | - blocking_notifier_call_chain(&fb_notifier_list, | |
865 | - FB_EVENT_BLANK, &event); | |
861 | + fb_notifier_call_chain(FB_EVENT_BLANK, &event); | |
866 | 862 | } |
867 | 863 | |
868 | 864 | return ret; |
... | ... | @@ -933,8 +929,7 @@ |
933 | 929 | con2fb.framebuffer = -1; |
934 | 930 | event.info = info; |
935 | 931 | event.data = &con2fb; |
936 | - blocking_notifier_call_chain(&fb_notifier_list, | |
937 | - FB_EVENT_GET_CONSOLE_MAP, &event); | |
932 | + fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); | |
938 | 933 | return copy_to_user(argp, &con2fb, |
939 | 934 | sizeof(con2fb)) ? -EFAULT : 0; |
940 | 935 | case FBIOPUT_CON2FBMAP: |
... | ... | @@ -952,9 +947,8 @@ |
952 | 947 | return -EINVAL; |
953 | 948 | event.info = info; |
954 | 949 | event.data = &con2fb; |
955 | - return blocking_notifier_call_chain(&fb_notifier_list, | |
956 | - FB_EVENT_SET_CONSOLE_MAP, | |
957 | - &event); | |
950 | + return fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, | |
951 | + &event); | |
958 | 952 | case FBIOBLANK: |
959 | 953 | acquire_console_sem(); |
960 | 954 | info->flags |= FBINFO_MISC_USEREVENT; |
... | ... | @@ -1330,8 +1324,7 @@ |
1330 | 1324 | registered_fb[i] = fb_info; |
1331 | 1325 | |
1332 | 1326 | event.info = fb_info; |
1333 | - blocking_notifier_call_chain(&fb_notifier_list, | |
1334 | - FB_EVENT_FB_REGISTERED, &event); | |
1327 | + fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); | |
1335 | 1328 | return 0; |
1336 | 1329 | } |
1337 | 1330 | |
1338 | 1331 | |
... | ... | @@ -1365,30 +1358,11 @@ |
1365 | 1358 | fb_cleanup_class_device(fb_info); |
1366 | 1359 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
1367 | 1360 | event.info = fb_info; |
1368 | - blocking_notifier_call_chain(&fb_notifier_list, | |
1369 | - FB_EVENT_FB_UNREGISTERED, &event); | |
1361 | + fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); | |
1370 | 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 | 1366 | * fb_set_suspend - low level driver signals suspend |
1393 | 1367 | * @info: framebuffer affected |
1394 | 1368 | * @state: 0 = resuming, !=0 = suspending |
1395 | 1369 | |
... | ... | @@ -1403,13 +1377,11 @@ |
1403 | 1377 | |
1404 | 1378 | event.info = info; |
1405 | 1379 | if (state) { |
1406 | - blocking_notifier_call_chain(&fb_notifier_list, | |
1407 | - FB_EVENT_SUSPEND, &event); | |
1380 | + fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); | |
1408 | 1381 | info->state = FBINFO_STATE_SUSPENDED; |
1409 | 1382 | } else { |
1410 | 1383 | info->state = FBINFO_STATE_RUNNING; |
1411 | - blocking_notifier_call_chain(&fb_notifier_list, | |
1412 | - FB_EVENT_RESUME, &event); | |
1384 | + fb_notifier_call_chain(FB_EVENT_RESUME, &event); | |
1413 | 1385 | } |
1414 | 1386 | } |
1415 | 1387 | |
... | ... | @@ -1480,9 +1452,7 @@ |
1480 | 1452 | |
1481 | 1453 | if (!list_empty(&info->modelist)) { |
1482 | 1454 | event.info = info; |
1483 | - err = blocking_notifier_call_chain(&fb_notifier_list, | |
1484 | - FB_EVENT_NEW_MODELIST, | |
1485 | - &event); | |
1455 | + err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); | |
1486 | 1456 | } |
1487 | 1457 | |
1488 | 1458 | return err; |
... | ... | @@ -1594,8 +1564,6 @@ |
1594 | 1564 | EXPORT_SYMBOL(fb_pan_display); |
1595 | 1565 | EXPORT_SYMBOL(fb_get_buffer_offset); |
1596 | 1566 | EXPORT_SYMBOL(fb_set_suspend); |
1597 | -EXPORT_SYMBOL(fb_register_client); | |
1598 | -EXPORT_SYMBOL(fb_unregister_client); | |
1599 | 1567 | EXPORT_SYMBOL(fb_get_options); |
1600 | 1568 | |
1601 | 1569 | MODULE_LICENSE("GPL"); |
include/linux/fb.h
... | ... | @@ -524,7 +524,7 @@ |
524 | 524 | |
525 | 525 | extern int fb_register_client(struct notifier_block *nb); |
526 | 526 | extern int fb_unregister_client(struct notifier_block *nb); |
527 | - | |
527 | +extern int fb_notifier_call_chain(unsigned long val, void *v); | |
528 | 528 | /* |
529 | 529 | * Pixmap structure definition |
530 | 530 | * |