24 Sep
2016
24 Sep
'16
9:07 p.m.
On Thu, Sep 08, 2016 at 07:29:29PM +0300, Alexander Shiyan wrote:
- switch (format & SND_SOC_DAIFMT_INV_MASK) {
- case SND_SOC_DAIFMT_NB_NF:
break;
- default:
goto fmt_err;
- }
Why the goto? Just put the error handling code in here directly.
- switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
- case SND_SOC_DAIFMT_I2S:
- case SND_SOC_DAIFMT_LEFT_J:
- case SND_SOC_DAIFMT_RIGHT_J:
cs4341->fmt = format & SND_SOC_DAIFMT_FORMAT_MASK;
return 0;
- default:
break;
We silently ignore invalid formats here...
- SOC_SINGLE("Popguard Transient Control", CS4341_REG_MODE2, 1, 1, 0),
Popguard Transient Switch so that userspace tools know how to handle this.
- spi->bits_per_word = spi->bits_per_word ? : 8;
- spi->max_speed_hz = spi->max_speed_hz ? : 6000000;
Please write normal if statements, it's easier to read..