Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755154AbbLQCl1 (ORCPT ); Wed, 16 Dec 2015 21:41:27 -0500 Received: from nasmtp01.atmel.com ([192.199.1.246]:41523 "EHLO DVREDG02.corp.atmel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750993AbbLQClZ (ORCPT ); Wed, 16 Dec 2015 21:41:25 -0500 Subject: Re: [PATCH 1/2] ASoC: atmel-pdmic: add the Pulse Density Modulation Interface Controller To: Mark Brown References: <1450080940-4123-1-git-send-email-songjun.wu@atmel.com> <1450080940-4123-2-git-send-email-songjun.wu@atmel.com> <20151216122727.GI5727@sirena.org.uk> CC: , , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , , From: "Wu, Songjun" Organization: ATMEL Message-ID: <567220CD.2060706@atmel.com> Date: Thu, 17 Dec 2015 10:41:17 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151216122727.GI5727@sirena.org.uk> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2068 Lines: 64 On 12/16/2015 20:27, Mark Brown wrote: > 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? > Accept. >> + 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. > You are right. The core has initialized the regmap in function snd_soc_component_add_unlocked. This function can be removed. Thank you. >> + 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 (. > Accept. >> + 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. > Accept. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/