From patchwork Thu Oct 1 17:30:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 34756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AAB59B7BCE for ; Fri, 2 Oct 2009 03:55:53 +1000 (EST) Received: from localhost ([127.0.0.1]:56395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtPsb-0000qf-2M for incoming@patchwork.ozlabs.org; Thu, 01 Oct 2009 13:55:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtPWT-0007B2-LI for qemu-devel@nongnu.org; Thu, 01 Oct 2009 13:32:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtPWO-00074E-Ku for qemu-devel@nongnu.org; Thu, 01 Oct 2009 13:32:57 -0400 Received: from [199.232.76.173] (port=45673 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtPWO-00073r-Cl for qemu-devel@nongnu.org; Thu, 01 Oct 2009 13:32:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37113) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtPWN-0003AH-Ru for qemu-devel@nongnu.org; Thu, 01 Oct 2009 13:32:52 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n91HWlQ8023071; Thu, 1 Oct 2009 13:32:47 -0400 Received: from redhat.com (vpn-10-11.str.redhat.com [10.32.10.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n91HWi4N002720; Thu, 1 Oct 2009 13:32:45 -0400 Date: Thu, 1 Oct 2009 19:30:49 +0200 From: "Michael S. Tsirkin" To: Blue Swirl Message-ID: <20091001173049.GA11839@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Juan Quintela , qemu-devel@nongnu.org, Markus Armbruster Subject: [Qemu-devel] [PATCHv2] hw/omap_dma: add matching {} in if 0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org MULTI_REQ is never defined, so it doesn't matter much, but since we have an if statement there, let's add {} to clarify what it should do if it's uncommented, and indent the code properly. Signed-off-by: Michael S. Tsirkin --- Changes from v1: indented code within {} scope. hw/omap_dma.c | 122 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 62 insertions(+), 60 deletions(-) diff --git a/hw/omap_dma.c b/hw/omap_dma.c index 205d010..3e718ba 100644 --- a/hw/omap_dma.c +++ b/hw/omap_dma.c @@ -588,87 +588,89 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma) #ifdef MULTI_REQ /* TODO: should all of this only be done if dma->update, and otherwise * inside omap_dma_transfer_generic below - check what's faster. */ - if (dma->update) + if (dma->update) { #endif - /* If the channel is element synchronized, deactivate it */ - if (min_elems == elements[omap_dma_intr_element_sync]) - omap_dma_deactivate_channel(s, ch); + /* If the channel is element synchronized, deactivate it */ + if (min_elems == elements[omap_dma_intr_element_sync]) + omap_dma_deactivate_channel(s, ch); - /* If it is the last frame, set the LAST_FRAME interrupt */ - if (min_elems == elements[omap_dma_intr_last_frame]) - ch->status |= LAST_FRAME_INTR; + /* If it is the last frame, set the LAST_FRAME interrupt */ + if (min_elems == elements[omap_dma_intr_last_frame]) + ch->status |= LAST_FRAME_INTR; - /* If exactly half of the frame was reached, set the HALF_FRAME - interrupt */ - if (min_elems == elements[omap_dma_intr_half_frame]) - ch->status |= HALF_FRAME_INTR; + /* If exactly half of the frame was reached, set the HALF_FRAME + interrupt */ + if (min_elems == elements[omap_dma_intr_half_frame]) + ch->status |= HALF_FRAME_INTR; - /* If a full packet has been transferred, set the END_PKT interrupt */ - if (min_elems == elements[omap_dma_intr_packet]) - ch->status |= END_PKT_INTR; + /* If a full packet has been transferred, set the END_PKT interrupt */ + if (min_elems == elements[omap_dma_intr_packet]) + ch->status |= END_PKT_INTR; - /* If the channel is packet-synchronized, deactivate it */ - if (min_elems == elements[omap_dma_intr_packet_sync]) - omap_dma_deactivate_channel(s, ch); + /* If the channel is packet-synchronized, deactivate it */ + if (min_elems == elements[omap_dma_intr_packet_sync]) + omap_dma_deactivate_channel(s, ch); - /* If the channel is frame synchronized, deactivate it */ - if (min_elems == elements[omap_dma_intr_frame_sync]) - omap_dma_deactivate_channel(s, ch); + /* If the channel is frame synchronized, deactivate it */ + if (min_elems == elements[omap_dma_intr_frame_sync]) + omap_dma_deactivate_channel(s, ch); - /* Set the END_FRAME interrupt */ - if (min_elems == elements[omap_dma_intr_frame]) - ch->status |= END_FRAME_INTR; + /* Set the END_FRAME interrupt */ + if (min_elems == elements[omap_dma_intr_frame]) + ch->status |= END_FRAME_INTR; - if (min_elems == elements[omap_dma_intr_block]) { - /* End of Block */ - /* Disable the channel */ + if (min_elems == elements[omap_dma_intr_block]) { + /* End of Block */ + /* Disable the channel */ - if (ch->omap_3_1_compatible_disable) { - omap_dma_disable_channel(s, ch); - if (ch->link_enabled) - omap_dma_enable_channel(s, &s->ch[ch->link_next_ch]); - } else { - if (!ch->auto_init) + if (ch->omap_3_1_compatible_disable) { omap_dma_disable_channel(s, ch); - else if (ch->repeat || ch->end_prog) - omap_dma_channel_load(ch); - else { - ch->waiting_end_prog = 1; - omap_dma_deactivate_channel(s, ch); + if (ch->link_enabled) + omap_dma_enable_channel(s, &s->ch[ch->link_next_ch]); + } else { + if (!ch->auto_init) + omap_dma_disable_channel(s, ch); + else if (ch->repeat || ch->end_prog) + omap_dma_channel_load(ch); + else { + ch->waiting_end_prog = 1; + omap_dma_deactivate_channel(s, ch); + } } - } - if (ch->interrupts & END_BLOCK_INTR) - ch->status |= END_BLOCK_INTR; - } + if (ch->interrupts & END_BLOCK_INTR) + ch->status |= END_BLOCK_INTR; + } - /* Update packet number */ - if (ch->fs && ch->bs) { - a->pck_element += min_elems; - a->pck_element %= a->pck_elements; - } + /* Update packet number */ + if (ch->fs && ch->bs) { + a->pck_element += min_elems; + a->pck_element %= a->pck_elements; + } - /* TODO: check if we really need to update anything here or perhaps we - * can skip part of this. */ + /* TODO: check if we really need to update anything here or perhaps we + * can skip part of this. */ #ifndef MULTI_REQ - if (dma->update) { + if (dma->update) { #endif - a->element += min_elems; + a->element += min_elems; - frames = a->element / a->elements; - a->element = a->element % a->elements; - a->frame += frames; - a->src += min_elems * a->elem_delta[0] + frames * a->frame_delta[0]; - a->dest += min_elems * a->elem_delta[1] + frames * a->frame_delta[1]; + frames = a->element / a->elements; + a->element = a->element % a->elements; + a->frame += frames; + a->src += min_elems * a->elem_delta[0] + frames * a->frame_delta[0]; + a->dest += min_elems * a->elem_delta[1] + frames * a->frame_delta[1]; - /* If the channel is async, update cpc */ - if (!ch->sync && frames) - ch->cpc = a->dest & 0xffff; + /* If the channel is async, update cpc */ + if (!ch->sync && frames) + ch->cpc = a->dest & 0xffff; - /* TODO: if the destination port is IMIF or EMIFF, set the dirty - * bits on it. */ + /* TODO: if the destination port is IMIF or EMIFF, set the dirty + * bits on it. */ #ifndef MULTI_REQ + } +#else } #endif