Merge series "ASoC: realtek: fix cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Lots of trivial issues that make cppcheck too verbose. There shouldn't
be any functionality change with this patchset.

Pierre-Louis Bossart (24):
  ASoC: rt1011: use logical OR
  ASoC: rt1011: remove redundant test
  ASoC: rt1011: clarify expression
  ASoC: rt1015: clarify expression
  ASoC: rt1016: clarify expression
  ASoC: rt1305: clarify expression
  ASoC: rt1308: clarify expression
  ASoC: rt5640: clarify expression
  ASoC: rt5645: use logical OR
  ASoC: rt5645: clarify expression
  ASoC: rt5651: clarify expression
  ASoC: rt5651: remove useless assignment
  ASoC: rt5659: clarify expression
  ASoC: rt5660: clarify expression
  ASoC: rt5663: clarify expression
  ASoC: rt5665: clarify expression
  ASoC: rt5668: clarify expression
  ASoC: rt5668: remove useless assignments
  ASoC: rt5670: clarify expression
  ASoC: rt5677: clarify expression
  ASoC: rt5677: remove useless assignment
  ASoC: rt5682: clarify expression
  ASoC: rt5682: remove useless assignments
  ASoC: rt5682: remove useless initialization

 sound/soc/codecs/rt1011.c | 47 ++++++++++++++++++---------------------
 sound/soc/codecs/rt1015.c |  5 +++--
 sound/soc/codecs/rt1016.c |  7 +++---
 sound/soc/codecs/rt1305.c |  4 ++--
 sound/soc/codecs/rt1308.c |  8 +++----
 sound/soc/codecs/rt5640.c |  6 ++---
 sound/soc/codecs/rt5645.c |  6 ++---
 sound/soc/codecs/rt5651.c |  6 ++---
 sound/soc/codecs/rt5659.c |  4 ++--
 sound/soc/codecs/rt5660.c |  4 ++--
 sound/soc/codecs/rt5663.c |  4 ++--
 sound/soc/codecs/rt5665.c |  4 ++--
 sound/soc/codecs/rt5668.c |  8 +++----
 sound/soc/codecs/rt5670.c |  4 ++--
 sound/soc/codecs/rt5677.c |  6 ++---
 sound/soc/codecs/rt5682.c | 12 +++++-----
 16 files changed, 67 insertions(+), 68 deletions(-)

--
2.25.1
This commit is contained in:
Mark Brown 2021-03-04 00:52:05 +00:00
commit d639089a84
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
16 changed files with 67 additions and 68 deletions

View file

@ -1089,25 +1089,21 @@ static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol,
static bool rt1011_validate_bq_drc_coeff(unsigned short reg)
{
if ((reg == RT1011_DAC_SET_1) |
(reg >= RT1011_ADC_SET && reg <= RT1011_ADC_SET_1) |
(reg == RT1011_ADC_SET_4) | (reg == RT1011_ADC_SET_5) |
(reg == RT1011_MIXER_1) |
(reg == RT1011_A_TIMING_1) | (reg >= RT1011_POWER_7 &&
reg <= RT1011_POWER_8) |
(reg == RT1011_CLASS_D_POS) | (reg == RT1011_ANALOG_CTRL) |
(reg >= RT1011_SPK_TEMP_PROTECT_0 &&
reg <= RT1011_SPK_TEMP_PROTECT_6) |
(reg >= RT1011_SPK_PRO_DC_DET_5 && reg <= RT1011_BAT_GAIN_1) |
(reg >= RT1011_RT_DRC_CROSS && reg <= RT1011_RT_DRC_POS_8) |
(reg >= RT1011_CROSS_BQ_SET_1 && reg <= RT1011_BQ_10_A2_15_0) |
(reg >= RT1011_SMART_BOOST_TIMING_1 &&
reg <= RT1011_SMART_BOOST_TIMING_36) |
(reg == RT1011_SINE_GEN_REG_1) |
(reg >= RT1011_STP_ALPHA_RECIPROCAL_MSB &&
reg <= RT1011_BQ_6_PARAMS_CHECK_5) |
(reg >= RT1011_BQ_7_PARAMS_CHECK_1 &&
reg <= RT1011_BQ_10_PARAMS_CHECK_5))
if ((reg == RT1011_DAC_SET_1) ||
(reg >= RT1011_ADC_SET && reg <= RT1011_ADC_SET_1) ||
(reg == RT1011_ADC_SET_4) || (reg == RT1011_ADC_SET_5) ||
(reg == RT1011_MIXER_1) ||
(reg == RT1011_A_TIMING_1) ||
(reg >= RT1011_POWER_7 && reg <= RT1011_POWER_8) ||
(reg == RT1011_CLASS_D_POS) || (reg == RT1011_ANALOG_CTRL) ||
(reg >= RT1011_SPK_TEMP_PROTECT_0 && reg <= RT1011_SPK_TEMP_PROTECT_6) ||
(reg >= RT1011_SPK_PRO_DC_DET_5 && reg <= RT1011_BAT_GAIN_1) ||
(reg >= RT1011_RT_DRC_CROSS && reg <= RT1011_RT_DRC_POS_8) ||
(reg >= RT1011_CROSS_BQ_SET_1 && reg <= RT1011_BQ_10_A2_15_0) ||
(reg >= RT1011_SMART_BOOST_TIMING_1 && reg <= RT1011_SMART_BOOST_TIMING_36) ||
(reg == RT1011_SINE_GEN_REG_1) ||
(reg >= RT1011_STP_ALPHA_RECIPROCAL_MSB && reg <= RT1011_BQ_6_PARAMS_CHECK_5) ||
(reg >= RT1011_BQ_7_PARAMS_CHECK_1 && reg <= RT1011_BQ_10_PARAMS_CHECK_5))
return true;
return false;
@ -1782,8 +1778,9 @@ static int rt1011_set_component_pll(struct snd_soc_component *component,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1011_PLL_1,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT |
pll_code.m_bp << RT1011_PLL1_BPM_SFT | pll_code.n_code);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT) |
(pll_code.m_bp << RT1011_PLL1_BPM_SFT) |
pll_code.n_code);
snd_soc_component_write(component, RT1011_PLL_2,
pll_code.k_code);
@ -1991,10 +1988,10 @@ static int rt1011_set_tdm_slot(struct snd_soc_dai *dai,
RT1011_TDM_I2S_DOCK_EN_1_MASK, tdm_en);
snd_soc_component_update_bits(component, RT1011_TDM2_SET_2,
RT1011_TDM_I2S_DOCK_EN_2_MASK, tdm_en);
if (tx_slotnum)
snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET,
RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG,
RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT);
snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET,
RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG,
RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT);
_set_tdm_err_:
snd_soc_dapm_mutex_unlock(dapm);

View file

@ -893,8 +893,9 @@ static int rt1015_set_component_pll(struct snd_soc_component *component,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1015_PLL1,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT |
pll_code.m_bp << RT1015_PLL_M_BP_SFT | pll_code.n_code);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT) |
(pll_code.m_bp << RT1015_PLL_M_BP_SFT) |
pll_code.n_code);
snd_soc_component_write(component, RT1015_PLL2,
pll_code.k_code);

View file

@ -500,10 +500,11 @@ static int rt1016_set_component_pll(struct snd_soc_component *component,
(pll_code.k_bp ? 0 : pll_code.k_code));
snd_soc_component_write(component, RT1016_PLL1,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1016_PLL_M_SFT |
pll_code.m_bp << RT1016_PLL_M_BP_SFT | pll_code.n_code);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT1016_PLL_M_SFT) |
(pll_code.m_bp << RT1016_PLL_M_BP_SFT) |
pll_code.n_code);
snd_soc_component_write(component, RT1016_PLL2,
pll_code.k_bp << RT1016_PLL_K_BP_SFT |
(pll_code.k_bp << RT1016_PLL_K_BP_SFT) |
(pll_code.k_bp ? 0 : pll_code.k_code));
rt1016->pll_in = freq_in;

View file

@ -850,8 +850,8 @@ static int rt1305_set_component_pll(struct snd_soc_component *component,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1305_PLL1_1,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1305_PLL_1_M_SFT |
pll_code.m_bp << RT1305_PLL_1_M_BYPASS_SFT |
((pll_code.m_bp ? 0 : pll_code.m_code) << RT1305_PLL_1_M_SFT) |
(pll_code.m_bp << RT1305_PLL_1_M_BYPASS_SFT) |
pll_code.n_code);
snd_soc_component_write(component, RT1305_PLL1_2,
pll_code.k_code);

View file

@ -673,10 +673,10 @@ static int rt1308_set_component_pll(struct snd_soc_component *component,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1308_PLL_1,
pll_code.k_code << RT1308_PLL1_K_SFT |
pll_code.m_bp << RT1308_PLL1_M_BYPASS_SFT |
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1308_PLL1_M_SFT |
pll_code.n_code << RT1308_PLL1_N_SFT);
(pll_code.k_code << RT1308_PLL1_K_SFT) |
(pll_code.m_bp << RT1308_PLL1_M_BYPASS_SFT) |
((pll_code.m_bp ? 0 : pll_code.m_code) << RT1308_PLL1_M_SFT) |
(pll_code.n_code << RT1308_PLL1_N_SFT));
rt1308->pll_in = freq_in;
rt1308->pll_out = freq_out;

View file

@ -1918,10 +1918,10 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT5640_PLL_CTRL1,
pll_code.n_code << RT5640_PLL_N_SFT | pll_code.k_code);
(pll_code.n_code << RT5640_PLL_N_SFT) | pll_code.k_code);
snd_soc_component_write(component, RT5640_PLL_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT |
pll_code.m_bp << RT5640_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT) |
(pll_code.m_bp << RT5640_PLL_M_BP_SFT));
rt5640->pll_in = freq_in;
rt5640->pll_out = freq_out;

View file

@ -690,7 +690,7 @@ static int rt5645_hweq_get(struct snd_kcontrol *kcontrol,
static bool rt5645_validate_hweq(unsigned short reg)
{
if ((reg >= 0x1a4 && reg <= 0x1cd) | (reg >= 0x1e5 && reg <= 0x1f8) |
if ((reg >= 0x1a4 && reg <= 0x1cd) || (reg >= 0x1e5 && reg <= 0x1f8) ||
(reg == RT5645_EQ_CTRL2))
return true;
@ -2956,8 +2956,8 @@ static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
snd_soc_component_write(component, RT5645_PLL_CTRL1,
pll_code.n_code << RT5645_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5645_PLL_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT |
pll_code.m_bp << RT5645_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT) |
(pll_code.m_bp << RT5645_PLL_M_BP_SFT));
rt5645->pll_in = freq_in;
rt5645->pll_out = freq_out;

View file

@ -1498,8 +1498,8 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
snd_soc_component_write(component, RT5651_PLL_CTRL1,
pll_code.n_code << RT5651_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5651_PLL_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5651_PLL_M_SFT |
pll_code.m_bp << RT5651_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5651_PLL_M_SFT) |
(pll_code.m_bp << RT5651_PLL_M_BP_SFT));
rt5651->pll_in = freq_in;
rt5651->pll_out = freq_out;
@ -1783,7 +1783,7 @@ static void rt5651_jack_detect_work(struct work_struct *work)
struct rt5651_priv *rt5651 =
container_of(work, struct rt5651_priv, jack_detect_work);
struct snd_soc_component *component = rt5651->component;
int report = 0;
int report;
if (!rt5651_jack_inserted(component)) {
/* Jack removed, or spurious IRQ? */

View file

@ -3512,8 +3512,8 @@ static int rt5659_set_component_pll(struct snd_soc_component *component, int pll
snd_soc_component_write(component, RT5659_PLL_CTRL_1,
pll_code.n_code << RT5659_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5659_PLL_CTRL_2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT |
pll_code.m_bp << RT5659_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT) |
(pll_code.m_bp << RT5659_PLL_M_BP_SFT));
rt5659->pll_in = freq_in;
rt5659->pll_out = freq_out;

View file

@ -1057,8 +1057,8 @@ static int rt5660_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
snd_soc_component_write(component, RT5660_PLL_CTRL1,
pll_code.n_code << RT5660_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5660_PLL_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT |
pll_code.m_bp << RT5660_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT) |
(pll_code.m_bp << RT5660_PLL_M_BP_SFT));
rt5660->pll_in = freq_in;
rt5660->pll_out = freq_out;

View file

@ -2952,8 +2952,8 @@ static int rt5663_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
snd_soc_component_write(component, RT5663_PLL_1,
pll_code.n_code << RT5663_PLL_N_SHIFT | pll_code.k_code);
snd_soc_component_write(component, RT5663_PLL_2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT |
pll_code.m_bp << RT5663_PLL_M_BP_SHIFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT) |
(pll_code.m_bp << RT5663_PLL_M_BP_SHIFT));
rt5663->pll_in = freq_in;
rt5663->pll_out = freq_out;

View file

@ -4385,8 +4385,8 @@ static int rt5665_set_component_pll(struct snd_soc_component *component, int pll
snd_soc_component_write(component, RT5665_PLL_CTRL_1,
pll_code.n_code << RT5665_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5665_PLL_CTRL_2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5665_PLL_M_SFT |
pll_code.m_bp << RT5665_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5665_PLL_M_SFT) |
(pll_code.m_bp << RT5665_PLL_M_BP_SFT));
rt5665->pll_in = freq_in;
rt5665->pll_out = freq_out;

View file

@ -1171,7 +1171,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component);
int idx = -EINVAL;
int idx;
static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div));
@ -1188,7 +1188,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component);
int ref, val, reg, idx = -EINVAL;
int ref, val, reg, idx;
static const int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
val = snd_soc_component_read(component, RT5668_GPIO_CTRL_1) &
@ -2182,8 +2182,8 @@ static int rt5668_set_component_pll(struct snd_soc_component *component,
snd_soc_component_write(component, RT5668_PLL_CTRL_1,
pll_code.n_code << RT5668_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5668_PLL_CTRL_2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5668_PLL_M_SFT |
pll_code.m_bp << RT5668_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5668_PLL_M_SFT) |
(pll_code.m_bp << RT5668_PLL_M_BP_SFT));
rt5668->pll_in = freq_in;
rt5668->pll_out = freq_out;

View file

@ -2588,8 +2588,8 @@ static int rt5670_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
snd_soc_component_write(component, RT5670_PLL_CTRL1,
pll_code.n_code << RT5670_PLL_N_SFT | pll_code.k_code);
snd_soc_component_write(component, RT5670_PLL_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT |
pll_code.m_bp << RT5670_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT) |
(pll_code.m_bp << RT5670_PLL_M_BP_SFT));
rt5670->pll_in = freq_in;
rt5670->pll_out = freq_out;

View file

@ -4568,8 +4568,8 @@ static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
regmap_write(rt5677->regmap, RT5677_PLL1_CTRL1,
pll_code.n_code << RT5677_PLL_N_SFT | pll_code.k_code);
regmap_write(rt5677->regmap, RT5677_PLL1_CTRL2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT |
pll_code.m_bp << RT5677_PLL_M_BP_SFT);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT) |
(pll_code.m_bp << RT5677_PLL_M_BP_SFT));
rt5677->pll_in = freq_in;
rt5677->pll_out = freq_out;
@ -5332,7 +5332,7 @@ static bool rt5677_check_hotword(struct rt5677_priv *rt5677)
static irqreturn_t rt5677_irq(int unused, void *data)
{
struct rt5677_priv *rt5677 = data;
int ret = 0, loop, i, reg_irq, virq;
int ret, loop, i, reg_irq, virq;
bool irq_fired = false;
mutex_lock(&rt5677->irq_lock);

View file

@ -1225,7 +1225,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
int idx = -EINVAL, dmic_clk_rate = 3072000;
int idx, dmic_clk_rate = 3072000;
static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
if (rt5682->pdata.dmic_clk_rate)
@ -1245,7 +1245,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
int ref, val, reg, idx = -EINVAL;
int ref, val, reg, idx;
static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48};
@ -2396,10 +2396,10 @@ static int rt5682_set_component_pll(struct snd_soc_component *component,
pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT5682_PLL_CTRL_1,
pll_code.n_code << RT5682_PLL_N_SFT | pll_code.k_code);
(pll_code.n_code << RT5682_PLL_N_SFT) | pll_code.k_code);
snd_soc_component_write(component, RT5682_PLL_CTRL_2,
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT |
pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST);
((pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT) |
(pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST));
}
rt5682->pll_in[pll_id] = freq_in;
@ -2751,7 +2751,7 @@ static int rt5682_bclk_set_rate(struct clk_hw *hw, unsigned long rate,
container_of(hw, struct rt5682_priv,
dai_clks_hw[RT5682_DAI_BCLK_IDX]);
struct snd_soc_component *component = rt5682->component;
struct snd_soc_dai *dai = NULL;
struct snd_soc_dai *dai;
unsigned long factor;
if (!rt5682_clk_check(rt5682))