Commit b6b5c642 authored by Vijendar Mukunda's avatar Vijendar Mukunda Committed by Mark Brown

ASoC: amd: ps: fix for acp_lock access in pdm driver

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: 45aa83cb ("ASoC: amd: ps: use acp_lock to protect common registers in pdm driver")
Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230525113000.1290758-1-Vijendar.Mukunda@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8938f75a
...@@ -211,8 +211,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data ...@@ -211,8 +211,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
case ACP63_PDM_DEV_MASK: case ACP63_PDM_DEV_MASK:
adata->pdm_dev_index = 0; adata->pdm_dev_index = 0;
acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma", acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma",
0, adata->res, 1, &adata->acp_lock, 0, adata->res, 1, NULL, 0);
sizeof(adata->acp_lock));
acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec", acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec",
0, NULL, 0, NULL, 0); 0, NULL, 0, NULL, 0);
acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach", acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach",
......
...@@ -361,12 +361,12 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev) ...@@ -361,12 +361,12 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct pdm_dev_data *adata; struct pdm_dev_data *adata;
struct acp63_dev_data *acp_data;
struct device *parent;
int status; int status;
if (!pdev->dev.platform_data) { parent = pdev->dev.parent;
dev_err(&pdev->dev, "platform_data not retrieved\n"); acp_data = dev_get_drvdata(parent);
return -ENODEV;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res) {
dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
...@@ -382,7 +382,7 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev) ...@@ -382,7 +382,7 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
adata->capture_stream = NULL; adata->capture_stream = NULL;
adata->acp_lock = pdev->dev.platform_data; adata->acp_lock = &acp_data->acp_lock;
dev_set_drvdata(&pdev->dev, adata); dev_set_drvdata(&pdev->dev, adata);
status = devm_snd_soc_register_component(&pdev->dev, status = devm_snd_soc_register_component(&pdev->dev,
&acp63_pdm_component, &acp63_pdm_component,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment