[v1,1/4] ALSA: hda - Simplify hdmi_present_sense_via_verbs()
diff mbox series

Message ID 20200204072017.9554-1-nmahale@nvidia.com
State New
Headers show
Series
  • [v1,1/4] ALSA: hda - Simplify hdmi_present_sense_via_verbs()
Related show

Commit Message

Nikhil Mahale Feb. 4, 2020, 7:20 a.m. UTC
The jack report block, was added by commit 464837a7bc0a ("ALSA: hda
- block HDMI jack reports while repolling"), to avoid race condition
with repolling.

Signed-off-by: Nikhil Mahale <nmahale@nvidia.com>
---
 sound/pci/hda/patch_hdmi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Takashi Iwai Feb. 4, 2020, 7:55 a.m. UTC | #1
On Tue, 04 Feb 2020 08:20:14 +0100,
Nikhil Mahale wrote:
> 
> The jack report block, was added by commit 464837a7bc0a ("ALSA: hda
> - block HDMI jack reports while repolling"), to avoid race condition
> with repolling.

This text doesn't explain what and why you're changing.
Describe that it's nothing but a cleanup, and no behavior change is
intended here.


thanks,

Takashi


> Signed-off-by: Nikhil Mahale <nmahale@nvidia.com>
> ---
>  sound/pci/hda/patch_hdmi.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 48bddc218829..ee084676f625 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1569,7 +1569,6 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>  	 * the unsolicited response to avoid custom WARs.
>  	 */
>  	int present;
> -	bool ret;
>  	bool do_repoll = false;
>  
>  	present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id);
> @@ -1603,16 +1602,15 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>  	else
>  		update_eld(codec, per_pin, eld);
>  
> -	ret = !repoll || !eld->monitor_present || eld->eld_valid;
> -
>  	jack = snd_hda_jack_tbl_get_mst(codec, pin_nid, per_pin->dev_id);
>  	if (jack) {
> -		jack->block_report = !ret;
> +		jack->block_report = do_repoll;
>  		jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?
>  			AC_PINSENSE_PRESENCE : 0;
>  	}
>  	mutex_unlock(&per_pin->lock);
> -	return ret;
> +
> +	return !do_repoll;
>  }
>  
>  static struct snd_jack *pin_idx_to_jack(struct hda_codec *codec,
> -- 
> 2.16.4
>

Patch
diff mbox series

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 48bddc218829..ee084676f625 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1569,7 +1569,6 @@  static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
 	 * the unsolicited response to avoid custom WARs.
 	 */
 	int present;
-	bool ret;
 	bool do_repoll = false;
 
 	present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id);
@@ -1603,16 +1602,15 @@  static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
 	else
 		update_eld(codec, per_pin, eld);
 
-	ret = !repoll || !eld->monitor_present || eld->eld_valid;
-
 	jack = snd_hda_jack_tbl_get_mst(codec, pin_nid, per_pin->dev_id);
 	if (jack) {
-		jack->block_report = !ret;
+		jack->block_report = do_repoll;
 		jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?
 			AC_PINSENSE_PRESENCE : 0;
 	}
 	mutex_unlock(&per_pin->lock);
-	return ret;
+
+	return !do_repoll;
 }
 
 static struct snd_jack *pin_idx_to_jack(struct hda_codec *codec,