mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "John Kacur" <jkacur@gmail.com>
To: "Bryan Wu" <cooloney@kernel.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	"Cliff Cai" <cliff.cai@analog.com>
Subject: Fwd: [PATCH 7/9] ASoC: Blackfin: I2S CPU DAI driver
Date: Thu, 9 Oct 2008 08:58:08 +0200	[thread overview]
Message-ID: <520f0cf10810082358t274a46afy7d9c5bbc5ca56de7@mail.gmail.com> (raw)
In-Reply-To: <520f0cf10810082353r2694535evc3edbcb2b3c76796@mail.gmail.com>

On Thu, Sep 4, 2008 at 4:43 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
>
> On Thu, Sep 04, 2008 at 04:22:06PM +0800, Bryan Wu wrote:
> > From: Cliff Cai <cliff.cai@analog.com>
> >
> > Signed-off-by: Cliff Cai <cliff.cai@analog.com>
> > Signed-off-by: Bryan Wu <cooloney@kernel.org>
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
> Please fix the minor issues below as incremental patches for ease of
> review.
>
> > +     switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
> > +     case SND_SOC_DAIFMT_I2S:
> > +             break;
> > +     case SND_SOC_DAIFMT_LEFT_J:
> > +             ret = -EINVAL;
> > +             break;
> > +     }
>
> The SND_SOC_DAFIMT_LEFT_J: ought to be default: instead - there's more
> DAI formats than just that.
>
> > +     if (!bf5xx_i2s.master) {
> > +     /*
> > +      * TX and RX are not independent,they are enabled at the same time,
> > +      * even if only one side is running.So,we need to configure both of
> > +      * them in advance.
> > +      *
> > +      * CPU DAI format:I2S, slave mode.
> > +      */

+       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+       case SND_SOC_DAIFMT_CBS_CFS:
+               ret = -EINVAL;
+               break;
+       case SND_SOC_DAIFMT_CBM_CFS:
+               ret = -EINVAL;
+               break;
+       case SND_SOC_DAIFMT_CBM_CFM:
+               break;
+       case SND_SOC_DAIFMT_CBS_CFM:
+               ret = -EINVAL;
+               break;
+       default:
+               break;
+       }

My eyes fell upon this switch statement, probably I have similar
criticisms as to what has already been said, but:
1. Surely the default case is also an -EINVAL
2. Why not let all the EINVALS fall through, it will shorten up the
code, and IMO make it more readable, something like this?
+       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+       case SND_SOC_DAIFMT_CBM_CFM: /* Passing Case */
+               break;
+       case SND_SOC_DAIFMT_CBS_CFS: /* Failing Cases */
+       case SND_SOC_DAIFMT_CBM_CFS:
+       case SND_SOC_DAIFMT_CBS_CFM:
+               ret = -EINVAL;
+               break;
+       default:
+               printk(KERN_INFO "Unknown SND_SOC_DAIFMT kind\n");
+               ret = -EINVAL;
+               break;
+       }

  parent reply	other threads:[~2008-10-09  6:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04  8:21 [PATCH 0/9] ASoC Blackfin supporting Bryan Wu
2008-09-04  8:22 ` [PATCH 1/9] ASoC: add Blackfin build options to Kconfig and Makefile of sound soc framework Bryan Wu
2008-09-04  8:22 ` [PATCH 2/9] ASoC: Blackfin: add Blackfin arch ASoC Kconfig and Makefile Bryan Wu
2008-09-04 10:41   ` Mark Brown
2008-09-04  8:22 ` [PATCH 3/9] ASoC: Blackfin: SPORT peripheral interface driver Bryan Wu
2008-09-04 10:47   ` Mark Brown
2008-09-04 14:11     ` Mike Frysinger
2008-09-04  8:22 ` [PATCH 4/9] ASoC: Blackfin: DMA Driver for AC97 sound chip Bryan Wu
2008-09-04 12:37   ` Mark Brown
2008-09-04  8:22 ` [PATCH 5/9] ASoC: Blackfin: AC97 Blackfin CPU DAI driver Bryan Wu
2008-09-04 12:46   ` Mark Brown
2008-09-04 12:49   ` Mark Brown
2008-09-04  8:22 ` [PATCH 6/9] ASoC: Blackfin: DMA Driver for I2S sound chip Bryan Wu
2008-09-04 14:32   ` Mark Brown
2008-09-04  8:22 ` [PATCH 7/9] ASoC: Blackfin: I2S CPU DAI driver Bryan Wu
2008-09-04 14:43   ` Mark Brown
     [not found]     ` <520f0cf10810082353r2694535evc3edbcb2b3c76796@mail.gmail.com>
2008-10-09  6:58       ` John Kacur [this message]
2008-10-09  7:35         ` Fwd: " Valdis.Kletnieks
2008-10-09  8:02           ` John Kacur
2008-10-09 10:44         ` [alsa-devel] " Mark Brown
2008-09-04  8:22 ` [PATCH 8/9] ASoC: Blackfin: board driver for AD1980/1 audio codec Bryan Wu
2008-09-04 14:44   ` Mark Brown
2008-09-04  8:22 ` [PATCH 9/9] ASoC: Blackfin: board driver for SSM2602 sound chip Bryan Wu
2008-09-04 14:49   ` Mark Brown

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=520f0cf10810082358t274a46afy7d9c5bbc5ca56de7@mail.gmail.com \
    --to=jkacur@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=cliff.cai@analog.com \
    --cc=cooloney@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®