From: "John Kacur" <jkacur@gmail.com>
To: Valdis.Kletnieks@vt.edu
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, 9 Oct 2008 10:02:55 +0200 [thread overview]
Message-ID: <520f0cf10810090102je412ff9rb02017973d339ec1@mail.gmail.com> (raw)
In-Reply-To: <38521.1223537753@turing-police.cc.vt.edu>
On Thu, Oct 9, 2008 at 9:35 AM, <Valdis.Kletnieks@vt.edu> wrote:
> 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.. :)
>
Well, of course you only want to make things shorter when it increases
clarity, you don't want to make things shorter for the sake of making
them shorter, so yeah, I would nix that non-standard default position
too.
next prev parent reply other threads:[~2008-10-09 8:03 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
2008-10-09 8:02 ` John Kacur [this message]
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=520f0cf10810090102je412ff9rb02017973d339ec1@mail.gmail.com \
--to=jkacur@gmail.com \
--cc=Valdis.Kletnieks@vt.edu \
--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®