From patchwork Tue Jun 4 05:54:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Libin Yang X-Patchwork-Id: 2657061 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C19603FC8C for ; Tue, 4 Jun 2013 05:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751576Ab3FDFyx (ORCPT ); Tue, 4 Jun 2013 01:54:53 -0400 Received: from na3sys009aog120.obsmtp.com ([74.125.149.140]:47528 "EHLO na3sys009aog120.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751359Ab3FDFyx (ORCPT ); Tue, 4 Jun 2013 01:54:53 -0400 X-Greylist: delayed 1049 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Jun 2013 01:54:50 EDT Received: from SC-OWA01.marvell.com ([199.233.58.136]) (using TLSv1) by na3sys009aob120.postini.com ([74.125.148.12]) with SMTP ID DSNKUa2BKo3GlPTfp9BkGzRFBK7uEfEwAU45@postini.com; Mon, 03 Jun 2013 22:54:53 PDT Received: from [10.38.36.180] (10.38.36.180) by sc-owa01.marvell.com (10.93.76.21) with Microsoft SMTP Server (TLS) id 8.3.213.0; Mon, 3 Jun 2013 22:54:40 -0700 Message-ID: <1370325279.26072.28.camel@younglee-desktop> Subject: [PATCH 4/7] marvell-ccic: refine mcam_set_contig_buffer function From: lbyang Reply-To: To: , , CC: , , Date: Tue, 4 Jun 2013 13:54:39 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Libin Yang This patch refines mcam_set_contig_buffer() in mcam core. It can remove redundant code line and enhance readability. Signed-off-by: Albert Wang Signed-off-by: Libin Yang Acked-by: Guennadi Liakhovetski Acked-by: Jonathan Corbet --- drivers/media/platform/marvell-ccic/mcam-core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index f9b8641..19404ff 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c @@ -482,22 +482,21 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame) */ if (list_empty(&cam->buffers)) { buf = cam->vb_bufs[frame ^ 0x1]; - cam->vb_bufs[frame] = buf; - mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, - vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0)); set_bit(CF_SINGLE_BUFFER, &cam->flags); cam->frame_state.singles++; - return; + } else { + /* + * OK, we have a buffer we can use. + */ + buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, + queue); + list_del_init(&buf->queue); + clear_bit(CF_SINGLE_BUFFER, &cam->flags); } - /* - * OK, we have a buffer we can use. - */ - buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue); - list_del_init(&buf->queue); + + cam->vb_bufs[frame] = buf; mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0)); - cam->vb_bufs[frame] = buf; - clear_bit(CF_SINGLE_BUFFER, &cam->flags); } /*