Skip to content

Commit ec285cb

Browse files
drvgithubuserbroonie
authored andcommitted
ASoC: codecs: wcd934x: Use min macro for comparison and assignment
Simplify code by using min helper macro for logical evaluation and value assignment. The change also facilitates code realignment for improved readability. Proposed change is identified using minmax.cocci Coccinelle script. Signed-off-by: Deepak R Varma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1fd61d0 commit ec285cb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

sound/soc/codecs/wcd934x.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,13 +4737,9 @@ static u32 wcd934x_get_dmic_sample_rate(struct snd_soc_component *comp,
47374737
if (dec_found && adc_mux_index <= 8) {
47384738
tx_fs_reg = WCD934X_CDC_TX0_TX_PATH_CTL + (16 * adc_mux_index);
47394739
tx_stream_fs = snd_soc_component_read(comp, tx_fs_reg) & 0x0F;
4740-
if (tx_stream_fs <= 4) {
4741-
if (wcd->dmic_sample_rate <=
4742-
WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ)
4743-
dmic_fs = wcd->dmic_sample_rate;
4744-
else
4745-
dmic_fs = WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ;
4746-
} else
4740+
if (tx_stream_fs <= 4)
4741+
dmic_fs = min(wcd->dmic_sample_rate, WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ);
4742+
else
47474743
dmic_fs = WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ;
47484744
} else {
47494745
dmic_fs = wcd->dmic_sample_rate;

0 commit comments

Comments
 (0)