[alsa-devel] [PATCH 2/3] asoc tlv320aic3x: add GPIO support

Daniel Mack daniel at caiaq.org
Fri Apr 25 14:59:51 CEST 2008


On Fri, Apr 25, 2008 at 11:25:38AM +0200, Takashi Iwai wrote:
> > +int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio)
> > +{
> > +	u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG;
> > +	u8 val, bit = gpio ? 2: 1;
> > +
> > +	aic3x_read(codec, reg, &val);
> > +	return !!(val & (1 << bit));
> 
> I prefer a form like
> 	return (val >> bit) & 1;
> 
> "!!" often makes hard to read.

Patch rebased to match with other changes introduced by the clocking
patch.

Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: alsa-tlv320aic33-gpio.diff
Type: text/x-diff
Size: 5478 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20080425/1b9c57c2/attachment.bin 


More information about the Alsa-devel mailing list