linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: MBHC: Remove useless condition check
@ 2021-11-18 11:20 Srinivasa Rao Mandadapu
  2021-11-18 19:06 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-11-18 11:20 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Srinivasa Rao Mandadapu, Venkata Prasad Potturu

Remove redundant conditional check and clean code in special
headset support functions.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
---
 sound/soc/codecs/wcd-mbhc-v2.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
index d6545e4..99586ce 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -1055,12 +1055,8 @@ static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
 	hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
 	hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
 
-	if (output_mv > hs_threshold || output_mv < hph_threshold) {
-		if (mbhc->force_linein == true)
-			is_spl_hs = false;
-	} else {
+	if (!(output_mv > hs_threshold || output_mv < hph_threshold))
 		is_spl_hs = true;
-	}
 
 	/* Back MIC_BIAS2 to 1.8v if the type is not special headset */
 	if (!is_spl_hs) {
@@ -1149,13 +1145,13 @@ static void wcd_correct_swch_plug(struct work_struct *work)
 		plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
 		is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
 
-		if ((output_mv > hs_threshold) && (!is_spl_hs)) {
+		if (output_mv > hs_threshold && !is_spl_hs) {
 			is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
 			output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
 
 			if (is_spl_hs) {
-				hs_threshold = (hs_threshold * wcd_mbhc_get_micbias(mbhc)) /
-									micbias_mv;
+				hs_threshold *= wcd_mbhc_get_micbias(mbhc);
+				hs_threshold /= micbias_mv;
 			}
 		}
 
@@ -1185,7 +1181,7 @@ static void wcd_correct_swch_plug(struct work_struct *work)
 		}
 
 		/* cable is extension cable */
-		if (output_mv > hs_threshold || mbhc->force_linein == true)
+		if (output_mv > hs_threshold || mbhc->force_linein)
 			plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
 	}
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: codecs: MBHC: Remove useless condition check
  2021-11-18 11:20 [PATCH] ASoC: codecs: MBHC: Remove useless condition check Srinivasa Rao Mandadapu
@ 2021-11-18 19:06 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-11-18 19:06 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, lgirdwood, linux-arm-msm, rohitkr,
	alsa-devel, perex, agross, srinivas.kandagatla, swboyd, plai,
	judyhsiao, robh+dt, bgoswami, bjorn.andersson, tiwai,
	linux-kernel, devicetree
  Cc: Venkata Prasad Potturu

On Thu, 18 Nov 2021 16:50:11 +0530, Srinivasa Rao Mandadapu wrote:
> Remove redundant conditional check and clean code in special
> headset support functions.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: MBHC: Remove useless condition check
      commit: b38892b5b85ae54b7b867313996f967122ede42e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 11:20 [PATCH] ASoC: codecs: MBHC: Remove useless condition check Srinivasa Rao Mandadapu
2021-11-18 19:06 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).