15 Sep
2014
15 Sep
'14
11:46 p.m.
On Mon, Sep 15, 2014 at 07:58:45PM +0800, Oder Chiou wrote:
- switch (offset) {
- case RT5677_GPIO1:
regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2,
RT5677_GPIO1_OUT_MASK, !!value << RT5677_GPIO1_OUT_SFT);
break;
All these functions could be cut down quite a bit - rather than having individual switch statements for every single operation for every single GPIO we can calculate the required shifts, we just need to look up the register to write into (or calculate it). This would be much nicer from a code point of view.