lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110516212533.GA2570@sirena.org.uk>
Date:	Mon, 16 May 2011 22:25:34 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Dmitry Artamonow <mad_soft@...ox.ru>
Cc:	Liam Girdwood <lrg@...mlogic.co.uk>, alsa-devel@...a-project.org,
	Eric Miao <eric.y.miao@...il.com>,
	linux-kernel@...r.kernel.org, Harald Welte <laforge@...monks.org>,
	Philipp Zabel <philipp.zabel@...il.com>,
	Paul Parsons <lost.distance@...oo.com>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [alsa-devel] [PATCH v2 1/3] ASoC: Asahi Kasei AK4641 codec
	driver

On Tue, May 17, 2011 at 01:03:23AM +0400, Dmitry Artamonow wrote:
> A driver for the AK4641 codec used in iPAQ hx4700 and Glofiish M800
> among others.

This looks pretty good - a few small issues realting to the use of old
APIs and coding standards below but nothing serious.

> +static int ak4641_sync(struct snd_soc_codec *codec)
> +{
> +	u8 *cache = codec->reg_cache;
> +	int i, r = 0;
> +
> +	for (i = 0; i < AK4641_CACHEREGNUM; i++)
> +		r |= snd_soc_write(codec, i, cache[i]);
> +
> +	return r;
> +};

You should be able to use snd_soc_cache_sync() instead of open coding
this.  There's also a stray ; in there.

> +
> +static int ak4641_add_widgets(struct snd_soc_codec *codec)
> +{
> +	struct snd_soc_dapm_context *dapm = &codec->dapm;
> +	snd_soc_dapm_new_controls(dapm, ak4641_dapm_widgets,
> +				  ARRAY_SIZE(ak4641_dapm_widgets));
> +
> +	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
> +
> +	snd_soc_dapm_new_widgets(dapm);
> +	return 0;

You should be able to convert these to data based init using the
dapm_widgets and dapm_routes fields in the CODEC driver.

> +	u8 mode2 = snd_soc_read(codec, AK4641_MODE2) & ~(0x3 << 5);

Use snd_soc_update_bits() to do a read/modify/write cycle rather than
open coding it - it's clearer and will save writing when there's no
change.  A similar thing applies in several of the other DAI operations
and set_bias_level().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ