From patchwork Wed Feb 8 18:34:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104511 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2822273qgi; Wed, 8 Feb 2017 10:34:18 -0800 (PST) X-Received: by 10.223.171.12 with SMTP id q12mr19737189wrc.74.1486578858572; Wed, 08 Feb 2017 10:34:18 -0800 (PST) Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id b27si3376882wmi.98.2017.02.08.10.34.18; Wed, 08 Feb 2017 10:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2BDBA266B0A; Wed, 8 Feb 2017 19:34:17 +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 38DC6266B13; Wed, 8 Feb 2017 19:34:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 68B97266B0A for ; Wed, 8 Feb 2017 19:34:14 +0100 (CET) Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cbX47-0003tn-E6; Wed, 08 Feb 2017 18:34:05 +0000 Received: from broonie by debutante with local (Exim 4.88) (envelope-from ) id 1cbX44-0000gl-L0; Wed, 08 Feb 2017 18:34:00 +0000 From: Mark Brown To: Vincent Abriou In-Reply-To: <1486547221-32593-1-git-send-email-vincent.abriou@st.com> Message-Id: Date: Wed, 08 Feb 2017 18:34:00 +0000 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, Kuninori Morimoto , Arnaud Pouliquen , Takashi Iwai , Jyri Sarha , Liam Girdwood , Mark Brown , Philipp Zabel Subject: [alsa-devel] Applied "ASoC: hdmi-codec: remove HDMI device unregister" to the asoc tree 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 The patch ASoC: hdmi-codec: remove HDMI device unregister has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 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 >From 8480ac567959eecdc694cf4f9c02d6fa687384b6 Mon Sep 17 00:00:00 2001 From: Vincent Abriou Date: Wed, 8 Feb 2017 10:47:01 +0100 Subject: [PATCH] ASoC: hdmi-codec: remove HDMI device unregister While unregistering the hdmi-codec, the hdmi device list must be cleaned up. It avoid kernel page fault when registering again the hdmi-codec. Signed-off-by: Vincent Abriou Reviewed-by: Philipp Zabel Signed-off-by: Mark Brown --- sound/soc/codecs/hdmi-codec.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) -- 2.11.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index dc6715a804a1..8c5ae1fc23a9 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -32,6 +32,7 @@ struct hdmi_device { }; #define pos_to_hdmi_device(pos) container_of((pos), struct hdmi_device, list) LIST_HEAD(hdmi_device_list); +static DEFINE_MUTEX(hdmi_mutex); #define DAI_NAME_SIZE 16 @@ -794,6 +795,7 @@ static int hdmi_codec_probe(struct platform_device *pdev) return -ENOMEM; hd = NULL; + mutex_lock(&hdmi_mutex); list_for_each(pos, &hdmi_device_list) { struct hdmi_device *tmp = pos_to_hdmi_device(pos); @@ -805,13 +807,16 @@ static int hdmi_codec_probe(struct platform_device *pdev) if (!hd) { hd = devm_kzalloc(dev, sizeof(*hd), GFP_KERNEL); - if (!hd) + if (!hd) { + mutex_unlock(&hdmi_mutex); return -ENOMEM; + } hd->dev = dev->parent; list_add_tail(&hd->list, &hdmi_device_list); } + mutex_unlock(&hdmi_mutex); if (hd->cnt >= ARRAY_SIZE(hdmi_dai_name)) { dev_err(dev, "too many hdmi codec are deteced\n"); @@ -853,11 +858,25 @@ static int hdmi_codec_probe(struct platform_device *pdev) static int hdmi_codec_remove(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct list_head *pos; struct hdmi_codec_priv *hcp; - hcp = dev_get_drvdata(&pdev->dev); + mutex_lock(&hdmi_mutex); + list_for_each(pos, &hdmi_device_list) { + struct hdmi_device *tmp = pos_to_hdmi_device(pos); + + if (tmp->dev == dev->parent) { + list_del(pos); + break; + } + } + mutex_unlock(&hdmi_mutex); + + hcp = dev_get_drvdata(dev); kfree(hcp->chmap_info); - snd_soc_unregister_codec(&pdev->dev); + snd_soc_unregister_codec(dev); + return 0; }