From patchwork Thu Feb 2 17:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 9552561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2DB01602F0 for ; Thu, 2 Feb 2017 17:09:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22D551FFC9 for ; Thu, 2 Feb 2017 17:09:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17C912849C; Thu, 2 Feb 2017 17:09:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D5DB1FFC9 for ; Thu, 2 Feb 2017 17:09:05 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3DFF1267634; Thu, 2 Feb 2017 18:03:43 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7218D2675E6; Thu, 2 Feb 2017 18:03:29 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 25B2026757D for ; Thu, 2 Feb 2017 18:03:16 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E4889ADAE; Thu, 2 Feb 2017 17:03:13 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Thu, 2 Feb 2017 18:02:29 +0100 Message-Id: <20170202170307.24484-17-tiwai@suse.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202170307.24484-1-tiwai@suse.de> References: <20170202170307.24484-1-tiwai@suse.de> Cc: Pierre-Louis Bossart , Jerome Anand Subject: [alsa-devel] [PATCH 15/53] ALSA: x86: Drop global ELD copy X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Similarly like the previous patch, drop the global variable to keep the ELD copy. It can be embedded in hdmi_lpe_audio_ctx as well. And this makes easier to code, it's just a memcpy(), after all. Signed-off-by: Takashi Iwai --- sound/x86/intel_hdmi_lpe_audio.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/sound/x86/intel_hdmi_lpe_audio.c b/sound/x86/intel_hdmi_lpe_audio.c index 775a8b947213..53864d372861 100644 --- a/sound/x86/intel_hdmi_lpe_audio.c +++ b/sound/x86/intel_hdmi_lpe_audio.c @@ -36,9 +36,6 @@ #include "intel_hdmi_lpe_audio.h" #include "intel_hdmi_audio.h" -/* globals*/ -static union otm_hdmi_eld_t hlpe_eld; - struct hdmi_lpe_audio_ctx { struct platform_device *pdev; int irq; @@ -51,29 +48,9 @@ struct hdmi_lpe_audio_ctx { int hdmi_audio_interrupt_mask; struct work_struct hdmi_audio_wq; int state; /* connection state */ + union otm_hdmi_eld_t eld; /* ELD copy */ }; -static void hdmi_set_eld(void *eld) -{ - int size; - - BUILD_BUG_ON(sizeof(hlpe_eld) > HDMI_MAX_ELD_BYTES); - - size = sizeof(hlpe_eld); - memcpy((void *)&hlpe_eld, eld, size); -} - -static int hdmi_get_eld(void *eld) -{ - u8 *eld_data = (u8 *)&hlpe_eld; - - memcpy(eld, (void *)&hlpe_eld, sizeof(hlpe_eld)); - - print_hex_dump_bytes("eld: ", DUMP_PREFIX_NONE, eld_data, - sizeof(hlpe_eld)); - return 0; -} - static void mid_hdmi_audio_signal_event(struct platform_device *pdev, enum had_event_type event) { @@ -159,7 +136,9 @@ int mid_hdmi_audio_get_caps(struct platform_device *pdev, switch (get_element) { case HAD_GET_ELD: - ret = hdmi_get_eld(capabilities); + memcpy(capabilities, &ctx->eld, sizeof(ctx->eld)); + print_hex_dump_bytes("eld: ", DUMP_PREFIX_NONE, + (u8 *)&ctx->eld, sizeof(ctx->eld)); break; case HAD_GET_DISPLAY_RATE: /* ToDo: Verify if sampling freq logic is correct */ @@ -292,7 +271,7 @@ static void notify_audio_lpe(struct platform_device *pdev) break; } - hdmi_set_eld(eld->eld_data); + memcpy(&ctx->eld, eld->eld_data, sizeof(ctx->eld)); mid_hdmi_audio_signal_event(pdev, HAD_EVENT_HOT_PLUG);