[alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.
Jean-Francois Moine
moinejf at free.fr
Tue Sep 2 13:09:12 CEST 2014
On Tue, 02 Sep 2014 16:12:40 +0530
Varka Bhadram <varkabhadram at gmail.com> wrote:
> >>> + switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
> >>> + case 0x11:
> >>> + return SND_SOC_DAIFMT_CBS_CFS;
> >>> + case 0x10:
> >>> + return SND_SOC_DAIFMT_CBS_CFM;
> >>> + case 0x01:
> >>> + return SND_SOC_DAIFMT_CBM_CFS;
> >>> + default:
> >>> + return SND_SOC_DAIFMT_CBM_CFM;
> >>> + }
> >>> +
> >>> + /* Shouldn't be here */
> >>> + return -EINVAL;
> >>> +}
> >> It will be nice if we declare the switch case numbers as macros (specific name)...
> > I don't see which macros: the values are just 2 booleans.
> >
> I am talking about 0x11, 0x10, 0x01 values.. We can give any understandable
> names to those...?
#define TRUE_TRUE 0x11
#define TRUE_FALSE 0x10
#define FALSE_TRUE 0x01
or
case ((TRUE << 4) | TRUE:
...
case ((TRUE << 4) | FALSE:
...
case ((FALSE << 4) | TRUE:
...
??
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
More information about the Alsa-devel
mailing list