aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mx2_camera.c
diff options
context:
space:
mode:
authorJavier Martin <javier.martin@vista-silicon.com>2012-02-22 05:59:33 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 07:43:03 -0500
commita654ba16fdbad8ffb5a6c0dd5098c6651bde08b5 (patch)
tree046f3a0af63fef7fbd7931b802f682648d56f79d /drivers/media/video/mx2_camera.c
parentd84279e6d7266e11bef19de4f624849daa70bc48 (diff)
[media] media: i.MX27 camera: Use list_first_entry() whenever possible
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> [g.liakhovetski@gmx.de: fix one list_first_entry() instance] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mx2_camera.c')
-rw-r--r--drivers/media/video/mx2_camera.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 32a9d76d69c8..2d1941435786 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -449,7 +449,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
449 buf = NULL; 449 buf = NULL;
450 writel(0, pcdev->base_csi + fb_reg); 450 writel(0, pcdev->base_csi + fb_reg);
451 } else { 451 } else {
452 buf = list_entry(pcdev->capture.next, struct mx2_buffer, 452 buf = list_first_entry(&pcdev->capture, struct mx2_buffer,
453 queue); 453 queue);
454 vb = &buf->vb; 454 vb = &buf->vb;
455 list_del(&buf->queue); 455 list_del(&buf->queue);
@@ -709,8 +709,8 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
709 709
710 spin_lock_irqsave(&pcdev->lock, flags); 710 spin_lock_irqsave(&pcdev->lock, flags);
711 711
712 buf = list_entry(pcdev->capture.next, 712 buf = list_first_entry(&pcdev->capture, struct mx2_buffer,
713 struct mx2_buffer, queue); 713 queue);
714 buf->bufnum = 0; 714 buf->bufnum = 0;
715 vb = &buf->vb; 715 vb = &buf->vb;
716 buf->state = MX2_STATE_ACTIVE; 716 buf->state = MX2_STATE_ACTIVE;
@@ -719,8 +719,8 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
719 mx27_update_emma_buf(pcdev, phys, buf->bufnum); 719 mx27_update_emma_buf(pcdev, phys, buf->bufnum);
720 list_move_tail(pcdev->capture.next, &pcdev->active_bufs); 720 list_move_tail(pcdev->capture.next, &pcdev->active_bufs);
721 721
722 buf = list_entry(pcdev->capture.next, 722 buf = list_first_entry(&pcdev->capture, struct mx2_buffer,
723 struct mx2_buffer, queue); 723 queue);
724 buf->bufnum = 1; 724 buf->bufnum = 1;
725 vb = &buf->vb; 725 vb = &buf->vb;
726 buf->state = MX2_STATE_ACTIVE; 726 buf->state = MX2_STATE_ACTIVE;
@@ -1205,8 +1205,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
1205 struct vb2_buffer *vb; 1205 struct vb2_buffer *vb;
1206 unsigned long phys; 1206 unsigned long phys;
1207 1207
1208 buf = list_entry(pcdev->active_bufs.next, 1208 buf = list_first_entry(&pcdev->active_bufs, struct mx2_buffer, queue);
1209 struct mx2_buffer, queue);
1210 1209
1211 BUG_ON(buf->bufnum != bufnum); 1210 BUG_ON(buf->bufnum != bufnum);
1212 1211
@@ -1260,8 +1259,8 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
1260 return; 1259 return;
1261 } 1260 }
1262 1261
1263 buf = list_entry(pcdev->discard.next, 1262 buf = list_first_entry(&pcdev->discard, struct mx2_buffer,
1264 struct mx2_buffer, queue); 1263 queue);
1265 buf->bufnum = bufnum; 1264 buf->bufnum = bufnum;
1266 1265
1267 list_move_tail(pcdev->discard.next, &pcdev->active_bufs); 1266 list_move_tail(pcdev->discard.next, &pcdev->active_bufs);
@@ -1269,8 +1268,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
1269 return; 1268 return;
1270 } 1269 }
1271 1270
1272 buf = list_entry(pcdev->capture.next, 1271 buf = list_first_entry(&pcdev->capture, struct mx2_buffer, queue);
1273 struct mx2_buffer, queue);
1274 1272
1275 buf->bufnum = bufnum; 1273 buf->bufnum = bufnum;
1276 1274
@@ -1304,7 +1302,7 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
1304 pcdev->base_emma + PRP_CNTL); 1302 pcdev->base_emma + PRP_CNTL);
1305 writel(cntl, pcdev->base_emma + PRP_CNTL); 1303 writel(cntl, pcdev->base_emma + PRP_CNTL);
1306 1304
1307 buf = list_entry(pcdev->active_bufs.next, 1305 buf = list_first_entry(&pcdev->active_bufs,
1308 struct mx2_buffer, queue); 1306 struct mx2_buffer, queue);
1309 mx27_camera_frame_done_emma(pcdev, 1307 mx27_camera_frame_done_emma(pcdev,
1310 buf->bufnum, true); 1308 buf->bufnum, true);
@@ -1316,8 +1314,8 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
1316 * Both buffers have triggered, process the one we're expecting 1314 * Both buffers have triggered, process the one we're expecting
1317 * to first 1315 * to first
1318 */ 1316 */
1319 buf = list_entry(pcdev->active_bufs.next, 1317 buf = list_first_entry(&pcdev->active_bufs, struct mx2_buffer,
1320 struct mx2_buffer, queue); 1318 queue);
1321 mx27_camera_frame_done_emma(pcdev, buf->bufnum, false); 1319 mx27_camera_frame_done_emma(pcdev, buf->bufnum, false);
1322 status &= ~(1 << (6 - buf->bufnum)); /* mark processed */ 1320 status &= ~(1 << (6 - buf->bufnum)); /* mark processed */
1323 } else if ((status & (1 << 6)) || (status & (1 << 4))) { 1321 } else if ((status & (1 << 6)) || (status & (1 << 4))) {