Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c6aba38 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soundwire: Avoid pm_runtime_suspended check condition"

parents ce29d1f7 7081f890
Loading
Loading
Loading
Loading
+10 −25
Original line number Diff line number Diff line
@@ -456,19 +456,14 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u32 reg_addr,
		u32 *buf, u32 len)
{
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(master);
	int ret = 0;

	if (!swrm) {
		dev_err(&master->dev, "%s: swrm is NULL\n", __func__);
		return -EINVAL;
	}

	if (pm_runtime_suspended(&swrm->pdev->dev)) {
		dev_dbg(swrm->dev, "%s: suspended state, enable pm_runtime\n",
			__func__);
	pm_runtime_get_sync(&swrm->pdev->dev);
		swrm->is_suspend = true;
	}

	if (dev_num) {
		swrm_cmd_fifo_rd_cmd(swrm, buf, dev_num, 0, reg_addr,
					len);
@@ -478,15 +473,13 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u32 reg_addr,
		else {
			dev_err(&master->dev, "%s: handle is NULL 0x%x\n",
				__func__, reg_addr);
			return -EINVAL;
			ret = -EINVAL;
		}
	}
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	if (swrm->is_suspend) {
	pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = false;
	}
	return 0;

	return ret;
}

static int swrm_write(struct swr_master *master, u8 dev_num, u32 reg_addr,
@@ -500,13 +493,7 @@ static int swrm_write(struct swr_master *master, u8 dev_num, u32 reg_addr,
		return -EINVAL;
	}

	if (pm_runtime_suspended(&swrm->pdev->dev)) {
		dev_dbg(swrm->dev, "%s: suspended state, enable pm_runtime\n",
			__func__);
	pm_runtime_get_sync(&swrm->pdev->dev);
		swrm->is_suspend = true;
	}

	if (dev_num) {
		ret = swrm_cmd_fifo_wr_cmd(swrm, buf[0], dev_num, 0, reg_addr);
	} else {
@@ -515,14 +502,12 @@ static int swrm_write(struct swr_master *master, u8 dev_num, u32 reg_addr,
		} else {
			dev_err(&master->dev, "%s: handle is NULL 0x%x\n",
				__func__, reg_addr);
			return -EINVAL;
			ret = -EINVAL;
		}
	}
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	if (swrm->is_suspend) {
	pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = false;
	}

	return ret;
}

+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ struct swr_mstr_ctrl {
	struct list_head mport_list;
	int state;
	struct platform_device *pdev;
	bool is_suspend;
};

#endif /* _SWR_WCD_CTRL_H */