From patchwork Thu May 25 11:29:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 13255087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C226C77B7A for ; Thu, 25 May 2023 11:26:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 060C41E7; Thu, 25 May 2023 13:25:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 060C41E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685013974; bh=ZKoh5qkJk/W2To+PrhNjYMj3CZ4X2s8wgUNVQ+Car8s=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=AxP35Uqh6h3/56IR8LueNT5qcrSIxixWdWkYRQ1Z+PbwVbq+aOP4NQM/YP3tI18iU OlviDqYEKoRMV+0OlqRwtYnCidW2B7L/8L0AzEZ3U9b4Kpk2qgvcP+1n6KaErL5IFR 4w9NU4NTDQTqqr2dgbUJFCy1mscNCTzvAXQ46AAg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7D567F80425; Thu, 25 May 2023 13:25:23 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 34D9CF80249; Thu, 25 May 2023 13:25:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9A354F80249; Thu, 25 May 2023 13:25:17 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20603.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::603]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C8604F800DF for ; Thu, 25 May 2023 13:25:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C8604F800DF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=frC3SPyl ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZOiKk/649LXIRdS9EEHzpGbVmzZ6IMgIXLnEVPD9csMjqZqwC+V/TFKUJUEPQ4zsu9B5luqGJnydz8q+EFhHWeKcr4Sp4no2m3NvQRlC264F8HNL3t+ZnAxckG6Jr5M+aoIUG03gNBle5N5NC1jl+2Y6AOl+Ld59loopOvwQDQP6pMkhn6F/I/4qotiyYDX7ZiGyHRIiCXECdfe2p8RAbvTcT5z98jef78IfF+fob5SsHk9kqrADsn6ALqlN6M8X/JQ7gcXrxQC7EKKmwngJlBhiCQ6B4HjsG7GBFDdjYq+S7+P9w1XmRO4R45eowLRCGeyPJFKwckmP2kZqMcFJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sLsEbhoWS7fzniBAl/0fEaIPombo+keItzi4f2MVq6s=; b=QbkSQ4ivy7rkRLwbdOkLD+ZWzKWZ4ouqQkZtBltDEyW9UhGNi4mWjwKS0JXxocrx6pFCvu7R3eye93PdIAfMK/GREeidNZ+4KA+skogAxm5bQqval7uEOKIOiJ2y4O9RkGilXUz63T6rASPYJzjtri1z3M1Fwn18Og2i6gwVfuA3FvTUs7TLj1+jmI9nxM2XCF2bj3pY37KpnItKPl3XmWDWJ+oyUV9gS81Q6Tos+0by3EGRfYOZKfhaaj7ndx6BwktSVFALbMJeVYoWkRkDbeJuuYQrEuHfsjOb/+bYpggQmjuaNvY45gHs260JW0rDZmoVFLALotmKp3/1S+Mp4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sLsEbhoWS7fzniBAl/0fEaIPombo+keItzi4f2MVq6s=; b=frC3SPyleup2Xiiyf3nJaCNqdYsimgy8WNVdXKfIFPfkCAqWvR45K1kS44lplDF1T2gnsXfqFU07p82b99aWgJXXqWJcaVZKe9IVdsj78QYj+b6bFQSfvrWc27p3T9JFED3hCc0TfQWv23o3K/7aKbYUZnG7eiIAn+n0b1d5080= Received: from BLAPR03CA0051.namprd03.prod.outlook.com (2603:10b6:208:32d::26) by DS0PR12MB7972.namprd12.prod.outlook.com (2603:10b6:8:14f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16; Thu, 25 May 2023 11:25:03 +0000 Received: from BL02EPF000145BA.namprd05.prod.outlook.com (2603:10b6:208:32d:cafe::2f) by BLAPR03CA0051.outlook.office365.com (2603:10b6:208:32d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.18 via Frontend Transport; Thu, 25 May 2023 11:25:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL02EPF000145BA.mail.protection.outlook.com (10.167.241.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.7 via Frontend Transport; Thu, 25 May 2023 11:25:03 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 06:25:02 -0500 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 06:24:58 -0500 From: Vijendar Mukunda To: CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "open list" Subject: [PATCH] ASoC: amd: ps: fix for acp_lock access in pdm driver Date: Thu, 25 May 2023 16:59:55 +0530 Message-ID: <20230525113000.1290758-1-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000145BA:EE_|DS0PR12MB7972:EE_ X-MS-Office365-Filtering-Correlation-Id: a859d088-cf7b-46a6-38fe-08db5d12af1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lH8X/XDgMPJJrghL9J0IqW5g96PZujMjxtWTDWpJSkn4if6vjH09W61Di7DcKVYQbgBVJBQKfCkYZPtK957OaILyaC/gM4gQB4O9P2wIqG4QBBCgZzHj99kNVUFVWrjzdwhG0t2MygXKCnYJCVurx5A3uEy/F8O5rYgl3Qq1j2tg1ceDWfSpbK3g9D5k8Hv+c7X+cu8dF352GR6ttlo4a4TSjcWOPK1JeIZiggdmlkBZHPnNbWssX5KuhXDtMHM+8y2O5r8pjhzmHoSZ9t3kEIMMNh0kYnao+JwC2HFIKEMnHA/4TC3KLP6kERsKnIUW2Ij03ohqinD911yMg40epRLYp32GBd8gbbpMcdAgA8gQtn87BB4tiRUziGjmUMQGpD9lSr5ZxJXj0PumAlOb6EU/j5hxUyEUDc30kZ8hZRDf+yuJ5iBvEEr9fHDUR7WLMDozK+jWM9UonfWFVQlskXop7O7AXeLVzK8y7FLFqBIrZcsetgJjiaTwp9oLt1jmmUs2k5e7+be9lv4+UWe81QKmZJMXlTuBtfmwM/FtjN9LB2o5Ji8w7F13hFX2VdK184YSxw0buI12dzFQnoGxkPmwlBVsgNZlv0aH9PeKdP6JJELIgT/4d8z5pt8eb/5ZU4hIC3cJy6wLfqUKL3dtWN8B2xEcAKvg9QaZ95lyLHOLanKin7I5YRHuSS5TNJ5uunEzDwvYUc8wPAzLT3BiTgyq5EDzb/2OXJc9bf3K1XJSwzPfwRBipa+fHbgtr3mBGb83AYFJWUxfxuyAQg+C6w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(6666004)(7696005)(40460700003)(41300700001)(26005)(1076003)(8676002)(8936002)(5660300002)(36756003)(36860700001)(2616005)(47076005)(82310400005)(83380400001)(2906002)(426003)(336012)(186003)(86362001)(356005)(81166007)(40480700001)(82740400003)(6916009)(4326008)(70586007)(70206006)(54906003)(478600001)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 11:25:03.1245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a859d088-cf7b-46a6-38fe-08db5d12af1c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000145BA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7972 Message-ID-Hash: FRQZ2EDGVWRP4HXRK2KN3M352WH3ITTH X-Message-ID-Hash: FRQZ2EDGVWRP4HXRK2KN3M352WH3ITTH X-MailFrom: Vijendar.Mukunda@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Sending the mutex address(acp_lock) as platform data during ACP PDM platform driver register sequence, its creating copy of the platform data. Referencing this platform data in ACP PDM driver results incorrect reference to the common lock usage. Instead of directly passing the lock address as platform data, retrieve it from parent driver data structure and use the same lock reference in ACP PDM driver. Fixes: 45aa83cb9388 ("ASoC: amd: ps: use acp_lock to protect common registers in pdm driver") Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/pci-ps.c | 3 +-- sound/soc/amd/ps/ps-pdm-dma.c | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index c957718abefc..54752d6040d6 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -198,8 +198,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data case ACP63_PDM_DEV_MASK: adata->pdm_dev_index = 0; acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma", - 0, adata->res, 1, &adata->acp_lock, - sizeof(adata->acp_lock)); + 0, adata->res, 1, NULL, 0); acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec", 0, NULL, 0, NULL, 0); acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach", diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c index 3ecc6cf3fd34..bdbbb797c74d 100644 --- a/sound/soc/amd/ps/ps-pdm-dma.c +++ b/sound/soc/amd/ps/ps-pdm-dma.c @@ -358,12 +358,12 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev) { struct resource *res; struct pdm_dev_data *adata; + struct acp63_dev_data *acp_data; + struct device *parent; int status; - if (!pdev->dev.platform_data) { - dev_err(&pdev->dev, "platform_data not retrieved\n"); - return -ENODEV; - } + parent = pdev->dev.parent; + acp_data = dev_get_drvdata(parent); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); @@ -379,7 +379,7 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev) return -ENOMEM; adata->capture_stream = NULL; - adata->acp_lock = pdev->dev.platform_data; + adata->acp_lock = &acp_data->acp_lock; dev_set_drvdata(&pdev->dev, adata); status = devm_snd_soc_register_component(&pdev->dev, &acp63_pdm_component,