Hi KaiChieh, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [also build test WARNING on v4.16 next-20180413] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/KaiChieh-Chuang/ASoC-add-mt6351-codec-driver/20180414-110824 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-randconfig-x016-201815 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from include/linux/string.h:6:0, from include/linux/dma-mapping.h:6, from sound/soc/codecs/mt6351.c:12: sound/soc/codecs/mt6351.c: In function 'mt_hp_event': include/linux/compiler.h:58:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if' #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ^~~~~~~~~~ >> sound/soc/codecs/mt6351.c:912:8: note: in expansion of macro 'if' else if (priv->hp_en_counter < 0) ^~ sound/soc/codecs/mt6351.c:918:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' hp_zcd_disable(codec); ^~~~~~~~~~~~~~ In file included from include/linux/string.h:6:0, from include/linux/dma-mapping.h:6, from sound/soc/codecs/mt6351.c:12: include/linux/compiler.h:58:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if' #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ^~~~~~~~~~ sound/soc/codecs/mt6351.c:928:8: note: in expansion of macro 'if' else if (priv->hp_en_counter < 0) ^~ sound/soc/codecs/mt6351.c:933:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' snd_soc_update_bits(codec, ^~~~~~~~~~~~~~~~~~~ vim +/if +912 sound/soc/codecs/mt6351.c 834 835 static int mt_hp_event(struct snd_soc_dapm_widget *w, 836 struct snd_kcontrol *kcontrol, 837 int event) 838 { 839 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 840 struct mt6351_priv *priv = snd_soc_codec_get_drvdata(codec); 841 842 dev_dbg(priv->dev, "%s(), event 0x%x, hp_en_counter %d\n", 843 __func__, event, priv->hp_en_counter); 844 845 switch (event) { 846 case SND_SOC_DAPM_PRE_PMU: 847 priv->hp_en_counter++; 848 if (priv->hp_en_counter > 1) 849 break; /* already enabled, do nothing */ 850 else if (priv->hp_en_counter <= 0) 851 dev_err(priv->dev, "%s(), hp_en_counter %d <= 0\n", 852 __func__, 853 priv->hp_en_counter); 854 855 hp_zcd_disable(codec); 856 857 /* from yoyo HQA script */ 858 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON6, 859 0x0700, 0x0700); 860 /* Set HPR/HPL gain as minimum (~ -40dB) */ 861 snd_soc_update_bits(codec, MT6351_ZCD_CON2, 0xffff, 0x0F9F); 862 /* Set HS gain as minimum (~ -40dB) */ 863 snd_soc_update_bits(codec, MT6351_ZCD_CON3, 0xffff, 0x001F); 864 /* De_OSC of HP */ 865 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON2, 866 0x0001, 0x0001); 867 /* enable output STBENH */ 868 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON1, 869 0xffff, 0x2000); 870 /* De_OSC of voice, enable output STBENH */ 871 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON1, 872 0xffff, 0x2100); 873 /* Enable voice driver */ 874 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON0, 875 0x0010, 0xE090); 876 /* Enable pre-charge buffer */ 877 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON1, 878 0xffff, 0x2140); 879 880 usleep_range(50, 60); 881 882 /* Apply digital DC compensation value to DAC */ 883 set_hp_gain_zero(codec); 884 885 /* Enable HPR/HPL */ 886 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON1, 887 0xffff, 0x2100); 888 /* Disable pre-charge buffer */ 889 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON1, 890 0xffff, 0x2000); 891 /* Disable De_OSC of voice */ 892 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON0, 893 0x0010, 0xF4EF); 894 /* Disable voice buffer */ 895 896 /* from yoyo HQ */ 897 snd_soc_update_bits(codec, MT6351_AUDDEC_ANA_CON6, 898 0x0700, 0x0300); 899 900 /* Enable ZCD, for minimize pop noise */ 901 /* when adjust gain during HP buffer on */ 902 hp_zcd_enable(codec); 903 904 /* apply volume setting */ 905 hp_gain_ramp_set(codec, HP_GAIN_RESTORE); 906 907 break; 908 case SND_SOC_DAPM_PRE_PMD: 909 priv->hp_en_counter--; 910 if (priv->hp_en_counter > 0) 911 break; /* still being used, don't close */ > 912 else if (priv->hp_en_counter < 0) 913 dev_err(priv->dev, "%s(), hp_en_counter %d <= 0\n", 914 __func__, 915 priv->hp_en_counter); 916 917 /* Disable AUD_ZCD */ 918 hp_zcd_disable(codec); 919 920 /* Set HPR/HPL gain as -1dB, step by step */ 921 hp_gain_ramp_set(codec, HP_GAIN_SET_ZERO); 922 923 set_hp_gain_zero(codec); 924 break; 925 case SND_SOC_DAPM_POST_PMD: 926 if (priv->hp_en_counter > 0) 927 break; /* still being used, don't close */ 928 else if (priv->hp_en_counter < 0) 929 dev_err(priv->dev, "%s(), hp_en_counter %d <= 0\n", 930 __func__, 931 priv->hp_en_counter); 932 /* reset*/ 933 snd_soc_update_bits(codec, 934 MT6351_AUDDEC_ANA_CON6, 935 0x0700, 936 0x0000); 937 /* De_OSC of HP */ 938 snd_soc_update_bits(codec, 939 MT6351_AUDDEC_ANA_CON2, 940 0x0001, 941 0x0000); 942 break; 943 default: 944 break; 945 } 946 947 return 0; 948 } 949 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation