From patchwork Wed Jul 3 05:56:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Libin Yang X-Patchwork-Id: 2815211 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 447ACBF4A1 for ; Wed, 3 Jul 2013 05:56:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68E5A200E8 for ; Wed, 3 Jul 2013 05:56:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7ADB4200DC for ; Wed, 3 Jul 2013 05:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057Ab3GCF41 (ORCPT ); Wed, 3 Jul 2013 01:56:27 -0400 Received: from na3sys009aog108.obsmtp.com ([74.125.149.199]:45365 "EHLO na3sys009aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512Ab3GCF41 (ORCPT ); Wed, 3 Jul 2013 01:56:27 -0400 Received: from SC-OWA.marvell.com ([199.233.58.135]) (using TLSv1) by na3sys009aob108.postini.com ([74.125.148.12]) with SMTP ID DSNKUdO9CPe/OmQSZrjJhfao0j9HesUEStFr@postini.com; Tue, 02 Jul 2013 22:56:26 PDT Received: from maili.marvell.com (10.93.76.43) by SC-OWA.marvell.com (10.93.76.28) with Microsoft SMTP Server id 8.3.213.0; Tue, 2 Jul 2013 22:56:10 -0700 Received: from localhost (unknown [10.38.36.205]) by maili.marvell.com (Postfix) with ESMTP id 6BBE51CCD9C; Tue, 2 Jul 2013 22:56:10 -0700 (PDT) From: Libin Yang To: , CC: , , Libin Yang , Albert Wang Subject: [PATCH v3 4/7] marvell-ccic: refine mcam_set_contig_buffer function Date: Wed, 3 Jul 2013 13:56:01 +0800 Message-ID: <1372830964-22323-5-git-send-email-lbyang@marvell.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1372830964-22323-1-git-send-email-lbyang@marvell.com> References: <1372830964-22323-1-git-send-email-lbyang@marvell.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 6921e84..dbd0c6b 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); } /*