From: Valdis.Kletnieks@vt.edu
To: John Kacur <jkacur@gmail.com>
Cc: Bryan Wu <cooloney@kernel.org>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Cliff Cai <cliff.cai@analog.com>
Subject: Re: Fwd: [PATCH 7/9] ASoC: Blackfin: I2S CPU DAI driver
Date: Thu, 09 Oct 2008 03:35:53 -0400 [thread overview]
Message-ID: <38521.1223537753@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Thu, 09 Oct 2008 08:58:08 +0200." <520f0cf10810082358t274a46afy7d9c5bbc5ca56de7@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
On Thu, 09 Oct 2008 08:58:08 +0200, John Kacur said:
> 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;
> + }
Even shorter, but puts the default in a non-standard place:
+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+ case SND_SOC_DAIFMT_CBM_CFM: /* Passing Case */
+ break;
+ default: /* So much Fail we should say something */
+ printk(KERN_INFO "Unknown SND_SOC_DAIFMT kind\n");
+ case SND_SOC_DAIFMT_CBS_CFS: /* Failing Cases */
+ case SND_SOC_DAIFMT_CBM_CFS:
+ case SND_SOC_DAIFMT_CBS_CFM:
+ ret = -EINVAL;
+ break;
+ }
(I see a checkpatch update to check where default: is, coming in 3.. 2.. 1.. :)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
next prev parent reply other threads:[~2008-10-09 7:36 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 ` Fwd: " John Kacur
2008-10-09 7:35 ` Valdis.Kletnieks [this message]
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=38521.1223537753@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=alsa-devel@alsa-project.org \
--cc=cliff.cai@analog.com \
--cc=cooloney@kernel.org \
--cc=jkacur@gmail.com \
--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®