From: Mark Brown <broonie@kernel.org>
To: Songjun Wu <songjun.wu@atmel.com>
Cc: nicolas.ferre@atmel.com, linux-arm-kernel@lists.infradead.org,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] ASoC: atmel-pdmic: add the Pulse Density Modulation Interface Controller
Date: Wed, 16 Dec 2015 12:27:27 +0000 [thread overview]
Message-ID: <20151216122727.GI5727@sirena.org.uk> (raw)
In-Reply-To: <1450080940-4123-2-git-send-email-songjun.wu@atmel.com>
[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]
On Mon, Dec 14, 2015 at 04:15:39PM +0800, Songjun Wu wrote:
> Add driver for the Pulse Density Modulation Interface
> Controller. It comes with digitallly controlled gain,
> a High-Pass and a SINCC filter.
This looks basically OK but there's a *lot* of weird coding style issues
in here. It's really all that, nothing too serious that I noticed -
I've pointed out some of the patterns below not every individual issue.
> + for (i = 0; i < ARRAY_SIZE(mic_gain_table); i++) {
> + if ((mic_gain_table[i].dgain == dgain_val)
> + && (mic_gain_table[i].scale == scale_val))
> + ucontrol->value.integer.value[0] = i;
> + }
This indentation is really weird, why is the && aligned with the if?
> + snd_soc_update_bits(codec, PDMIC_DSPR1,
> + PDMIC_DSPR1_OFFSET_MASK,
> + (u32)(dd->pdata->mic_offset << PDMIC_DSPR1_OFFSET_SHIFT));
These are weird too, I'd expect the second line to be part of the first.
> +static struct regmap *atmel_pdmic_codec_get_remap(struct device *dev)
> +{
> + return dev_get_regmap(dev, NULL);
> +}
This is (or should be) the default in the core.
> + if ((fs < rate_min) || (fs > rate_max)) {
> + dev_err(codec->dev,
> + "sample rate is %dHz, min rate is %dHz, max rate is %dHz\n",
> + fs, rate_min, rate_max);
This too, alignment after the (.
> + if (bits == 16)
> + dspr0_val = (PDMIC_DSPR0_SIZE_16_BITS
> + << PDMIC_DSPR0_SIZE_SHIFT);
> + else if (bits == 32)
> + dspr0_val = (PDMIC_DSPR0_SIZE_32_BITS
> + << PDMIC_DSPR0_SIZE_SHIFT);
> + else
> + return -EINVAL;
This looks like it should be a switch statement.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-12-16 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 8:15 [PATCH 0/2] ASoC: atmel-pdmic: add driver for Atmel PDMIC Songjun Wu
2015-12-14 8:15 ` [PATCH 1/2] ASoC: atmel-pdmic: add the Pulse Density Modulation Interface Controller Songjun Wu
2015-12-16 12:27 ` Mark Brown [this message]
2015-12-17 2:41 ` Wu, Songjun
2015-12-14 8:15 ` [PATCH 2/2] ASoC: atmel-pdmic: DT binding for PDMIC driver Songjun Wu
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=20151216122727.GI5727@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=perex@perex.cz \
--cc=songjun.wu@atmel.com \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®