Received: from eggs.gnu.org ([208.118.235.92]:50372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDGMn-0006a7-4n for qemu-devel@nongnu.org; Thu, 29 Mar 2012 10:30:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDGMc-00007e-Vg for qemu-devel@nongnu.org; Thu, 29 Mar 2012 10:30:20 -0400 Received: from smtp.ispras.ru ([83.149.198.202]:45071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDGMc-0008DH-Oa for qemu-devel@nongnu.org; Thu, 29 Mar 2012 10:30:10 -0400 Date: Thu, 29 Mar 2012 18:29:46 +0400 (MSK) From: Kirill Batuzov In-Reply-To: <3ed7b2d2b127ceccf0df6f020da3e25affff02c7.1332989118.git.peter.crosthwaite@petalogix.com> Message-ID: References: <3ed7b2d2b127ceccf0df6f020da3e25affff02c7.1332989118.git.peter.crosthwaite@petalogix.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH v1 1/2] pl330: initial version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter A. G. Crosthwaite" Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, zhur@ispras.ru, paul@codesourcery.com, duyl@xilinx.com, linnj@xilinx.com, edgar.iglesias@gmail.com, john.williams@petalogix.com On Thu, 29 Mar 2012, Peter A. G. Crosthwaite wrote: > Device model for Primecell PL330 dma controller. > > Signed-off-by: Peter A. G. Crosthwaite > --- Signed-off-by: Kirill Batuzov > +static int PL330Fifo_get(PL330Fifo *s, uint8_t *buf, int len, uint8_t tag) > +{ > + int i, ret; > + int old_s, old_t; > + > + old_s = s->s; > + old_t = s->t; > + for (i = 0; i < len; i++) { > + if (s->t != s->s && s->tag[s->s] == tag) { > + buf[i] = s->buf[s->s]; > + s->s = PL330Fifo_inc(s->s, s->buf_size); > + } else { > + /* Rollback transaction */ > + ret = (s->t == s->s) ? ret = PL330FIFO_STALL : PL330FIFO_ERR; Minor issue - double assignement of ret in this line. > + s->s = old_s; > + s->t = old_t; > + return ret; > + } > + } > + return PL330FIFO_OK; > +} -- Kirill Batuzov