Skip to contentSkip to conversation

Linux 2.5.64-ac4

PATCH New Alan Cox 7 participants 10 messages Mar 14, 2003 Media (V4L/DVB)

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

Linux 2.5.64-ac4
o Fix compile error in ide-default (Maciej Soltysiak)
o Fix ide-default panic case (Osamu Tomita)
o Remove seperation of PCI bus from I2O layer (me)
o Fix i2o_proc stack abuse (Joern Engel)
o Fix memory leak in ixj driver (Oleg Drokin)
o Fix memory leak in emu10k1 (Oleg Drokin)
o Fix memory leak in cpqfc (Oleg Drokin)
o Fix memory leak in specialix serial (Oleg Drokin)
o Fix memory leak in kobil driver (Oleg Drokin)
o Fix memory leak in clone_thread (Andi Kleen)
o Fix pbus_size_mem mis-estimation (Ivan Kokshaysky)
o Fix ide-cd queue cleanup (Alexander Atanasov)
o Fix cmd640 deadlocks (Alexander Atanasov)
o Documentation updates (Steven Cole)
o Fix docbook reference to file now gone (Rusty Lynch)
o Mass extermination of __NO_VERSION__ (Adrian Bunk)
o Fix incorrect intel PCI ident in 2.5 (me)
|Noted by Adrian Bunk
o Fix jiffies sign problems in aha152x (Christoph Hellwig)
o Fix jiffies sign problems in osst (Christoph Hellwig)
o v850 updates for NB85CE (Miles Bader)
o Fix 8012q memory leak (Oleg Drokin)
o Fix ircomm memory leak (Oleg Drokin)
o NCPfs mishandling of userspace access fix (Oleg Drokin)
o UFS memory leak fix (Oleg Drokin)
o Fix do_clock_nanosleep and other resulting (Todd Mokros)
timeout hangs
o Bring oprofile back into line with 2.4 (John Levon)
o i386 Kconfig typo fixes (Andreas Mohr)
o Remove some boot98 Makefile junk (Osamu Tomita)
o Update 98kbd driver (Osamu Tomita)
o Pull cmos clock handling into mach_ and add (Osamu Tomita)

	PC9800 support
o	Add PC9800 serial support			(Osamu Tomita)
o	Move base PC resources into mach_ and add	(Osamu Tomita)
	PC9800 support

o Extract some of the arch specific SMP bits (Osamu Tomita)
into mach_ for x86 and add PC9800
o Fix pcmcia configuration register crash (Pavel Roskin)
o Extended attribute handling fix (Tony Dziedzic)
o Fix initialisation of i2o retry lock (Randy Dunlap)
o Pull timers into mach_ on x86 and add (Osamu Tomita)

	PC9800 support

o Add part of the PC9800 ide/hd support (Osamu Tomita)
o Update PC9800 core code (Osamu Tomita)
o Update PC9800 specific char drivers (Osamu Tomita)
o Fix -ac visws mach breakage (Osamu Tomita)
o Revert alpha inline change (Ivan Kokshaysky)
o Serial8250 warning fix (Martin Bligh)
o Fix ethtool lockup with unused interface on (Jason Lunz)

	e100

o Update random number generator drivers (Jeff Garzik)

Linux 2.5.64-ac3
o Bring core IDE code into sync with the latest (me)
2.4.21pre5-ac code base. The drivers are not quite current with it yet.

Linux 2.5.64-ac2
o Fix missing ; in w9966 (#310) (Frank Davies)
o Fix missing ; in whiteheat (#314) (Frank Davies)
o Fix missing ; in cs46xx (#317) (Frank Davies)
o Fix double logical operator in ite_gpio (#321) (Frank Davies)
o Fix double logical opeator in advansys (#324) (me)
o Fix aha1542 setup to allow full config by (Hanna Linder)

	setup options (#242)

o Fix /proc bug in via ide handlers (#374) (Faik Uygur)
o Add #error for the mwave race (#185) (me)
| Fixing it needs rather more thought
o Fix apic compile problem (Adriank Bunk)
o Fix mremap slab corruption (Hugh Dickins)
o Fix sysfs mount permissions (Patrick Mochel)
o v850 updates (Miles Bader)
o Update all the parport layer to new module (Bob Miller)
API's remove check region misuse etc
o Updated gdth driver from Intel (Achim Leubner)
o Small ALi ide setup fixes (Ivan Kokshaysky)
| Basically mirror those applied to 2.4 before the 1563 | support was added
o Add kerneldoc for user space access (Jon Foster)
o Fix incorrect unregister for cciss (Herbert Xu)
o cciss hotplug crash fix (Stephen Cameron)
o Fix error in 3c501 comments (Steven Cole)
o More c99 intialisers (Art Haas)
o Updated mwave driver (still broken in part) (Paul Schroeder,
Wes Schreiner)
o Fdomain scsi cleanups, fix host list walk etc (Christoph Hellwig)
o Qlogic pcmcia scsi update (Christoph Hellwig)
| Still needs shared IRQ fix from 2.4.21pre5-ac
o Fix bracketing error in maestro oss driver (John Levon)
o Don't claim too many ports for rtc (Rusty Lynch)
o Fix broken checks in i810_audio (John Levon)

	| Still wants 2.4.21pre5-ac ac97/i810 fixes pulling

o Fix e1000 hung zerop copy transfer on 82544
o Add new board to cciss driver (Stephen Cameron)
o Fix piix build with CONFIG_PROC_FS=n (Randy Dunlap)
o Fix kmod SIGCLD problem (Stelian Pop)
o Fix check_region use in ht6560b (Christoph Hellwig)
o Fix check/requests in ide-dma (Christoph Hellwig)
o Remove dead __NO_VERSION__ from ide (Christoph Hellwig)
o Add PC9800 sound driver for CS4232 (Osamu Tomita)
o Add per mach support for APM (for PC9800) (Osamu Tomita)
o PC9800 has different PnP locations to (Osamu Tomita)
normal
o Handle NMI using mach-* scheme (Osamu Tomita)
o Fix /proc on slc90e66,sis5513, siimage, (Faik Uygur)

	serverworks, sc1200, piix, pdc202xx_old,
	pdc202xx_new, htp366, htp34x, cs5520, 
	amd74xx, aec62xx

o IRQ stacks are back (Dave Hansen)
o Update 3c527 to modern locking (untested) (James Bottomley)
o PC9800 FAT handling (Osamu Tomita)
o PC9800 partition table handling (Kyoto University Microcomputer Club)
o CPIA updates/fixes (Duncan Haldane)
o IRDA timer fix (Jean Tourrilhes)
o Fix locking in irda discover code (Jean Tourrilhes)
o IrLap dynamic window fixes (Jean Tourrilhes)
o irda-usb cleanup and fixes (Jean Tourrilhes)
o Zerocopy rx for SIR (Jean Tourrilhes)
o Fix IrNET refcounting and discovery hints (Jean Tourrilhes)
o Fix kernel command line documentation (Pavel Machek)
o Fix incorrect __init in mpu401 (Daniel Ritz)
o Remove unused LINUX_VERSION_CODE from sym53c416 (Adrian Bunk)
o Fix check_region/request_region for ALSA isa (Marcus Alanen)

	opti92x/ad1848

o Update depca driver to eisa/sysfs (Marc Zyngier)
o Depca compile fix (me)
o Fix serial core stuff, remove obsolete (me)
baud changes
o Fix jiffies wrap check code for 64bit (Andi Kleen)
o PCI quirk typo fix (Geert Uytterhoeven)
o Fix console initcall on Alpha (Marc Zyngier)
o Fix missing return value in pci irq changes (Andrew Morton)
O Fix usb-serial warnings with gcc 3.2 (David Gibson)
o Fix warning in ohci on pwoerbook (David Gibson)
o IA64 needs syscall returns to be long (David Mosberger)
o S/390 updates (Martin Schwidefsky)

Linux 2.5.64-ac1

	Merge Linus 2.5.63
	Merge Linus 2.5.64
	Revert broken watchdog changes
	Restore half removed make rpm

o Revert wrong -ac change to keyboard.c (me)
o Fix cpufreq compile (Bob Miller)
o Remove incorrect keyboard patch (#407)

Linux 2.5.62-ac1

	Merge Linus 2.5.62

o UNEXPECTED_IO_APIC can be static (Pavel Machek)
o Update IPMI driver to version 18 (Corey Minyard)
o Tons of spelling fixes (Steven Cole)
o FBdev updates (James Simmons)
o PC-9800 update (Osamu Tomita)
o Remove dead scripts (Brian Gerst)
o v850 updates (Miles Bader)
o Update 3c523 to new MCA api (untested) (James Bottomley)
o Toshiba keyboard workaround (Pavel Machek)
o Fix mremap file name in comments (Paul Larson)
o Firestream typo fixes (Maciej Soltysiak)
o Backport trident reset fix from 2.4 (Muli Ben-Yehuda)
o Morse code panics are back! (Tomas Szepe)
o Fix aicasm build (Bob Tracy)
o Fixes for 700/710 drivers (Rolf Eike Beer)
o Spelling fixes (Rolf Eike Beer)
o Optimise CRC32 (Joakim Tjernlund)
o Next batch of v850 updates (Miles Bader)
o Takayoshi Kochi has moved email (Takayoshi Kochi)
o SunRPC race fix (Trond Myklebust)
o Refix addr/port naming confusion in IDE iops (me)
o Forward port VIA APIC handling quirks (me)
o Forward port ALi magick quirk flag handler (me)
| Needs bt848 etc to acquire the fix too
o Forward port IDE bases fix (me)
o Forward port pci irq search for legacy IDE (me)

Linux 2.5.61-ac1

	Merge Linus 2.5.61

o Fix aic7xxx makefile (Sam Ravnborg)
o Fix ieee1394 build on Alpha (Ben Collins)
o Fix isdn_net build with X.25 (Adriank Bunk)
o Typo fix (Steven Bosscher)
o A pile of other typo fixes (Steven Cole)
o C99 initializers (Art Haas)
o dasd typo fix (Maciej Soltysiak)
o Remove an unused variable in sunrpc (Robert Love)
o Remove duplicate different BSD partition names (Andries Brouwer)
o PPC plural fix (Steven Cole)
o EISA driver class patches (Marc Zyngier)
o VIA Rhine updates (Roger Luethi)
o Further ppa scsi fix (John Kim)
o Kill unused __beep (Hugh Dickins)
o Merge visws support (Andrey Panin)
| Some collisions with pc9800 but should be ok
o Limits for upward growing stacks (Matthew Wilcox)
o ucLinux updates (Greg Ungerer)
o 68328 frame buffer updates (Greg Ungerer)
o Merge ucLinux H8300 support (Yoshinori Sato)
o Fix aironet compile (Ookhoi)
o Fix DMA mask on OSS trident driver (Ivan Kokshaysky)
o Kill some old 2.4 glue code in DRM (John Kim)
o Fix compile of old "hd.c" driver (Paul Gortmaker)
o Add experimental BOCHS virtualisation (Kevin Lawton)
o Clean up intermezzo driver (Adrian Bunk)
o Clean up rio use of compatmac (Adrian Bunk)
o Remove 2.0 ifdefs from ipchains code (Adrian Bunk)
o Remove old junk from efs (Adrian Bunk)
o Remove old 2.0/2.2 junk from media/video (Adrian Bunk)
o Remove unused variable in ali-ircc (Adrian Bunk)
o Remove 2.0 ifdefs from network drivers (Adrian Bunk)
o Clean up uglies in inia100 (Adrian Bunk)
o Clean up uglies in i91u scsi (Adrian Bunk)
o Clean up wan drivers 2.0/2.2 code (Adrian Bunk)
o Restore ontrack remap support (Jim Houston)
| I'd really like to see this get turned into device mapper..
o Forward port emu10k1 driver to 2.5 (Rui Souza)
o Fix boot on EPOX 4BEA-R and friends (Alexandar Achenbach)
o Switch alpha cia code to static inline (Matt Reppert)
o Fix pcmcia scsi compile breakages (Mike Anderson)
o EHCI workarounds (David Brownell)

Linux 2.5.60-ac1 (not published)
Includes Linus BK snapshot
Merge relevant pieces from old -ac (me)
| Dropped visws and stuff thats been redone | also dropped out IRQ stacks (port is tricky!)
o Fix build of cciss driver (me)
o Fix build of 3036 tv tuner (me)
o Remove i2o_lan (me)
o Fix i2o_scsi (Randy Dunlap)
o Fix iph5526 scsi changes (not fixed DMA) (me)
o Make starfire compile (me)
o Make mca-legacy warn if used (me)
o Make sim710 build with EISA (me)
o Make ultrastor compile (me)
o Make aha152x/aha154x build (Randy Dunlap)
o Fix aha154x/mca bits (me)
o Fix fd_mcs build (me)
o Fix NCR53c406a.c (me)
o Fix sym53c416.c (me)
o Fix ibmmca compile (me)
o Fix ppa compile (me)
o Fix NCR539x compile (John Kim)
o Fix mca_53c9x compile (me)

#1 lore raw

2.5.64-ac4: mpparse.c doesn't compile

<-- snip -->

...
gcc -Wp,-MD,arch/i386/kernel/.mpparse.o.d -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=k6 -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DKBUILD_BASENAME=mpparse -DKBUILD_MODNAME=mpparse -c -o arch/i386/kernel/mpparse.o arch/i386/kernel/mpparse.c arch/i386/kernel/mpparse.c: In function `get_smp_config':
arch/i386/kernel/mpparse.c:658: `pc98' undeclared (first use in this function) arch/i386/kernel/mpparse.c:658: (Each undeclared identifier is reported only once arch/i386/kernel/mpparse.c:658: for each function it appears in.) make[1]: *** [arch/i386/kernel/mpparse.o] Error 1

<-- snip -->

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#2 lore raw

Re: 2.5.64-ac4: mpparse.c doesn't compile

Quoted 5 lines

arch/i386/kernel/mpparse.c: In function `get_smp_config':
arch/i386/kernel/mpparse.c:658: `pc98' undeclared (first use in this function) arch/i386/kernel/mpparse.c:658: (Each undeclared identifier is reported only once arch/i386/kernel/mpparse.c:658: for each function it appears in.) make[1]: *** [arch/i386/kernel/mpparse.o] Error 1

For the moment build uniprocessor or make that "pc98" => 0

#3 lore raw
In reply to Alan Cox

Hi Alan,

Quoted 1 line · Alan Cox

Linux 2.5.64-ac4

it looks like someone changed the prototypes in includes/linux/fb.h without changing the actual functions ...

-extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); -extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *area); -extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); +extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); +extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); +extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);

drivers/video/cfbcopyarea.c:346: conflicting types for cfb_copyarea' include/linux/fb.h:459: previous declaration of cfb_copyarea' make[3]: *** [drivers/video/cfbcopyarea.o] Error 1 make[2]: *** [drivers/video] Error 2

== Morten

Signature · 7 lines
"Livet er ikke for nybegynnere" - sitat fra en klok person.

Morten Helgesen 
UNIX System Administrator & C Developer 
Nextframe AS
[email protected] / 93445641
http://www.nextframe.net
#4 lore raw
Quoted 7 lines · Morten Helgesen

Hi Alan,

Quoted 1 line · Alan Cox

Linux 2.5.64-ac4

it looks like someone changed the prototypes in includes/linux/fb.h without changing the actual functions ...

s/includes/include/ ... doh

Quoted 29 lines
(quoted diff) +3 -3
-extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect);
-extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *area);
-extern void cfb_imageblit(struct fb_info *info, struct fb_image *image);
+extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
+extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
+extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);

drivers/video/cfbcopyarea.c:346: conflicting types for cfb_copyarea' include/linux/fb.h:459: previous declaration of cfb_copyarea' make[3]: *** [drivers/video/cfbcopyarea.o] Error 1 make[2]: *** [drivers/video] Error 2

== Morten

Signature · 12 lines
"Livet er ikke for nybegynnere" - sitat fra en klok person.

Morten Helgesen 
UNIX System Administrator & C Developer 
Nextframe AS
[email protected] / 93445641
http://www.nextframe.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 7 lines
"Livet er ikke for nybegynnere" - sitat fra en klok person.

Morten Helgesen 
UNIX System Administrator & C Developer 
Nextframe AS
[email protected] / 93445641
http://www.nextframe.net
#5 lore raw

Top stack (l)users for 2.5.64-ac4

In reply to Alan Cox

Hi!

47 functions using >=1k of kernel stack on i386.

One improvement over 2.5.64, i2o_proc_* is gone. 4 down, 47 to go. :)

0xc02063f6 presto_get_fileid:                            sub    $0x1168,%esp
0xc0204fc6 presto_copy_kml_tail:                         sub    $0x101c,%esp
0xc07b92c8 isp2x00_make_portdb:                          sub    $0xc38,%esp
0xc0879c05 cdromread:                                    sub    $0xa84,%esp
0xc0766a08 ide_unregister:                               sub    $0x978,%esp
0xc07240db v4l_compat_translate_ioctl:                   sub    $0x924,%esp
0xc0b4e2e6 snd_emu10k1_fx8010_ioctl:                     sub    $0x82c,%esp
0xc06d3396 writerids:                                    sub    $0x828,%esp
0xc06d31e6 readrids:                                     sub    $0x810,%esp
0xc0af06ab snd_cmipci_ac3_silence:                       sub    $0x7b0,%esp
0xc0af0146 snd_cmipci_ac3_copy:                          sub    $0x7b0,%esp
0xc0889206 amd_flash_probe:                              sub    $0x708,%esp
0xc01055ae huft_build:                                   sub    $0x5ac,%esp
0xc01071ae huft_build:                                   sub    $0x5ac,%esp
0xc02a96ab dohash:                                       sub    $0x58c,%esp
0xc0aa93ab snd_pcm_oss_change_params:                    sub    $0x584,%esp
0xc0108016 inflate_dynamic:                              sub    $0x540,%esp
0xc0557fc6 ida_ioctl:                                    sub    $0x540,%esp
0xc01063c6 inflate_dynamic:                              sub    $0x524,%esp
0xc0c98e36 device_new_if:                                sub    $0x51c,%esp
0xc01fc8b6 presto_ioctl:                                 sub    $0x500,%esp
0xc0b49f8a snd_emu10k1_add_controls:                     sub    $0x4e4,%esp
0xc0b68556 snd_trident_mixer:                            sub    $0x4a8,%esp
0xc01a8d93 elf_core_dump:                                sub    $0x4a4,%esp
0xc077b002 ide_config:                                   sub    $0x494,%esp
0xc0107e80 inflate_fixed:                                sub    $0x490,%esp
0xc0c871bb br_ioctl_device:                              sub    $0x490,%esp
0xc0106230 inflate_fixed:                                sub    $0x490,%esp
0xc0450482 parport_config:                               sub    $0x480,%esp
0xc09a9116 sw_connect:                                   sub    $0x480,%esp
0xc09af3e1 uinput_alloc_device:                          sub    $0x480,%esp
0xc040a77e sha512_transform:                             sub    $0x458,%esp
0xc0d84296 sctp_hash_digest:                             sub    $0x458,%esp
0xc0d19040 gss_pipe_downcall:                            sub    $0x440,%esp
0xc036cb20 ciGetLeafPrefixKey:                           sub    $0x424,%esp
0xc098f6f6 emi26_load_firmware:                          sub    $0x418,%esp
0xc06b4d66 wv_hw_reset:                                  sub    $0x410,%esp
0xc12f2f82 root_nfs_name:                                sub    $0x408,%esp
0xc02eedc7 jffs2_rtime_decompress:                       sub    $0x404,%esp
0xc02eecd9 jffs2_rtime_compress:                         sub    $0x404,%esp
0xc0678431 hex_dump:                                     sub    $0x400,%esp
0xc09dbe1c dtl1_config:                                  sub    $0x400,%esp
0xc09dd572 bt3c_config:                                  sub    $0x400,%esp
0xc03f90a5 befs_debug:                                   sub    $0x400,%esp
0xc03f905e befs_warning:                                 sub    $0x400,%esp
0xc03f900e befs_error:                                   sub    $0x400,%esp
0xc09e10c2 btuart_config:                                sub    $0x400,%esp

Jörn

Signature · 2 lines
"Error protection by error detection and correction."
-- from a university class
#6 lore raw

Re: Top stack (l)users for 2.5.64-ac4

Quoted 10 lines · Joern Engel

Hi!

47 functions using >=1k of kernel stack on i386.

One improvement over 2.5.64, i2o_proc_* is gone. 4 down, 47 to go. :)

0xc02063f6 presto_get_fileid:                            sub    $0x1168,%esp
0xc0204fc6 presto_copy_kml_tail:                         sub    $0x101c,%esp
0xc07b92c8 isp2x00_make_portdb:                          sub    $0xc38,%esp
0xc0879c05 cdromread:                                    sub    $0xa84,%esp

which function is this (cdromread)?

Signature · 1 line
Jens Axboe
#7 lore raw

Re: Top stack (l)users for 2.5.64-ac4

On Fri, 14 Mar 2003 18:41:54 +0100 Jens Axboe <[email protected]> wrote:

| On Fri, Mar 14 2003, Joern Engel wrote:
| > Hi!
| > 
| > 47 functions using >=1k of kernel stack on i386.
| > 
| > One improvement over 2.5.64, i2o_proc_* is gone. 4 down, 47 to go. :)
| > 
| > 0xc02063f6 presto_get_fileid:                            sub    $0x1168,%esp
| > 0xc0204fc6 presto_copy_kml_tail:                         sub    $0x101c,%esp
| > 0xc07b92c8 isp2x00_make_portdb:                          sub    $0xc38,%esp
| > 0xc0879c05 cdromread:                                    sub    $0xa84,%esp
| 
| which function is this (cdromread)?

must be drivers/cdrom/optcd.c::cdromread() (line 1601 in 2.5.64), due to

	char buf[CD_FRAMESIZE_RAWER];

and
#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ in include/linux/cdrom.h.

--
~Randy

#8 lore raw

Re: Top stack (l)users for 2.5.64-ac4

Quoted 16 lines · Randy.Dunlap

On Fri, 14 Mar 2003 18:41:54 +0100 Jens Axboe <[email protected]> wrote:

| On Fri, Mar 14 2003, Joern Engel wrote:
| > Hi!
| > 
| > 47 functions using >=1k of kernel stack on i386.
| > 
| > One improvement over 2.5.64, i2o_proc_* is gone. 4 down, 47 to go. :)
| > 
| > 0xc02063f6 presto_get_fileid:                            sub    $0x1168,%esp
| > 0xc0204fc6 presto_copy_kml_tail:                         sub    $0x101c,%esp
| > 0xc07b92c8 isp2x00_make_portdb:                          sub    $0xc38,%esp
| > 0xc0879c05 cdromread:                                    sub    $0xa84,%esp
| 
| which function is this (cdromread)?
Quoted 6 lines

must be drivers/cdrom/optcd.c::cdromread() (line 1601 in 2.5.64), due to

	char buf[CD_FRAMESIZE_RAWER];

and
#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ in include/linux/cdrom.h.

Ahh, ok so a lot less interesting. Also why I didn't catch it here. I'd be inclining to just making buf global there.

Signature · 1 line
Jens Axboe
#9 lore raw

PATCH 1/1 v4l: v4l1-compat update

In reply to Joern Engel
Quoted 5 lines · Joern Engel

Hi!

47 functions using >=1k of kernel stack on i386.

0xc07240db v4l_compat_translate_ioctl: sub $0x924,%esp

Patch to cut that down below.

Gerd

==============================[ cut here ]==============================

This patch updates the v4l1-compat module. Changes:
* use f_op->poll() instead of do_select()
* reduce stack usage of the v4l1_compat_translate_ioctl function.
* misc fixes here and there.

drivers/media/video/v4l1-compat.c +214 -242
@@ -145,16 +145,16 @@
 	[VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
 };
 
-static int
-palette_to_pixelformat(int palette)
+static unsigned int
+palette_to_pixelformat(unsigned int palette)
 {
-	if (palette < sizeof(palette2pixelformat)/sizeof(int))
+	if (palette < ARRAY_SIZE(palette2pixelformat))
 		return palette2pixelformat[palette];
 	else
 		return 0;
 }
 
-static int
+static unsigned int
 pixelformat_to_palette(int pixelformat)
 {
 	int	palette = 0;
@@ -199,66 +199,41 @@
 	return palette;
 }
 
-/*  Do an 'in' (wait for input) select on a single file descriptor  */
-/*  This stuff plaigarized from linux/fs/select.c     */
-#define __FD_IN(fds, n)	(fds->in + n)
-#define BIT(i)		(1UL << ((i)&(__NFDBITS-1)))
-#define SET(i,m)	(*(m) |= (i))
-extern int do_select(int n, fd_set_bits *fds, long *timeout);
-
-
-static int
-simple_select(struct file *file)
+static int poll_one(struct file *file)
 {
-	fd_set_bits fds;
-	char *bits;
-	long timeout;
-	int i, fd, n, ret, size;
-
-	for (i = 0; i < current->files->max_fds; ++i)
-		if (file == current->files->fd[i])
-			break;
-	if (i == current->files->max_fds)
-		return -EINVAL;
-	fd = i;
-	n = fd + 1;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	/*  All zero except our one file descriptor bit, for input  */
-	memset(bits, 0, 6 * size);
-	SET(BIT(fd), __FD_IN((&fds), fd / __NFDBITS));
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
+	int retval = 1;
+	poll_table *table;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48)
+	poll_table wait_table;
+
+	poll_initwait(&wait_table);
+	table = &wait_table;
+#else
+	struct poll_wqueues pwq;
+
+	poll_initwait(&pwq);
+	table = &pwq.pt;
+#endif
+	for (;;) {
+		int mask;
+		set_current_state(TASK_INTERRUPTIBLE);
+		mask = file->f_op->poll(file, table);
+		if (mask & POLLIN)
+			break;
+		table = NULL;
+		if (signal_pending(current)) {
+			retval = -ERESTARTSYS;
+			break;
+		}
+		schedule();
+	}
+	current->state = TASK_RUNNING;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48)
+	poll_freewait(&wait_table);
+#else
+	poll_freewait(&pwq);
+#endif
+	return retval;
 }
 
 static int count_inputs(struct inode         *inode,
@@ -317,26 +292,36 @@
 			   void			*arg,
 			   v4l2_kioctl          drv)
 {
-	int	             err = -ENOIOCTLCMD;
+	struct v4l2_capability  *cap2 = NULL;
+	struct v4l2_format	*fmt2 = NULL;
 
-	switch (cmd)
-	{
+	struct v4l2_framebuffer fbuf2;
+	struct v4l2_input	input2;
+	struct v4l2_tuner	tun2;
+	struct v4l2_standard	std2;
+	struct v4l2_frequency   freq2;
+	struct v4l2_audio	aud2;
+	struct v4l2_queryctrl	qctrl2;
+	struct v4l2_buffer	buf2;
+	v4l2_std_id    		sid;
+	int i, err = 0;
+
+	switch (cmd) {
 	case VIDIOCGCAP:	/* capability */
 	{
 		struct video_capability *cap = arg;
-		struct v4l2_capability cap2;
-		struct v4l2_framebuffer fbuf2;
-		
+
+		cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL);
 		memset(cap, 0, sizeof(*cap));
-		memset(&cap2, 0, sizeof(cap2));
+		memset(cap2, 0, sizeof(*cap2));
 		memset(&fbuf2, 0, sizeof(fbuf2));
 
-		err = drv(inode, file, VIDIOC_QUERYCAP, &cap2);
+		err = drv(inode, file, VIDIOC_QUERYCAP, cap2);
 		if (err < 0) {
 			dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n",err);
 			break;
 		}
-		if (cap2.capabilities & V4L2_CAP_VIDEO_OVERLAY) {
+		if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) {
 			err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2);
 			if (err < 0) {
 				dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n",err);
@@ -345,16 +330,16 @@
 			err = 0;
 		}
 
-		memcpy(cap->name, cap2.card, 
-		       min(sizeof(cap->name), sizeof(cap2.card)));
+		memcpy(cap->name, cap2->card, 
+		       min(sizeof(cap->name), sizeof(cap2->card)));
 		cap->name[sizeof(cap->name) - 1] = 0;
-		if (cap2.capabilities & V4L2_CAP_VIDEO_CAPTURE)
+		if (cap2->capabilities & V4L2_CAP_VIDEO_CAPTURE)
 			cap->type |= VID_TYPE_CAPTURE;
-		if (cap2.capabilities & V4L2_CAP_TUNER)
+		if (cap2->capabilities & V4L2_CAP_TUNER)
 			cap->type |= VID_TYPE_TUNER;
-		if (cap2.capabilities & V4L2_CAP_VBI_CAPTURE)
+		if (cap2->capabilities & V4L2_CAP_VBI_CAPTURE)
 			cap->type |= VID_TYPE_TELETEXT;
-		if (cap2.capabilities & V4L2_CAP_VIDEO_OVERLAY)
+		if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY)
 			cap->type |= VID_TYPE_OVERLAY;
 		if (fbuf2.capability & V4L2_FBUF_CAP_LIST_CLIPPING)
 			cap->type |= VID_TYPE_CLIPPING;
@@ -370,7 +355,6 @@
 	case VIDIOCGFBUF: /*  get frame buffer  */
 	{
 		struct video_buffer	*buffer = arg;
-		struct v4l2_framebuffer	fbuf2;
 
 		err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2);
 		if (err < 0) {
@@ -412,7 +396,6 @@
 	case VIDIOCSFBUF: /*  set frame buffer  */
 	{
 		struct video_buffer	*buffer = arg;
-		struct v4l2_framebuffer	fbuf2;
 
 		memset(&fbuf2, 0, sizeof(fbuf2));
 		fbuf2.base       = buffer->base;
@@ -444,36 +427,36 @@
 	case VIDIOCGWIN: /*  get window or capture dimensions  */
 	{
 		struct video_window	*win = arg;
-		struct v4l2_format	fmt2;
 
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
 		memset(win,0,sizeof(*win));
-		memset(&fmt2,0,sizeof(fmt2));
+		memset(fmt2,0,sizeof(*fmt2));
 
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
 		if (err < 0)
 			dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n",err);
 		if (err == 0) {
-			win->x         = fmt2.fmt.win.w.left;
-			win->y         = fmt2.fmt.win.w.top;
-			win->width     = fmt2.fmt.win.w.width;
-			win->height    = fmt2.fmt.win.w.height;
-			win->chromakey = fmt2.fmt.win.chromakey;
+			win->x         = fmt2->fmt.win.w.left;
+			win->y         = fmt2->fmt.win.w.top;
+			win->width     = fmt2->fmt.win.w.width;
+			win->height    = fmt2->fmt.win.w.height;
+			win->chromakey = fmt2->fmt.win.chromakey;
 			win->clips     = NULL;
 			win->clipcount = 0;
 			break;
 		}
 
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
 		if (err < 0) {
 			dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n",err);
 			break;
 		}
 		win->x         = 0;
 		win->y         = 0;
-		win->width     = fmt2.fmt.pix.width;
-		win->height    = fmt2.fmt.pix.height;
+		win->width     = fmt2->fmt.pix.width;
+		win->height    = fmt2->fmt.pix.height;
 		win->chromakey = 0;
 		win->clips     = NULL;
 		win->clipcount = 0;
@@ -482,37 +465,41 @@
 	case VIDIOCSWIN: /*  set window and/or capture dimensions  */
 	{
 		struct video_window	*win = arg;
-		struct v4l2_format	fmt2;
+		int err1,err2;
 
-		memset(&fmt2,0,sizeof(fmt2));
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
-		if (err < 0)
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		memset(fmt2,0,sizeof(*fmt2));
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		err1 = drv(inode, file, VIDIOC_G_FMT, fmt2);
+		if (err1 < 0)
 			dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n",err);
-		if (err == 0) {
-			fmt2.fmt.pix.width  = win->width;
-			fmt2.fmt.pix.height = win->height;
-			fmt2.fmt.pix.field  = V4L2_FIELD_ANY;
-			err = drv(inode, file, VIDIOC_S_FMT, &fmt2);
+		if (err1 == 0) {
+			fmt2->fmt.pix.width  = win->width;
+			fmt2->fmt.pix.height = win->height;
+			fmt2->fmt.pix.field  = V4L2_FIELD_ANY;
+			err = drv(inode, file, VIDIOC_S_FMT, fmt2);
 			if (err < 0)
 				dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %d\n",
 					err);
-			win->width  = fmt2.fmt.pix.width;
-			win->height = fmt2.fmt.pix.height;
+			win->width  = fmt2->fmt.pix.width;
+			win->height = fmt2->fmt.pix.height;
 		}
 
-		memset(&fmt2,0,sizeof(fmt2));
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-		fmt2.fmt.win.w.left    = win->x;
-		fmt2.fmt.win.w.top     = win->y;
-		fmt2.fmt.win.w.width   = win->width;
-		fmt2.fmt.win.w.height  = win->height;
-		fmt2.fmt.win.chromakey = win->chromakey;
-		fmt2.fmt.win.clips     = (void *)win->clips;
-		fmt2.fmt.win.clipcount = win->clipcount;
-		err = drv(inode, file, VIDIOC_S_FMT, &fmt2);
-		if (err < 0)
+		memset(fmt2,0,sizeof(*fmt2));
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
+		fmt2->fmt.win.w.left    = win->x;
+		fmt2->fmt.win.w.top     = win->y;
+		fmt2->fmt.win.w.width   = win->width;
+		fmt2->fmt.win.w.height  = win->height;
+		fmt2->fmt.win.chromakey = win->chromakey;
+		fmt2->fmt.win.clips     = (void *)win->clips;
+		fmt2->fmt.win.clipcount = win->clipcount;
+		err2 = drv(inode, file, VIDIOC_S_FMT, fmt2);
+		if (err2 < 0)
 			dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n",err);
+
+		if (err1 != 0 && err2 != 0)
+			err = err1;
 		break;
 	}
 	case VIDIOCCAPTURE: /*  turn on/off preview  */
@@ -525,8 +512,6 @@
 	case VIDIOCGCHAN: /*  get input information  */
 	{
 		struct video_channel	*chan = arg;
-		struct v4l2_input	input2;
-		v4l2_std_id    		sid;
 
 		memset(&input2,0,sizeof(input2));
 		input2.index = chan->channel;
@@ -568,16 +553,32 @@
 	case VIDIOCSCHAN: /*  set input  */
 	{
 		struct video_channel *chan = arg;
-		
+
+		sid = 0;
 		err = drv(inode, file, VIDIOC_S_INPUT, &chan->channel);
 		if (err < 0)
 			dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n",err);
+		switch (chan->norm) {
+		case VIDEO_MODE_PAL:
+			sid = V4L2_STD_PAL;
+			break;
+		case VIDEO_MODE_NTSC:
+			sid = V4L2_STD_NTSC;
+			break;
+		case VIDEO_MODE_SECAM:
+			sid = V4L2_STD_SECAM;
+			break;
+		}
+		if (0 != sid) {
+			err = drv(inode, file, VIDIOC_S_STD, &sid);
+			if (err < 0)
+				dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n",err);
+		}
 		break;
 	}
 	case VIDIOCGPICT: /*  get tone controls & partial capture format  */
 	{
 		struct video_picture	*pict = arg;
-		struct v4l2_format	fmt2;
 
 		pict->brightness = get_v4l_control(inode, file,
 						   V4L2_CID_BRIGHTNESS,drv);
@@ -590,25 +591,24 @@
 		pict->whiteness = get_v4l_control(inode, file,
 						  V4L2_CID_WHITENESS, drv);
 
-		memset(&fmt2,0,sizeof(fmt2));
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		memset(fmt2,0,sizeof(*fmt2));
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
 		if (err < 0) {
 			dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err);
 			break;
 		}
 #if 0 /* FIXME */
-		pict->depth   = fmt2.fmt.pix.depth;
+		pict->depth   = fmt2->fmt.pix.depth;
 #endif
 		pict->palette = pixelformat_to_palette(
-			fmt2.fmt.pix.pixelformat);
+			fmt2->fmt.pix.pixelformat);
 		break;
 	}
 	case VIDIOCSPICT: /*  set tone controls & partial capture format  */
 	{
 		struct video_picture	*pict = arg;
-		struct v4l2_format	fmt2;
-		struct v4l2_framebuffer	fbuf2;
 
 		set_v4l_control(inode, file,
 				V4L2_CID_BRIGHTNESS, pict->brightness, drv);
@@ -621,16 +621,17 @@
 		set_v4l_control(inode, file,
 				V4L2_CID_WHITENESS, pict->whiteness, drv);
 
-		memset(&fmt2,0,sizeof(fmt2));
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		memset(fmt2,0,sizeof(*fmt2));
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
 		if (err < 0)
 			dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n",err);
-		if (fmt2.fmt.pix.pixelformat != 
+		if (fmt2->fmt.pix.pixelformat != 
 		    palette_to_pixelformat(pict->palette)) {
-			fmt2.fmt.pix.pixelformat = palette_to_pixelformat(
+			fmt2->fmt.pix.pixelformat = palette_to_pixelformat(
 				pict->palette);
-			err = drv(inode, file, VIDIOC_S_FMT, &fmt2);
+			err = drv(inode, file, VIDIOC_S_FMT, fmt2);
 			if (err < 0)
 				dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n",err);
 		}
@@ -652,8 +653,6 @@
 	case VIDIOCGTUNER: /*  get tuner information  */
 	{
 		struct video_tuner	*tun = arg;
-		struct v4l2_tuner	tun2;
-		v4l2_std_id    		sid;
 
 		memset(&tun2,0,sizeof(tun2));
 		err = drv(inode, file, VIDIOC_G_TUNER, &tun2);
@@ -669,6 +668,19 @@
 		tun->flags = 0;
 		tun->mode = VIDEO_MODE_AUTO;
 
+		for (i = 0; i < 64; i++) {
+			memset(&std2,0,sizeof(std2));
+			std2.index = i;
+			if (0 != drv(inode, file, VIDIOC_ENUMSTD, &std2))
+				break;
+			if (std2.id & V4L2_STD_PAL)
+				tun->flags |= VIDEO_TUNER_PAL;
+			if (std2.id & V4L2_STD_NTSC)
+				tun->flags |= VIDEO_TUNER_NTSC;
+			if (std2.id & V4L2_STD_SECAM)
+				tun->flags |= VIDEO_TUNER_SECAM;
+		}
+
 		err = drv(inode, file, VIDIOC_G_STD, &sid);
 		if (err < 0)
 			dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n",err);
@@ -691,8 +703,6 @@
 #if 0 /* FIXME */
 	case VIDIOCSTUNER: /*  select a tuner input  */
 	{
-		int	i;
-
 		err = drv(inode, file, VIDIOC_S_INPUT, &i);
 		if (err < 0)
 			dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n",err);
@@ -702,7 +712,6 @@
 	case VIDIOCGFREQ: /*  get frequency  */
 	{
 		int *freq = arg;
-		struct v4l2_frequency freq2;
 		
 		err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2);
 		if (err < 0)
@@ -714,7 +723,6 @@
 	case VIDIOCSFREQ: /*  set frequency  */
 	{
 		int *freq = arg;
-		struct v4l2_frequency freq2;
 
 		drv(inode, file, VIDIOC_G_FREQUENCY, &freq2);
 		freq2.frequency = *freq;
@@ -726,10 +734,6 @@
 	case VIDIOCGAUDIO: /*  get audio properties/controls  */
 	{
 		struct video_audio	*aud = arg;
-		struct v4l2_audio	aud2;
-		struct v4l2_queryctrl	qctrl2;
-		struct v4l2_tuner	tun2;
-		int			v;
 
 		err = drv(inode, file, VIDIOC_G_AUDIO, &aud2);
 		if (err < 0) {
@@ -741,34 +745,29 @@
 		aud->name[sizeof(aud->name) - 1] = 0;
 		aud->audio = aud2.index;
 		aud->flags = 0;
-		v = get_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, drv);
-		if (v >= 0)
-		{
-			aud->volume = v;
+		i = get_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, drv);
+		if (i >= 0) {
+			aud->volume = i;
 			aud->flags |= VIDEO_AUDIO_VOLUME;
 		}
-		v = get_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, drv);
-		if (v >= 0)
-		{
-			aud->bass = v;
+		i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, drv);
+		if (i >= 0) {
+			aud->bass = i;
 			aud->flags |= VIDEO_AUDIO_BASS;
 		}
-		v = get_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, drv);
-		if (v >= 0)
-		{
-			aud->treble = v;
+		i = get_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, drv);
+		if (i >= 0) {
+			aud->treble = i;
 			aud->flags |= VIDEO_AUDIO_TREBLE;
 		}
-		v = get_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, drv);
-		if (v >= 0)
-		{
-			aud->balance = v;
+		i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, drv);
+		if (i >= 0) {
+			aud->balance = i;
 			aud->flags |= VIDEO_AUDIO_BALANCE;
 		}
-		v = get_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, drv);
-		if (v >= 0)
-		{
-			if (v)
+		i = get_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, drv);
+		if (i >= 0) {
+			if (i)
 				aud->flags |= VIDEO_AUDIO_MUTE;
 			aud->flags |= VIDEO_AUDIO_MUTABLE;
 		}
@@ -795,8 +794,6 @@
 	case VIDIOCSAUDIO: /*  set audio controls  */
 	{
 		struct video_audio	*aud = arg;
-		struct v4l2_audio	aud2;
-		struct v4l2_tuner	tun2;
 
 		memset(&aud2,0,sizeof(aud2));
 		memset(&tun2,0,sizeof(tun2));
@@ -844,83 +841,36 @@
 		break;
 	}
 #if 0
-	case VIDIOCGMBUF: /*  get mmap parameters  */
-	{
-		struct video_mbuf		*mbuf = arg;
-		struct v4l2_requestbuffers	reqbuf2;
-		struct v4l2_buffer		buf2;
-		struct v4l2_format		fmt2, fmt2o;
-		struct v4l2_capability		cap2;
-		int				i;
-
-		/*  Set the format to maximum dimensions  */
-		if ((err = drv(inode, file, VIDIOC_QUERYCAP, &cap2)) < 0)
-			break;
-		fmt2o.type = V4L2_BUF_TYPE_CAPTURE;
-		if ((err = drv(inode, file, VIDIOC_G_FMT, &fmt2o)) < 0)
-			break;
-		fmt2 = fmt2o;
-		fmt2.fmt.pix.width = cap2.maxwidth;
-		fmt2.fmt.pix.height = cap2.maxheight;
-		fmt2.fmt.pix.flags |= V4L2_FMT_FLAG_INTERLACED;
-		if ((err = drv(inode, file, VIDIOC_S_FMT, &fmt2)) < 0)
-			break;
-		reqbuf2.count = 2; /* v4l always used two buffers */
-		reqbuf2.type = V4L2_BUF_TYPE_CAPTURE | V4L2_BUF_REQ_CONTIG;
-		err = drv(inode, file, VIDIOC_REQBUFS, &reqbuf2);
-		if (err < 0 || reqbuf2.count < 2 || reqbuf2.type
-		    != (V4L2_BUF_TYPE_CAPTURE | V4L2_BUF_REQ_CONTIG))
-		{/*	Driver doesn't support v4l back-compatibility  */
-			fmt2o.fmt.pix.flags |= V4L2_FMT_FLAG_INTERLACED;
-			drv(inode, file, VIDIOC_S_FMT, &fmt2o);
-			reqbuf2.count = 1;
-			reqbuf2.type = V4L2_BUF_TYPE_CAPTURE;
-			err = drv(inode, file, VIDIOC_REQBUFS, &reqbuf2);
-			if (err < 0)
-			{
-				err = -EINVAL;
-				break;
-			}
-			printk(KERN_INFO"V4L2: Device \"%s\" doesn't support"
-			       " v4l memory mapping\n", vfl->name);
-		}
-		buf2.index = 0;
-		buf2.type = V4L2_BUF_TYPE_CAPTURE;
-		err = drv(inode, file, VIDIOC_QUERYBUF, &buf2);
-		mbuf->size = buf2.length * reqbuf2.count;
-		mbuf->frames = reqbuf2.count;
-		memset(mbuf->offsets, 0, sizeof(mbuf->offsets));
-		for (i = 0; i < mbuf->frames; ++i)
-			mbuf->offsets[i] = i * buf2.length;
-		break;
-	}
+	case VIDIOCGMBUF:
+		/* v4l2 drivers must implement that themself.  The
+		   mmap() differences can't be translated fully
+		   transparent, thus there is no point to try that */
 #endif
 	case VIDIOCMCAPTURE: /*  capture a frame  */
 	{
 		struct video_mmap	*mm = arg;
-		struct v4l2_buffer	buf2;
-		struct v4l2_format	fmt2;
 
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
 		memset(&buf2,0,sizeof(buf2));
-		memset(&fmt2,0,sizeof(fmt2));
+		memset(fmt2,0,sizeof(*fmt2));
 		
-		fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		err = drv(inode, file, VIDIOC_G_FMT, &fmt2);
+		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
 		if (err < 0) {
 			dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n",err);
 			break;
 		}
-		if (mm->width   != fmt2.fmt.pix.width || 
-		    mm->height != fmt2.fmt.pix.height ||
+		if (mm->width   != fmt2->fmt.pix.width  || 
+		    mm->height  != fmt2->fmt.pix.height ||
 		    palette_to_pixelformat(mm->format) != 
-		    fmt2.fmt.pix.pixelformat)
+		    fmt2->fmt.pix.pixelformat)
 		{/* New capture format...  */
-			fmt2.fmt.pix.width = mm->width;
-			fmt2.fmt.pix.height = mm->height;
-			fmt2.fmt.pix.pixelformat =
+			fmt2->fmt.pix.width = mm->width;
+			fmt2->fmt.pix.height = mm->height;
+			fmt2->fmt.pix.pixelformat =
 				palette_to_pixelformat(mm->format);
-			fmt2.fmt.pix.field = V4L2_FIELD_ANY;
-			err = drv(inode, file, VIDIOC_S_FMT, &fmt2);
+			fmt2->fmt.pix.field = V4L2_FIELD_ANY;
+			err = drv(inode, file, VIDIOC_S_FMT, fmt2);
 			if (err < 0) {
 				dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n",err);
 				break;
@@ -946,7 +896,6 @@
 	case VIDIOCSYNC: /*  wait for a frame  */
 	{
 		int			*i = arg;
-		struct v4l2_buffer	buf2;
 
 		buf2.index = *i;
 		buf2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -967,7 +916,7 @@
 			(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE))
 		       == V4L2_BUF_FLAG_QUEUED)
 		{
-			err = simple_select(file);
+			err = poll_one(file);
 			if (err < 0 ||	/* error or sleep was interrupted  */
 			    err == 0)	/* timeout? Shouldn't occur.  */
 				break;
@@ -984,20 +933,43 @@
 		} while (err == 0 && buf2.index != *i);
 		break;
 	}
-	case VIDIOCGUNIT: /*  get related device minors  */
-		/*  No translation  */
-		break;
-	case VIDIOCGCAPTURE: /*    */
-		/*  No translation, yet...  */
-		printk(KERN_INFO"v4l1-compat: VIDIOCGCAPTURE not implemented."
-		       " Send patches to [email protected] :-)\n");
-		break;
-	case VIDIOCSCAPTURE: /*    */
-		/*  No translation, yet...  */
-		printk(KERN_INFO"v4l1-compat: VIDIOCSCAPTURE not implemented."
-		       " Send patches to [email protected] :-)\n");
+
+	case VIDIOCGVBIFMT: /* query VBI data capture format */
+	{
+		struct vbi_format      *fmt = arg;
+		
+		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		memset(fmt2, 0, sizeof(*fmt2));
+		fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		
+		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
+		if (err < 0) {
+			dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err);
+			break;
+		}
+		memset(fmt, 0, sizeof(*fmt));
+		fmt->samples_per_line = fmt2->fmt.vbi.samples_per_line;
+		fmt->sampling_rate    = fmt2->fmt.vbi.sampling_rate;
+		fmt->sample_format    = VIDEO_PALETTE_RAW;
+		fmt->start[0]         = fmt2->fmt.vbi.start[0];
+		fmt->count[0]         = fmt2->fmt.vbi.count[0];
+		fmt->start[1]         = fmt2->fmt.vbi.start[1];
+		fmt->count[1]         = fmt2->fmt.vbi.count[1];
+		if (fmt2->fmt.vbi.flags & VBI_UNSYNC)
+			fmt->flags   |= V4L2_VBI_UNSYNC;
+		if (fmt2->fmt.vbi.flags & VBI_INTERLACED)
+			fmt->flags   |= V4L2_VBI_INTERLACED;
+                break;
+	}
+	default:
+		err = -ENOIOCTLCMD;
 		break;
 	}
+
+	if (cap2)
+		kfree(cap2);
+	if (fmt2)
+		kfree(fmt2);
 	return err;
 }