diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-03-07 16:19:49 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:44:19 -0400 |
commit | 93566ad8068a968c3e72951b4539eb9da661446d (patch) | |
tree | a326288f20ee3815f50c1e590c3f149a5dc83cbb /drivers/media/video/zr364xx.c | |
parent | cf3c34c87f921c5c63d47285c9860345cdaf5170 (diff) |
V4L/DVB (5392): Zr364xx: Use kernel's byte-swapping function
Some code to swap bytes wasn't using the swab16() function that the
kernel provides for this. Make use of it, which results in more
efficient code.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Antoine Jacquet <royale@zerezo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/zr364xx.c')
-rw-r--r-- | drivers/media/video/zr364xx.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 16bb3576b6ea..b5d3364c94c7 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -277,7 +277,7 @@ static unsigned char header3; | |||
277 | static int read_frame(struct zr364xx_camera *cam, int framenum) | 277 | static int read_frame(struct zr364xx_camera *cam, int framenum) |
278 | { | 278 | { |
279 | int i, n, temp, head, size, actual_length; | 279 | int i, n, temp, head, size, actual_length; |
280 | unsigned char *ptr = NULL, *jpeg, swap; | 280 | unsigned char *ptr = NULL, *jpeg; |
281 | 281 | ||
282 | redo: | 282 | redo: |
283 | /* hardware brightness */ | 283 | /* hardware brightness */ |
@@ -308,12 +308,11 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) | |||
308 | } | 308 | } |
309 | 309 | ||
310 | /* swap bytes if camera needs it */ | 310 | /* swap bytes if camera needs it */ |
311 | if (cam->method == METHOD0) | 311 | if (cam->method == METHOD0) { |
312 | for (i = 0; i < BUFFER_SIZE; i += 2) { | 312 | u16 *buf = (u16*)cam->buffer; |
313 | swap = cam->buffer[i]; | 313 | for (i = 0; i < BUFFER_SIZE/2; i++) |
314 | cam->buffer[i] = cam->buffer[i + 1]; | 314 | swab16s(buf + i); |
315 | cam->buffer[i + 1] = swap; | 315 | } |
316 | } | ||
317 | 316 | ||
318 | /* write the JPEG header */ | 317 | /* write the JPEG header */ |
319 | if (!head) { | 318 | if (!head) { |