public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@nokia.com>
To: "ext Candelaria Villareal, Jorge" <x0107209@ti.com>
Cc: "Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@nokia.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"broonie@opensource.wolfsonmicro.com"
	<broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 2/3] ASoC: OMAP4: Add support for McPDM
Date: Sun, 20 Dec 2009 16:19:41 +0200	[thread overview]
Message-ID: <20091220141941.GA6089@nokia.com> (raw)
In-Reply-To: <2256F256009DAA4CBE661E9F41EAC84B8BB2A669@dlee01.ent.ti.com>

Hi,

On Fri, Dec 18, 2009 at 06:01:19PM +0100, ext Candelaria Villareal, Jorge wrote:
>Mmm... But it _does_ have some breaks. Besides, I am still unsure that
>if structure should be used here. Code would be duplicated, for example,
>DN_IRQ_FULL and DN_IRQ_EMPTY share the same procedure to acknowledge
>the request.

quoting your switch for irq here:

> +       switch (irq_status) {
> +       case DN_IRQ_FULL:
> +       case DN_IRQ_EMTPY:
> +               dev_err(mcpdm_irq->dev, "DN FIFO error %x\n", irq_status);
> +               omap_mcpdm_reset(MCPDM_DOWNLINK, 1);
> +               omap_mcpdm_set_downlink(mcpdm_irq->downlink);
> +               omap_mcpdm_reset(MCPDM_DOWNLINK, 0);
> +               break;
> +       case DN_IRQ:
> +               dev_dbg(mcpdm_irq->dev, "DN write request\n");
> +               break;
> +       case UP_IRQ_FULL:
> +       case UP_IRQ_EMPTY:
> +               dev_err(mcpdm_irq->dev, "UP FIFO error %x\n", irq_status);
> +               omap_mcpdm_reset(MCPDM_UPLINK, 1);
> +               omap_mcpdm_set_uplink(mcpdm_irq->uplink);
> +               omap_mcpdm_reset(MCPDM_UPLINK, 0);
> +               break;
> +       case UP_IRQ:
> +               dev_dbg(mcpdm_irq->dev, "UP write request\n");
> +               break;
> +       }

what happens if you have both DN_IRQ_FULL and DN_IRQ_EMPTY at the same 
time ?

irq_status == DN_IRQ_FULL will evaluate to false and
irq_status == DN_IRQ_EMPTY will also evaluate to false so none of those 
case statements will execute. Similarly to other case statements.

if you have to execute the same piece of code for two different irqs you 
can always:

if ((irq_status & DN_IRQ_FULL) || (irq_status & DN_IRQ_EMPTY))
	ack_those_irqs();

this code might be working now only out of luck, simply because you 
didn't have two irqs hapenning at the same time. Do not use switch() on 
bitmasks, it won't work always.

-- 
balbi

  reply	other threads:[~2009-12-20 14:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17 19:40 [PATCH 2/3] ASoC: OMAP4: Add support for McPDM Candelaria Villareal, Jorge
2009-12-17 20:28 ` Felipe Balbi
2009-12-18  2:23   ` Candelaria Villareal, Jorge
2009-12-18  9:33     ` Felipe Balbi
2009-12-18 10:54       ` Mark Brown
2009-12-18 17:01       ` Candelaria Villareal, Jorge
2009-12-20 14:19         ` Felipe Balbi [this message]
2009-12-20 18:58           ` Felipe Balbi
2009-12-21 22:50           ` Candelaria Villareal, Jorge
2009-12-18 10:51   ` [alsa-devel] " Mark Brown
2009-12-18 11:13     ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091220141941.GA6089@nokia.com \
    --to=felipe.balbi@nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=x0107209@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox