From patchwork Tue Mar 9 04:04:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1449537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DvhS13s6bz9sWc; Tue, 9 Mar 2021 15:04:49 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lJTbv-0005c5-K5; Tue, 09 Mar 2021 04:04:43 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lJTbr-0005bi-Sm for kernel-team@lists.ubuntu.com; Tue, 09 Mar 2021 04:04:39 +0000 Received: from 1-171-87-156.dynamic-ip.hinet.net ([1.171.87.156] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lJTbr-0001Ok-2J for kernel-team@lists.ubuntu.com; Tue, 09 Mar 2021 04:04:39 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4] ALSA: hda/hdmi: Reduce hda_jack_tbl lookup at unsol event handling Date: Tue, 9 Mar 2021 12:04:28 +0800 Message-Id: <20210309040431.822723-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210309040431.822723-1-kai.heng.feng@canonical.com> References: <20210309040431.822723-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Takashi Iwai BugLink: https://bugs.launchpad.net/bugs/1918228 Pass hda_jack_tbl object to hdmi_intrinsic_event() along with res from hdmi_unsol_event() so that we can reduce the lookup of the same hda_jack_tbl object again. Minor code refactoring. Reviewed-by: Kai Vehmanen Reviewed-by: Nikhil Mahale Link: https://lore.kernel.org/r/20200206162804.4734-2-tiwai@suse.de Signed-off-by: Takashi Iwai (cherry picked from commit 165c0946a863cdfd056e472d8a9673d7197ef066) Signed-off-by: Kai-Heng Feng --- sound/pci/hda/patch_hdmi.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 30b4251b850c4..3c08097c0365c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -801,21 +801,9 @@ static void jack_callback(struct hda_codec *codec, check_presence_and_report(codec, jack->nid, jack->dev_id); } -static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) +static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res, + struct hda_jack_tbl *jack) { - int tag = res >> AC_UNSOL_RES_TAG_SHIFT; - struct hda_jack_tbl *jack; - - if (codec->dp_mst) { - int dev_entry = - (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; - - jack = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry); - } else { - jack = snd_hda_jack_tbl_get_from_tag(codec, tag, 0); - } - if (!jack) - return; jack->jack_dirty = 1; codec_dbg(codec, @@ -873,7 +861,7 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) } if (subtag == 0) - hdmi_intrinsic_event(codec, res); + hdmi_intrinsic_event(codec, res, jack); else hdmi_non_intrinsic_event(codec, res); }