- Subject: patch for zr364xx driver
- From: xyzzy at speakeasy.org (Trent Piepho)
- Date: Tue Mar 6 00:27:43 2007
There zr364xx driver sometimes needs to byteswap a buffer. The kernel has
functions to do this, and some arches have optimized asm code written for
it, or at least C code that compiles well. This patch uses one of those
functions.
Also, gcc sometimes thinks pointer aliasing may occur when it won't. In a
loop like:
if(i=0;i<BUFFER_SIZE/2;i++) swab16s((u16*)cam->buffer + i);
gcc thinks that the value of the pointer cam->buffer may change, i.e. that
somehow &(cam->buffer) == &(cam->buffer[i]). So on every iteration of the
loop it re-loads the buffer pointer out of the cam struct. If you use a
temp variable to hold the pointer:
u16 *buf = (u16*)cam->buffer;
if(i=0;i<BUFFER_SIZE/2;i++) swab16s(buf + i);
gcc knows that &(buf) != &(buf[i]), since the address of buf is never
taken, so gcc doesn't need to re-load buf each iteration.
Anyway, here is the patch:
http://linuxtv.org/hg/~tap/v4l-dvb?cmd=changeset;node=6b208a1d566c;style=gitweb
Antoine, does it look ok?
[Linux Media]
[Older V4L]
[Linux DVB]
[Video Disk Recorder]
[Asterisk]
[Photo]
[DCCP]
[Netdev]
[Xorg]
[Util Linux NG]
[Xfree86]
[Free Photo Albums]
[Fedora Users]
[Fedora Women]
[ALSA Users]
[ALSA Devel]
[SSH]
[Linux USB]
 |
 |
-->