summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-31 08:44:22 +0200
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-31 08:44:22 +0200
commit16606c768bcdfd4d0ce36f8263a81aac8324732f (patch)
treedd522e23599ef39f287957f41ecd720745822a47 /linux/drivers
parent760482414d848730ddfb7bbf28d43c7e829f3eac (diff)
downloadmediapointer-dvb-s2-16606c768bcdfd4d0ce36f8263a81aac8324732f.tar.gz
mediapointer-dvb-s2-16606c768bcdfd4d0ce36f8263a81aac8324732f.tar.bz2
pxa-camera: simplify the .buf_queue path by merging two loops
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> pxa_dma_update_sg_tail() is called only once, runs exactly the same loop as the caller and has to recalculate the last element in an sg-list, that the caller has already calculated. Eliminate redundancy by merging the two loops and re-using the calculated pointer. This also saves a bit of performance which is always good during video-capture. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> --- drivers/media/video/pxa_camera.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/pxa_camera.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/linux/drivers/media/video/pxa_camera.c b/linux/drivers/media/video/pxa_camera.c
index 318d5f61b..98825d631 100644
--- a/linux/drivers/media/video/pxa_camera.c
+++ b/linux/drivers/media/video/pxa_camera.c
@@ -576,15 +576,6 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev)
}
}
-static void pxa_dma_update_sg_tail(struct pxa_camera_dev *pcdev,
- struct pxa_buffer *buf)
-{
- int i;
-
- for (i = 0; i < pcdev->channels; i++)
- pcdev->sg_tail[i] = buf->dmas[i].sg_cpu + buf->dmas[i].sglen;
-}
-
static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev,
struct pxa_buffer *buf)
{
@@ -595,12 +586,13 @@ static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev,
buf_last_desc = buf->dmas[i].sg_cpu + buf->dmas[i].sglen;
buf_last_desc->ddadr = DDADR_STOP;
- if (!pcdev->sg_tail[i])
- continue;
- pcdev->sg_tail[i]->ddadr = buf->dmas[i].sg_dma;
- }
+ if (pcdev->sg_tail[i])
+ /* Link the new buffer to the old tail */
+ pcdev->sg_tail[i]->ddadr = buf->dmas[i].sg_dma;
- pxa_dma_update_sg_tail(pcdev, buf);
+ /* Update the channel tail */
+ pcdev->sg_tail[i] = buf_last_desc;
+ }
}
/**