Krzysztof Helt [Tue, 31 Mar 2009 22:25:47 +0000 (15:25 -0700)]
atyfb: speed up Mach64 cursor
Save one fifo entry on cursor enabling and disabling.
Save another fifo entry for FB_CUR_SETPOS operation by removing redundant one.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:47 +0000 (15:25 -0700)]
fb: hide hardware cursor in graphics mode (Mach64)
A hardware cursor is left enabled in the fb_set_par() which is called when a
new console is created. This is inconsistent with software cursor's
behaviour.
Also, this makes a hardware cursor always visible in the Xfbdev (Xorg kdrive)
server.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Risto Suominen <risto.suominen@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Remove mutex from the nvidiafb_open/nvidiafb_release functions as these
operations are mutexed at fb layer.
Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Cc: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Wolfgang Kroener [Tue, 31 Mar 2009 22:25:44 +0000 (15:25 -0700)]
radeonfb: suspend/resume for ATI Mobility Radeon RV350
Add suspend/resume for the Acer Travelmate 290D/292LMi with the following
graphic-chip:
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc RV350
[Mobility Radeon 9600 M10] [1002:4e50] (prog-if 00 [VGA controller])
Subsystem: Acer Incorporated [ALI] TravelMate 290 [1025:005a]
Flags: bus master, 66MHz, medium devsel, latency 128, IRQ 10
Memory at a8000000 (32-bit, prefetchable) [size=128M]
I/O ports at c100 [size=256]
Memory at e0010000 (32-bit, non-prefetchable) [size=64K]
[virtual] Expansion ROM at a0000000 [disabled] [size=128K]
Capabilities: [58] AGP version 2.0
Capabilities: [50] Power Management version 2
Kernel driver in use: radeonfb
Kernel modules: radeonfb
Signed-off-by: Wolfgang Kroener <lkml@azog.de> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Felipe Contreras [Tue, 31 Mar 2009 22:25:42 +0000 (15:25 -0700)]
omapfb: fix argument of blank operation
The blank operation should receive FB_BLANK_POWERDOWN, not VESA_POWERDOWN.
Signed-off-by: Felipe Contreras <felipe.contreras@nokia.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Andrea Righi <righi.andrea@gmail.com> Acked-by: Trilok Soni <soni.trilok@gmail.com> Cc: Imre Deak <imre.deak@solidboot.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
uvesafb: fix selecting mode with the vbemode option
If the vbemode option is used, uvesafb calls fb_get_mode() without first
setting the resolution in info->var. This results in a division by zero
in fb_get_mode(), as evidenced e.g. in [1]. Fix this by ensuring the
info->var structure is populated before fb_get_mode() is called.
Signed-off-by: Michal Januszewski <spock@gentoo.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:40 +0000 (15:25 -0700)]
fbdev: remove cyblafb driver
A tridentfb driver has all the functionality of the cyblafb driver without
the bugs of the latter.
Changes to the tridentfb driver:
- FBINFO_READS_FAST added to the tridentfb. The cyblafb used a blitter
for scrolling which is faster than color expansion on Cyberblade
chipsets. The blitter is slower on a discrete Blade3D core. Use the
blitter for scrolling in the tridentfb only for integrated Blade3D
cores. Now, scrolling speed is about equal for the tridentfb and the
cyblafb.
- a copyright notice addition is done on request of Jani Monoses (the
first author of the tridentfb).
Tested on AGP Blade3D card and PCChips
M787CLR motherboard: VIA C3 cpu +
VT8601 north bridge (aka Cyberblade/i1).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: "Jani Monoses" <jani@ubuntu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ben Dooks [Tue, 31 Mar 2009 22:25:39 +0000 (15:25 -0700)]
fb: add s3c-fb driver for newer Samsung SoC framebuffer devices
Add support for the newer Samsung devices, such as found in the S3C2443,
S3C6400 or S3C6410 series SoC.
It currently does not support all the alpha- or chroma-key options but it
will support more exporting more than one framebuffer ready for adding
overlay and blending functions.
Signed-off-by: Ben Dooks <ben-linux@fluff.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Roel Kluin [Tue, 31 Mar 2009 22:25:36 +0000 (15:25 -0700)]
vesafb: bitwise OR has higher precedence than ?:
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Michal Januszewski <michalj@gmail.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Roel Kluin [Tue, 31 Mar 2009 22:25:35 +0000 (15:25 -0700)]
uvesafb: bitwise OR has higher precedence than ?:
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Michal Januszewski <michalj@gmail.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Roel Kluin [Tue, 31 Mar 2009 22:25:34 +0000 (15:25 -0700)]
arkfb: fix misplaced parentheses
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Ondrej Zajicek <santiago@crfreenet.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:33 +0000 (15:25 -0700)]
asiliantfb: fix cmap memory leaks
- fix cmap leak in removal path
- fix cmap leak when register_framebuffer fails
- check return value of fb_alloc_cmap
- don't continue with driver setup if register_framebuffer fails
[krzysztof.h1@wp.pl: spotted missing iounmap]
[randy.dunlap@oracle.com: move data declaration before any code] Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Roel Kluin [Tue, 31 Mar 2009 22:25:32 +0000 (15:25 -0700)]
drivers/video/omap/hwa742.c: div reaches max_clk_div
With for(div = 0; div < max_clk_div; div++) { ... } div reaches max_clk_div.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Joe Perches <joe@perches.com> Acked-by: Trilok Soni <soni.trilok@gmail.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fbdev: update s1d13xxxfb to differ between revisions and production ids
The s1d13xxx chip provides two values of identification value: the
Production id (e.g 13506/13505/13806..) and a revision number 0,1,2,3).
Together these can help us to differentiate between similiar setups.
This patch adds the proper way of grabbing both those values and save them
for future reference (in order to decide what functions a card supports,
e.g acceleration).
We also move away from the concept of all s1d13xxx = s1d13806 when we
really support alot more.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: simplify s1d13xxxfb_probe()] Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:30 +0000 (15:25 -0700)]
amifb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:29 +0000 (15:25 -0700)]
amba-clcd: fix cmap memory leaks
- fix cmap leak in removal path
- fix cmap leak when register_framebuffer fails
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:28 +0000 (15:25 -0700)]
tgafb: fix cmap memory leak
Fix cmap leak when register_framebuffer fails.
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:27 +0000 (15:25 -0700)]
sunxvr500: fix cmap memory leaks
- fix cmap leak in removal path
- fix cmap leak when register_framebuffer fails
Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:26 +0000 (15:25 -0700)]
valkyriefb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:26 +0000 (15:25 -0700)]
stifb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:25 +0000 (15:25 -0700)]
sstfb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:24 +0000 (15:25 -0700)]
sm501fb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:23 +0000 (15:25 -0700)]
skeletonfb: check fb_alloc_cmap return value and handle failure properly
Bad example code, no cookie!
Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:22 +0000 (15:25 -0700)]
vfb: fix memory leaks in removal path
We were leaking the cmap memory.
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:22 +0000 (15:25 -0700)]
tridentfb: fix memory leaks in removal path
We were leaking the cmap memory.
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:21 +0000 (15:25 -0700)]
tdfxfb: fix memory leaks in removal path
We were leaking the cmap memory.
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andres Salomon [Tue, 31 Mar 2009 22:25:20 +0000 (15:25 -0700)]
drivers/video/sgivwfb.c: fix memory leaks in removal path
We were leaking both the cmap memory and the info struct memory.
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andrew Morton [Tue, 31 Mar 2009 22:25:19 +0000 (15:25 -0700)]
fbdev: uninline lock_fb_info()
Before:
text data bss dec hex filename
3648 2910 32 6590 19be drivers/video/backlight/backlight.o
3226 2812 32 6070 17b6 drivers/video/backlight/lcd.o
30990 16688 8480 56158 db5e drivers/video/console/fbcon.o
15488 8400 24 23912 5d68 drivers/video/fbmem.o
After:
text data bss dec hex filename
3537 2870 32 6439 1927 drivers/video/backlight/backlight.o
3131 2772 32 5935 172f drivers/video/backlight/lcd.o
30876 16648 8480 56004 dac4 drivers/video/console/fbcon.o
15506 8400 24 23930 5d7a drivers/video/fbmem.o
Cc: Andrea Righi <righi.andrea@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andrea Righi [Tue, 31 Mar 2009 22:25:18 +0000 (15:25 -0700)]
fbmem: fix fb_info->lock and mm->mmap_sem circular locking dependency
Fix a circular locking dependency in the frame buffer console driver
pushing down the mutex fb_info->lock.
Circular locking dependecies occur calling the blocking
fb_notifier_call_chain() with fb_info->lock held. Notifier callbacks can
try to acquire mm->mmap_sem, while fb_mmap() acquires the locks in the
reverse order mm->mmap_sem => fb_info->lock.
Tested-by: Andrey Borzenkov <arvidjaar@mail.ru> Signed-off-by: Andrea Righi <righi.andrea@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:17 +0000 (15:25 -0700)]
cirrusfb: fix interlaced modes
Fix calculations of timings for interlaced modes.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:17 +0000 (15:25 -0700)]
cirrusfb: fix threshold register mask for Laguna chips
Fix threshold register mask for Laguna chips otherwise some 8bpp modes are
garbled after selecting a 24bpp mode.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:16 +0000 (15:25 -0700)]
cirrusfb: GD5434 (aka SD64) support fixed
Fix handling of the Cirrus Logic GD5434 chip. Distinguish this chip from the
GD5430. It allows detecting memory size for both models correctly.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:15 +0000 (15:25 -0700)]
cirrusfb: set MCLK in one place
A memory clock (MCLK) is set at various places. Move the setting into one
place.
Set the MCLK only for Zorro cards as the x86 cards should be initialized by
BIOS.
Improve handling of the GD5434 (SD64).
Kill one annoying debug output "virtual offset: ...".
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:15 +0000 (15:25 -0700)]
cirrusfb: add accelerator constant
Add an accelerator constant so almost all Cirrus are recognized as
accelerators by the fbset command.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:14 +0000 (15:25 -0700)]
cirrusfb: fix clock doubling
Cirrus' Alpine and Picasso4 chips uses DAC clock doubling to achieve full
range of pixclock frequencies.
[akpm@linux-foundation.org: fix spelling, use usual comment layout] Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:13 +0000 (15:25 -0700)]
cirrusfb: use 24bpp instead of 32bpp
The 32bpp is supported only on the latest Cirrus Logic chips. Use the
24bpp which is supported at least since Alpine chips (GD543x).
Change 32bpp mode setting to 24bpp mode. Change acceleration as well.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:13 +0000 (15:25 -0700)]
cirrusfb: GD5446 fixes
Various fixes to make Cirrus GD5446 chip work.
Another Cirrus chip works with the cirrusfb. The gd5446 seems very
similar to Alpine chips.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:12 +0000 (15:25 -0700)]
cirrusfb: fix error paths in cirrusfb_xxx_register()
Balance iomap and iounmap and alloc and free calls in case of error druing
device register (probing).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:11 +0000 (15:25 -0700)]
cirrusfb: add imageblit function
Add hardware color expansion (imageblit) function. It roughly doubles
scrolling speed of my Alpine card (GD5430).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:11 +0000 (15:25 -0700)]
cirrusfb: acceleration improvements
- Fix color expansion for 16bpp and 32bpp modes in the
cirrusfb_RectFill().
- Make a function with a common blitter code (cirrusfb_set_blitter).
- Add fb_sync function to allow a higher layer synchronize with the
blitter.
- Kill one redundant blitter reset.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:10 +0000 (15:25 -0700)]
cirrusfb: various Laguna fixes
- The Laguna GD5465 (AGP) has one register more than non-AGP chips.
Recognize the AGP version and write a tile control register only on the
AGP version. Tested only on an AGP card.
- Bump up RAMDAC frequencies after X11 code. This allow to drive a flat
panel resolution 1680x1050 at 16bpp from the 4MB card.
- Fix exit path in the cirrusfb_pci_register() in case of error.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:09 +0000 (15:25 -0700)]
cirrusfb: check_var improvements
Break cirrusfb_decode_var() function into two parts:
cirrusfb_check_pixclock() which can be called from the
cirrusfb_check_var() aand merge rest into the cirrusfb_set_par_foo().
This allows rejecting modes with too high pixclock before before any
change to hardware state (and a console is messed up).
Also, fix RGB field's lengths for 8bpp modes to correct ones so X11 works
with fbdev driver with cirrusfb.
Kill some redundant function calls or register loads.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:08 +0000 (15:25 -0700)]
cirrusfb: Laguna chipset 8bpp fix
Fix 8bpp mode by adding handling of the Laguna chipsets to various places
and stop trashing a HDR register which probably does not exist on the
Laguna.
Fix compilation warnings about uninitialized variables also.
Finally, all 8bpp, 16bpp and 32bpp modes work on the Laguna chipset.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:08 +0000 (15:25 -0700)]
cirrusfb: various improvements
Various improvements to the code:
- kill a structure with only one
field: multiplexing and use the
field directly
- move the cirrusfb_ops structure
down the file to kill forward
declarations
- move cirrusfb_init() to kill
forward declaration
- kill register loads done already
in the init_vgachip()
- kill assigments done by higher
layer in the cirrusfb_pan_display()
- do not overwrite line pitch bit in
the CL_CRT1D register
- kill btype variables if they were
used only once or twice
- add cpu_relax() in the busy waiting
loop
The fix to the CL_CRT1D register handling makess the 1024x768 32bpp mode
work. Previously, only lower resolution modes have worked with 32bpp.
Signed-off-by: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:07 +0000 (15:25 -0700)]
cirrusfb: use 5-6-5 RGB for 16bpp mode
Use the 5-6-5 RGB mode instead of the 5-5-5 mode at 16bpp depth.
It fixes colors in the 16bpp modes on Cirrus Laguna chips.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Geert Uytterhoeven <geert.uytterhoeven@gmail.com> Cc: Arthur Marsh <arthur.marsh@internode.on.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:06 +0000 (15:25 -0700)]
cirrusfb: do not calculate line length twice
A line length is calculated twice: first in the cirrusfb_decode_var() then
in the cirrusfb_set_par_foo().
Use the first calculated value. A nice side effect is that 32bpp mode
works now.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Geert Uytterhoeven <geert.uytterhoeven@gmail.com> Cc: Arthur Marsh <arthur.marsh@internode.on.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt [Tue, 31 Mar 2009 22:25:05 +0000 (15:25 -0700)]
cirrusfb: add mmio registers for Laguna chipsets
The Laguna chipsets use special registers which are available through the
mmio area. The cirrusfb driver does not use memory mapped registers for
the PCI cards.
Add the memory mapped area for Laguna chipsets and add basic usage of the
special Laguna registers after SVGALIB code.
This gives readable console at 16bpp on the GD-5465 (Laguna AGP). The
8bpp and 32bpp depths are still broken.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ian Kent [Tue, 31 Mar 2009 22:24:45 +0000 (15:24 -0700)]
autofs4: fix kernel includes
autofs_dev-ioctl.h is included by both the kernel module and user space tools
and it includes two kernel header files. Compiles work if the kernel headers
are installed but fail otherwise.
Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ian Kent [Tue, 31 Mar 2009 22:24:45 +0000 (15:24 -0700)]
autofs4: fix lookup deadlock
A deadlock can occur when user space uses a signal (autofs version 4 uses
SIGCHLD for this) to effect expire completion.
The order of events is:
Expire process completes, but before being able to send SIGCHLD to it's parent
...
Another process walks onto a different mount point and drops the directory
inode semaphore prior to sending the request to the daemon as it must ...
A third process does an lstat on on the expired mount point causing it to wait
on expire completion (unfortunately) holding the directory semaphore.
The mount request then arrives at the daemon which does an lstat and,
deadlock.
For some time I was concerned about releasing the directory semaphore around
the expire wait in autofs4_lookup as well as for the mount call back. I
finally realized that the last round of changes in this function made the
expiring dentry and the lookup dentry separate and distinct so the check and
possible wait can be done anywhere prior to the mount call back. This patch
moves the check to just before the mount call back and inside the directory
inode mutex release.
Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ian Kent [Tue, 31 Mar 2009 22:24:43 +0000 (15:24 -0700)]
autofs4: cleanup expire code duplication
A significant portion of the autofs_dev_ioctl_expire() and
autofs4_expire_multi() functions is duplicated code. This patch cleans that
up.
Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:40 +0000 (15:24 -0700)]
powerpc/fsl_soc: isolate legacy fsl_spi support to mpc832x_rdb boards
The advantages of this:
- Don't encourage legacy support;
- Less external symbols, less code to compile-in for !MPC832x_RDB
platforms.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:39 +0000 (15:24 -0700)]
powerpc/83xx: add mmc-spi support via the device tree for MPC8323E-RDB
- Add gpio-controller node to manage QE GPIO Bank D;
- Add mmc-spi node;
- Modify board file so that it won't use legacy SPI support with the new
device trees.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:38 +0000 (15:24 -0700)]
powerpc: add mmc-spi-slot bindings
The bindings describes a case where MMC/SD/SDIO slot directly connected to
a SPI bus. Such setups are widely used on embedded PowerPC boards.
The patch also adds the mmc-spi-slot entry to the OpenFirmware modalias
table.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:37 +0000 (15:24 -0700)]
spi_mpc83xx: add OF platform driver bindings
Implement full support for OF SPI bindings. Now the driver can manage its
own chip selects without any help from the board files and/or fsl_soc
constructors.
The "legacy" code is well isolated and could be removed as time goes by.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:36 +0000 (15:24 -0700)]
spi_mpc83xx: rework chip selects handling
The main purpose of this patch is to pass 'struct spi_device' to the chip
select handling routines. This is needed so that we could implement
full-fledged OpenFirmware support for this driver.
While at it, also:
- Replace two {de,activate}_cs routines by single cs_contol().
- Don't duplicate platform data callbacks in mpc83xx_spi struct.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Anton Vorontsov [Tue, 31 Mar 2009 22:24:35 +0000 (15:24 -0700)]
spi_mpc83xx: fix sparse warnings
The patch fixes following sparse warnings:
CHECK spi_mpc83xx.c
spi_mpc83xx.c:145:1: warning: symbol 'mpc83xx_spi_rx_buf_u8' was not declared. Should it be static?
spi_mpc83xx.c:146:1: warning: symbol 'mpc83xx_spi_rx_buf_u16' was not declared. Should it be static?
spi_mpc83xx.c:147:1: warning: symbol 'mpc83xx_spi_rx_buf_u32' was not declared. Should it be static?
spi_mpc83xx.c:148:1: warning: symbol 'mpc83xx_spi_tx_buf_u8' was not declared. Should it be static?
spi_mpc83xx.c:149:1: warning: symbol 'mpc83xx_spi_tx_buf_u16' was not declared. Should it be static?
spi_mpc83xx.c:150:1: warning: symbol 'mpc83xx_spi_tx_buf_u32' was not declared. Should it be static?
spi_mpc83xx.c:175:32: warning: incorrect type in initializer (different address spaces)
spi_mpc83xx.c:175:32: expected void *tmp_ptr
spi_mpc83xx.c:175:32: got unsigned int [noderef] <asn:2>*<noident>
spi_mpc83xx.c:183:26: warning: incorrect type in argument 1 (different address spaces)
spi_mpc83xx.c:183:26: expected unsigned int [noderef] [usertype] <asn:2>*reg
spi_mpc83xx.c:183:26: got void *tmp_ptr
spi_mpc83xx.c:184:26: warning: incorrect type in argument 1 (different address spaces)
spi_mpc83xx.c:184:26: expected unsigned int [noderef] [usertype] <asn:2>*reg
spi_mpc83xx.c:184:26: got void *tmp_ptr
spi_mpc83xx.c:287:31: warning: incorrect type in initializer (different address spaces)
spi_mpc83xx.c:287:31: expected void *tmp_ptr
spi_mpc83xx.c:287:31: got unsigned int [noderef] <asn:2>*<noident>
spi_mpc83xx.c:295:25: warning: incorrect type in argument 1 (different address spaces)
spi_mpc83xx.c:295:25: expected unsigned int [noderef] [usertype] <asn:2>*reg
spi_mpc83xx.c:295:25: got void *tmp_ptr
spi_mpc83xx.c:296:25: warning: incorrect type in argument 1 (different address spaces)
spi_mpc83xx.c:296:25: expected unsigned int [noderef] [usertype] <asn:2>*reg
spi_mpc83xx.c:296:25: got void *tmp_ptr
spi_mpc83xx.c:486:13: warning: symbol 'mpc83xx_spi_irq' was not declared. Should it be static?
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <david-b@pacbell.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
"I use ramfs instead of tmpfs for /tmp because I don't use swap on my
laptop. Some apps need 1777 mode for /tmp directory, but ramfs does not
support 'mode=' mount option."
Daniel Mack [Tue, 31 Mar 2009 22:24:33 +0000 (15:24 -0700)]
lis3: SPI transport layer
Make use of the new abstraction layer and add a new transport layer for
spi. Works fine on a PXA based board.
Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Daniel Mack [Tue, 31 Mar 2009 22:24:32 +0000 (15:24 -0700)]
lis3: solve dependency between core and ACPI
This solves the dependency between lis3lv02d.[ch] and ACPI specific
methods. It introduces a ->bus_priv pointer to the device struct which is
casted to 'struct acpi_device' in the ACIP layer. Changed hp_accel.c
accordingly.
Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Daniel Mack [Tue, 31 Mar 2009 22:24:31 +0000 (15:24 -0700)]
lis3: reorder functions to make forward decl obsolete
Move lis3lv02d_init_device() down so that the forward declaration of
lis3lv02d_add_fs() becomes unnecessary.
Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Luca Cappa [Tue, 31 Mar 2009 22:24:31 +0000 (15:24 -0700)]
hp_accel: axis conversion for hp compaq 8710w
I have a laptop HP Compaq 8710W, I compiled into my kernel the LIS3LV02DL
and HP_ACCEL module drivers. While loading it cannot recognize the laptop
model, so i am sending the necessary information to update the database of
axis orientations.
>When the laptop is horizontal the position reported is about 0 for X and Y
>and a positive value for Z
Yes, it is about 0,0,1000, the actual reading says: (-17,-26,1018);
> If the left side is elevated, X increases (becomes positive)
Yes, X goes toward to positive 1000.
>If the front side (where the touchpad is) is elevated, Y decreases (becomes negative)
No, Y goes toward to positive 1000.
>If the laptop is put upside-down, Z becomes negative
Yes, the laptop on a table Z gives 1000, and if upsidedown the Z reads
-1000.
So in few words the Y axis is inverted.
Cc: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Pavel Machek [Tue, 31 Mar 2009 22:24:29 +0000 (15:24 -0700)]
hp_accel: add two more axis information
Add two more laptops to whitelist.
Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Pavel Machek <pavel@ucw.cz> Cc: Daniel Mack <daniel@caiaq.de> Cc: Eric Piel <eric.piel@tremplin-utc.net> Cc: Vladimir Botka <vbotka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ira Snyder [Tue, 31 Mar 2009 22:24:29 +0000 (15:24 -0700)]
hwmon: Add LTC4215 driver
Add Linux support for the Linear Technology LTC4215 Hot Swap controller
I2C monitoring interface.
I have tested the driver with my board, and it appears to work fine. With
the power supplies disabled, it reads 11.93V input, 1.93V output, no
current and no power. With the supplies enabled, it reads 11.93V input,
11.98V output, no current, no power. I'm not drawing any current at the
moment, so this is reasonable. The value in the sense register never
reads anything except 0, so I expect to get zero from the current and
power calculations.
I didn't attempt to support changing any of the chip's settings or
enabling the FET. I'm not sure even how to do that and still fit within
the hwmon framework. :)
Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Cc: Jean Delvare <khali@linux-fr.org> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:24 +0000 (15:24 -0700)]
epoll keyed wakeups: make tty use keyed wakeups
Introduce keyed event wakeups inside the TTY code.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:23 +0000 (15:24 -0700)]
epoll keyed wakeups: make eventfd use keyed wakeups
Introduce keyed event wakeups inside the eventfd code.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:22 +0000 (15:24 -0700)]
epoll keyed wakeups: teach epoll about hints coming with the wakeup key
Use the events hint now sent by some devices, to avoid unnecessary wakeups
for events that are of no interest for the caller. This code handles both
devices that are sending keyed events, and the ones that are not (and
event the ones that sometimes send events, and sometimes don't).
[akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:21 +0000 (15:24 -0700)]
epoll keyed wakeups: make sockets use keyed wakeups
Add support for event-aware wakeups to the sockets code. Events are
delivered to the wakeup target, so that epoll can avoid spurious wakeups
for non-interesting events.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:20 +0000 (15:24 -0700)]
epoll keyed wakeups: introduce new *_poll() wakeup macros
Introduce new wakeup macros that allow passing an event mask to the wakeup
targets. They exactly mimic their non-_poll() counterpart, with the added
event mask passing capability. I did add only the ones currently
requested, avoiding the _nr() and _all() for the moment.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:20 +0000 (15:24 -0700)]
epoll keyed wakeups: add __wake_up_locked_key() and __wake_up_sync_key()
This patchset introduces wakeup hints for some of the most popular (from
epoll POV) devices, so that epoll code can avoid spurious wakeups on its
waiters.
The problem with epoll is that the callback-based wakeups do not, ATM,
carry any information about the events the wakeup is related to. So the
only choice epoll has (not being able to call f_op->poll() from inside the
callback), is to add the file* to a ready-list and resolve the real events
later on, at epoll_wait() (or its own f_op->poll()) time. This can cause
spurious wakeups, since the wake_up() itself might be for an event the
caller is not interested into.
The rate of these spurious wakeup can be pretty high in case of many
network sockets being monitored.
By allowing devices to report the events the wakeups refer to (at least
the two major classes - POLLIN/POLLOUT), we are able to spare useless
wakeups by proper handling inside the epoll's poll callback.
Epoll will have in any case to call f_op->poll() on the file* later on,
since the change to be done in order to have the full event set sent via
wakeup, is too invasive for the way our f_op->poll() system works (the
full event set is calculated inside the poll function - there are too many
of them to even start thinking the change - also poll/select would need
change too).
Epoll is changed in a way that both devices which send event hints, and
the ones that don't, are correctly handled. The former will gain some
efficiency though.
As a general rule for devices, would be to add an event mask by using
key-aware wakeup macros, when making up poll wait queues. I tested it
(together with the epoll's poll fix patch Andrew has in -mm) and wakeups
for the supported devices are correctly filtered.
Test program available here:
http://www.xmailserver.org/epoll_test.c
This patch:
Nothing revolutionary here. Just using the available "key" that our
wakeup core already support. The __wake_up_locked_key() was no brainer,
since both __wake_up_locked() and __wake_up_locked_key() are thin wrappers
around __wake_up_common().
The __wake_up_sync() function had a body, so the choice was between
borrowing the body for __wake_up_sync_key() and calling it from
__wake_up_sync(), or make an inline and calling it from both. I chose the
former since in most archs it all resolves to "mov $0, REG; jmp ADDR".
Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: William Lee Irwin III <wli@movementarian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Davide Libenzi [Tue, 31 Mar 2009 22:24:18 +0000 (15:24 -0700)]
eventfd: improve support for semaphore-like behavior
People started using eventfd in a semaphore-like way where before they
were using pipes.
That is, counter-based resource access. Where a "wait()" returns
immediately by decrementing the counter by one, if counter is greater than
zero. Otherwise will wait. And where a "post(count)" will add count to
the counter releasing the appropriate amount of waiters. If eventfd the
"post" (write) part is fine, while the "wait" (read) does not dequeue 1,
but the whole counter value.
The problem with eventfd is that a read() on the fd returns and wipes the
whole counter, making the use of it as semaphore a little bit more
cumbersome. You can do a read() followed by a write() of COUNTER-1, but
IMO it's pretty easy and cheap to make this work w/out extra steps. This
patch introduces a new eventfd flag that tells eventfd to only dequeue 1
from the counter, allowing simple read/write to make it behave like a
semaphore. Simple test here:
http://www.xmailserver.org/eventfd-sem.c
To be back-compatible with earlier kernels, userspace applications should
probe for the availability of this feature via