From patchwork Tue Feb 19 15:19:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10820027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1ADA4180E for ; Tue, 19 Feb 2019 15:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0197A2C109 for ; Tue, 19 Feb 2019 15:20:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3FEE2C844; Tue, 19 Feb 2019 15:20:34 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 119B02C109 for ; Tue, 19 Feb 2019 15:20:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F3950265535; Tue, 19 Feb 2019 16:20:21 +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 9D9F3265535; Tue, 19 Feb 2019 16:20:19 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id EA68F265525 for ; Tue, 19 Feb 2019 16:20:15 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190219152012epoutp019d63d8fd48c21163512c9c38d6c72aba~EzQmiagLt0260402604epoutp01f; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190219152012epoutp019d63d8fd48c21163512c9c38d6c72aba~EzQmiagLt0260402604epoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550589613; bh=JHwTFh48S3B1ikB/OlwFRSfz4YrSAVRhOCixy70VD3o=; h=From:To:Cc:Subject:Date:References:From; b=bb7HqXatc3UauPYqZqIYhQIMjTJaZDE16BZHJDkl9sMtR5oKoZUMxl5z0qtnltLxI yaq+Y/nPDiDb2SIo9Wo4kyqsMK2NkI/uRPJdpNlDimNDsQrpG9erx4n5DIdCYkHicQ S5TPtRunzfvwDg1RAh9M4u1HGGkQ+1J3sckqGoOw= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190219152012epcas1p29632b37ef8d3f9b369a210af24322c64~EzQmHxTuy2097420974epcas1p2O; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 38.7B.04173.CAE1C6C5; Wed, 20 Feb 2019 00:20:12 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06~EzQlol-A20144401444epcas1p4_; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) X-AuditID: b6c32a36-5d9ff7000000104d-7f-5c6c1eacd5ad Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 07.72.04015.BAE1C6C5; Wed, 20 Feb 2019 00:20:11 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN600EUVIL44F30@mmp1.samsung.com>; Wed, 20 Feb 2019 00:20:11 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, lgirdwood@gmail.com Date: Tue, 19 Feb 2019 16:19:40 +0100 Message-id: <20190219151941.9795-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsWy7bCmge4auZwYg5bvchZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6Mhj8fmAo6RSou3zvL3sB4VaCLkZND QsBE4v/TeUwgtpDADkaJAz+tIezvjBLvtmjB1Hy70czWxcgFFN/NKPHr6Uwo5xejxNaD11lB qtgEDCV6j/YxgtgiAtoSc252gBUxC7xllJj3bBdQEQeHsECUxOflYDUsAqoSb3b8YgaxeQWs JB4cbmaB2CYvsXrDAWaQXgmBDjaJzz/Xs0EkXCS+tb5kA5kjISAtcemoLUS4WmLX9m6YekaJ lgvbmSES1hKHj18EO45ZgE/i3dceVoheXomONiGIEg+JE8++s0B8HCsxc8ETpgmM4gsYGVYx iqUWFOempxYbFhjpFSfmFpfmpesl5+duYgTHmZbZDsZF53wOMQpwMCrx8Gow5MQIsSaWFVfm HmKU4GBWEuE15AIK8aYkVlalFuXHF5XmpBYfYpTmYFES513v4BwjJJCeWJKanZpakFoEk2Xi 4JRqYKzy0BHwTwjuab3l/vloa+G0uYfr3179O/FPxccC64m6XJ4x90u7Fr11DnwR1Zer7nCc 4fMNLfnls7OCpzV0BJWsmXL17/5307wcglu+PDf4Karalrb/luTP92ktogZ/Jib47ufQU4lk nvM3PjZUKPmoXXLvmzf6L9OyKhI+KNe/ZJl0JsjCWomlOCPRUIu5qDgRAMIT88+vAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e+xgO5quZwYgxV/LS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZDX8+MBV0ilRcvneWvYHxqkAXIyeH hICJxLcbzWxdjFwcQgI7GSW+vTnABOH8YpRY//oeC0gVm4ChRO/RPkYQW0RAW2LOzQ6wDmaB t4wSDWfagBwODmGBKInPy8FqWARUJd7s+MUMYvMKWEk8ONzMArFNXmL1hgPMExi5FjAyrGKU TC0ozk3PLTYqMMxLLdcrTswtLs1L10vOz93ECAyabYe1+nYw3l8Sf4hRgINRiYdXgyEnRog1 say4MvcQowQHs5IIryEXUIg3JbGyKrUoP76oNCe1+BCjNAeLkjjv7bxjkUIC6YklqdmpqQWp RTBZJg5OqQZGkdxHX3bXLnpZymFfF/Au/4L5mRkTw/41m+0UrPHlPbrm53lu1Yvhghf5v2+3 KW6/5lj01vHIIZk3D91YDXveJFY3qe8p9DsdYXP/l8evWdKqiU4WUav3HXBiOfeueNHjTTEf Jzp2PTr951ABx7L/KfeOfrdx8xAy9t1wKtTyu+G3szdtMtyslFiKMxINtZiLihMBoTT+JRYC AAA= X-CMS-MailID: 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06 CMS-TYPE: 101P X-CMS-RootMailID: 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06 References: Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, linux-kernel@vger.kernel.org, krzk@kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: i2s: Fix secondary platform device unregistration 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 This fixes unregistration of the secondary platform device so all resources are properly released. Additionally the removal sequence is corrected so it is in reverse order comparing to probe sequence. The test against NULL priv->pdev_sec is removed as it is not necessary. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- Changes since v1: - corrected order of calls on error path in probe() and in remove(). sound/soc/samsung/i2s.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 02472f576e17..cd92bb6e1da1 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1359,11 +1359,10 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) static void i2s_delete_secondary_device(struct samsung_i2s_priv *priv) { - if (priv->pdev_sec) { - platform_device_del(priv->pdev_sec); - priv->pdev_sec = NULL; - } + platform_device_unregister(priv->pdev_sec); + priv->pdev_sec = NULL; } + static int samsung_i2s_probe(struct platform_device *pdev) { struct i2s_dai *pri_dai, *sec_dai = NULL; @@ -1487,14 +1486,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->filter, "tx-sec", NULL, &pdev->dev); if (ret < 0) - goto err_disable_clk; + goto err_del_sec; } if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { dev_err(&pdev->dev, "Unable to configure gpio\n"); ret = -EINVAL; - goto err_disable_clk; + goto err_del_sec; } dev_set_drvdata(&pdev->dev, priv); @@ -1503,7 +1502,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) &samsung_i2s_component, priv->dai_drv, num_dais); if (ret < 0) - goto err_disable_clk; + goto err_del_sec; pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -1518,9 +1517,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) err_disable_pm: pm_runtime_disable(&pdev->dev); +err_del_sec: + i2s_delete_secondary_device(priv); err_disable_clk: clk_disable_unprepare(priv->clk); - i2s_delete_secondary_device(priv); return ret; } @@ -1536,9 +1536,10 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); i2s_unregister_clock_provider(priv); + i2s_delete_secondary_device(priv); clk_disable_unprepare(priv->clk); + pm_runtime_put_noidle(&pdev->dev); - i2s_delete_secondary_device(priv); return 0; } From patchwork Tue Feb 19 15:19:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10820023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4190C180E for ; Tue, 19 Feb 2019 15:20:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 240A22C841 for ; Tue, 19 Feb 2019 15:20:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6542C82B; Tue, 19 Feb 2019 15:20:34 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 6B1762C118 for ; Tue, 19 Feb 2019 15:20:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0990326552B; Tue, 19 Feb 2019 16:20:25 +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 CB9F7265545; Tue, 19 Feb 2019 16:20:22 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id E352A265525 for ; Tue, 19 Feb 2019 16:20:19 +0100 (CET) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190219152017epoutp037072fa4e75f50134b43b1c58b50e338c~EzQqsVf1t0490104901epoutp03m; Tue, 19 Feb 2019 15:20:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190219152017epoutp037072fa4e75f50134b43b1c58b50e338c~EzQqsVf1t0490104901epoutp03m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550589617; bh=xp9L3ufdnEowWluWcgkirs8ZO6OE8MU+m18qEBoChe8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ufwIbo90bf2D6JNOf7RhlkKi7D2wvFHntCP1WgZ4pilmMEgxAWsaDXa2ez9K4K/20 k86B4Wj5AQdAr6Q49Ti/FozxLFuJykTy0fS5iHc0JPBjrsFHQcg9i2iHSAktOjd1TF dOHH3rXBYYXEzKz+AFXlPYQdHOIh0IA54sbzZaiI= Received: from epsmges2p2.samsung.com (unknown [182.195.42.70]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190219152016epcas2p372b68d63fdffbc1ce2ddaa21c7c099f9~EzQpnu8El2750027500epcas2p3P; Tue, 19 Feb 2019 15:20:16 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id A0.27.04136.0BE1C6C5; Wed, 20 Feb 2019 00:20:16 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190219152015epcas2p455d8fc3fa012de0f1e857b0b2c88f773~EzQpPQsrw2564125641epcas2p45; Tue, 19 Feb 2019 15:20:15 +0000 (GMT) X-AuditID: b6c32a46-2a7ff70000001028-ef-5c6c1eb05b66 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D0.71.03689.FAE1C6C5; Wed, 20 Feb 2019 00:20:15 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN600EUVIL44F30@mmp1.samsung.com>; Wed, 20 Feb 2019 00:20:15 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, lgirdwood@gmail.com Date: Tue, 19 Feb 2019 16:19:41 +0100 Message-id: <20190219151941.9795-2-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190219151941.9795-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRmVeSWpSXmKPExsWy7bCmqe4GuZwYg3/ruC2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZfS2nmAqmKFW0bDvI2MA4RaaLkZND QsBEovnYTKYuRi4OIYEdjBK3r69mg3C+M0qs/faMBaaq6ddpRojEbkaJKRu6WCGcX4wSJ58+ YwepYhMwlOg92scIYosIaEvMudkBNopZ4C2jxLxnu1hBEsICsRL9jy6ANbAIqEqs/zQBqIiD g1fASuLLKyuIbfISqzccYAaxOQWsJb5vaGEHmSMhsIRNYsXRiewQRS4S99Zsh7KlJZ6t2sgI YVdL7NrezQzR0MEo0XJhOzNEwlri8PGLYEcwC/BJdBz+yw6yWEKAV6KjTQiixEOic/JcaGD0 MUo86PjDNIFRYgEjwypGsdSC4tz01GKjAiO94sTc4tK8dL3k/NxNjOA41HLbwbjknM8hRgEO RiUeXg2GnBgh1sSy4srcQ4wSHMxKIryGXEAh3pTEyqrUovz4otKc1OJDjNIcLErivA+l50YL CaQnlqRmp6YWpBbBZJk4OKUaGLnDczWuKkyoW1Nk+LgsZ9/2CxlyCWvStzsF9mvfeHu5Jzuy +0B+NkN1XHOla8/yNfeYjqjlMF5zKLxZp72zQmK6zIyJPefj97+8yaK1/5P+DJ390pPuLH3z tWHJVaHtETe8CpZL1052lK98fnpGoEvJ2u3mNx7NKLmSG1ZlsHBz36Vn9xed91ViKc5INNRi LipOBAAbL5mhvwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNLMWRmVeSWpSXmKPExsVy+t9jAd31cjkxBh0zDCyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZfS2nmAqmKFW0bDvI2MA4RaaLkZND QsBEounXacYuRi4OIYGdjBJ/1n9nhXB+MUp87d3MClLFJmAo0Xu0jxHEFhHQlphzs4MNpIhZ 4C2jRMOZNjaQhLBArET/owvsIDaLgKrE+k8TgOIcHLwCVhJfXllBbJOXWL3hADOIzSlgLfF9 QwtYuRBQyd3TixgnMPIsYGRYxSiZWlCcm55bbFRglJdarlecmFtcmpeul5yfu4kRGGTbDmv1 72B8vCT+EKMAB6MSD68GQ06MEGtiWXFl7iFGCQ5mJRFeQy6gEG9KYmVValF+fFFpTmrxIUZp DhYlcV7+/GORQgLpiSWp2ampBalFMFkmDk6pBsaJM+4cdtvy6hxz4MvouHOnZr1fWnHt3ItS 04/nF7fefbqLLSyX47nw/rCHMzVPiYe53pzid8JY2n7Zq16Ogq0XZ3bO3L671N6ySGrGKb7W O6sK9L7qXHm5veVi74r1qRuqDx7pybh/JcKCzXnmh4RLZ1en39V7t4P1/vGqiZYZN8VdBFYt KuLSUGIpzkg01GIuKk4EAOmTowwuAgAA X-CMS-MailID: 20190219152015epcas2p455d8fc3fa012de0f1e857b0b2c88f773 CMS-TYPE: 102P X-CMS-RootMailID: 20190219152015epcas2p455d8fc3fa012de0f1e857b0b2c88f773 References: <20190219151941.9795-1-s.nawrocki@samsung.com> Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, linux-kernel@vger.kernel.org, krzk@kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH v2 2/2] ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization 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 On some SoCs (e.g. Exynos5433) there are multiple "IIS multi audio interfaces" and the driver will try to register there multiple times same platform device for the secondary FIFO, which of course fails miserably. To fix this we derive the secondary platform device name from the primary device name. The secondary device name will now be -sec instead of fixed "samsung-i2s-sec". The fixed platform_device_id table entry is removed as the secondary device name is now dynamic and device/driver matching is done through driver_override. Reported-by: Marek Szyprowski Suggested-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- Changes since v1: - fixed pdev->driver_override assignment, - ensure there is no need to release any resources claimed in i2s_create_secondary_device() function when that function fails. --- sound/soc/samsung/i2s.c | 50 +++++++++++++++++++++++++------------- sound/soc/samsung/odroid.c | 2 +- 2 files changed, 34 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index cd92bb6e1da1..4231001226f4 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1339,20 +1339,35 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) /* Create platform device for the secondary PCM */ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) { - struct platform_device *pdev; + struct platform_device *pdev_sec; + const char *devname; int ret; - pdev = platform_device_register_simple("samsung-i2s-sec", -1, NULL, 0); - if (!pdev) + devname = devm_kasprintf(&priv->pdev->dev, GFP_KERNEL, "%s-sec", + dev_name(&priv->pdev->dev)); + if (!devname) return -ENOMEM; - ret = device_attach(&pdev->dev); + pdev_sec = platform_device_alloc(devname, -1); + if (!pdev_sec) + return -ENOMEM; + + pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL); + + ret = platform_device_add(pdev_sec); if (ret < 0) { - dev_info(&pdev->dev, "device_attach() failed\n"); + platform_device_put(pdev_sec); return ret; } - priv->pdev_sec = pdev; + ret = device_attach(&pdev_sec->dev); + if (ret <= 0) { + platform_device_unregister(priv->pdev_sec); + dev_info(&pdev_sec->dev, "device_attach() failed\n"); + return ret; + } + + priv->pdev_sec = pdev_sec; return 0; } @@ -1367,22 +1382,25 @@ static int samsung_i2s_probe(struct platform_device *pdev) { struct i2s_dai *pri_dai, *sec_dai = NULL; struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data; - struct resource *res; u32 regs_base, idma_addr = 0; struct device_node *np = pdev->dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; - int num_dais, ret; + const struct platform_device_id *id; struct samsung_i2s_priv *priv; + struct resource *res; + int num_dais, ret; - if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) + if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { i2s_dai_data = of_device_get_match_data(&pdev->dev); - else - i2s_dai_data = (struct samsung_i2s_dai_data *) - platform_get_device_id(pdev)->driver_data; + } else { + id = platform_get_device_id(pdev); - /* Nothing to do if it is the secondary device probe */ - if (!i2s_dai_data) - return 0; + /* Nothing to do if it is the secondary device probe */ + if (!id) + return 0; + + i2s_dai_data = (struct samsung_i2s_dai_data *)id->driver_data; + } priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -1637,8 +1655,6 @@ static const struct platform_device_id samsung_i2s_driver_ids[] = { { .name = "samsung-i2s", .driver_data = (kernel_ulong_t)&i2sv3_dai_type, - }, { - .name = "samsung-i2s-sec", }, {}, }; diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c index 5b2bcd1d3450..bd2c5163dc7f 100644 --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -185,7 +185,7 @@ static struct snd_soc_dai_link odroid_card_dais[] = { .ops = &odroid_card_fe_ops, .name = "Secondary", .stream_name = "Secondary", - .platform_name = "samsung-i2s-sec", + .platform_name = "3830000.i2s-sec", .dynamic = 1, .dpcm_playback = 1, }