On Friday, May 13, 2011, jinyoungp@nvidia.com wrote:
Peter, How do you think about that?
On Friday, May 13, 2011, Jassi Brar wrote:
+static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, +int mute) {
- struct snd_soc_codec *codec = codec_dai->codec;
- int reg;
- if (mute)
- reg = M98088_DAI_MUTE;
- else
- reg = 0;
- snd_soc_update_bits(codec, M98088_REG_2F_LVL_DAI1_PLAY,
- M98088_DAI_MUTE_MASK, reg);
- return 0;
+}
max98088_dai1_digital_mute max98088_dai2_digital_mute max98088_dai1_set_fmt max98088_dai2_set_fmt max98088_dai1_hw_params max98088_dai2_hw_params
These pairs are essentially same function operating on different registers. Can't we compress them ?
Hi Jinyoung,
Thank you for looking at this.
The digital mute function is relatively small. It is ok as separate functions.
regval = mute ? M98088_DAI_MUTE : 0;
For hw_params, I had wanted to combine them too initially. However, there are quite a few different registers in there. For only 2 instantiations, the extra conditional code to enable combining them will somewhat diminish the benefit. I am leaning toward keeping them the way they are. But it's ok with me if you think of a good way to do it. The set_fmt is a possibility.
Peter