Merge "soc: swr-mstr: Avoid race condition during device up"

This commit is contained in:
Linux Build Service Account
2018-10-26 02:05:44 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -1191,6 +1191,7 @@ static int swrm_disconnect_port(struct swr_master *master,
if (!port_req) {
dev_err(&master->dev, "%s:port not enabled : port %d\n",
__func__, portinfo->port_id[i]);
mutex_unlock(&swrm->mlock);
return -EINVAL;
}
port_req->req_ch &= ~portinfo->ch_en[i];
@@ -2108,15 +2109,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
case SWR_DEVICE_UP:
dev_dbg(swrm->dev, "%s: swr master up called\n", __func__);
mutex_lock(&swrm->mlock);
mutex_lock(&swrm->reslock);
if (swrm->state == SWR_MSTR_UP) {
dev_dbg(swrm->dev, "%s: SWR master is already UP: %d\n",
__func__, swrm->state);
list_for_each_entry(swr_dev, &mstr->devices, dev_list)
swr_reset_device(swr_dev);
} else {
pm_runtime_mark_last_busy(&pdev->dev);
mutex_unlock(&swrm->reslock);
pm_runtime_get_sync(&pdev->dev);
mutex_lock(&swrm->reslock);
list_for_each_entry(swr_dev, &mstr->devices, dev_list) {
@@ -2130,7 +2123,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
}
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_put_autosuspend(&pdev->dev);
}
mutex_unlock(&swrm->reslock);
mutex_unlock(&swrm->mlock);
break;