asoc: lpass-cdc: return error when requesting incorrect state
Thermal framework is expected an error to be returned if the requested cur_state exceed the max_state. Change-Id: I1e0d8124a1aa6c0d755b35225207638aefdcb464 Signed-off-by: Junkai Cai <junkai@codeaurora.org>
这个提交包含在:

提交者
Gerrit - the friendly Code Review server

父节点
fa58ae98f9
当前提交
63db490176
@@ -2846,19 +2846,23 @@ static int lpass_cdc_wsa_macro_set_cur_state(
|
|||||||
{
|
{
|
||||||
struct lpass_cdc_wsa_macro_priv *wsa_priv = cdev->devdata;
|
struct lpass_cdc_wsa_macro_priv *wsa_priv = cdev->devdata;
|
||||||
|
|
||||||
if (!wsa_priv) {
|
if (!wsa_priv || !wsa_priv->dev) {
|
||||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state < wsa_priv->thermal_max_state)
|
if (state <= wsa_priv->thermal_max_state) {
|
||||||
wsa_priv->thermal_cur_state = state;
|
wsa_priv->thermal_cur_state = state;
|
||||||
else
|
} else {
|
||||||
wsa_priv->thermal_cur_state = wsa_priv->thermal_max_state;
|
dev_err(wsa_priv->dev,
|
||||||
|
"%s: incorrect requested state:%d\n",
|
||||||
|
__func__, state);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
dev_dbg(wsa_priv->dev,
|
dev_dbg(wsa_priv->dev,
|
||||||
"%s: requested state:%d, actual state: %d\n",
|
"%s: set the thermal current state to %d\n",
|
||||||
__func__, state, wsa_priv->thermal_cur_state);
|
__func__, wsa_priv->thermal_cur_state);
|
||||||
|
|
||||||
schedule_work(&wsa_priv->lpass_cdc_wsa_macro_cooling_work);
|
schedule_work(&wsa_priv->lpass_cdc_wsa_macro_cooling_work);
|
||||||
|
|
||||||
|
@@ -2844,19 +2844,23 @@ static int lpass_cdc_wsa2_macro_set_cur_state(
|
|||||||
{
|
{
|
||||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
||||||
|
|
||||||
if (!wsa2_priv) {
|
if (!wsa2_priv || !wsa2_priv->dev) {
|
||||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state < wsa2_priv->thermal_max_state)
|
if (state <= wsa2_priv->thermal_max_state) {
|
||||||
wsa2_priv->thermal_cur_state = state;
|
wsa2_priv->thermal_cur_state = state;
|
||||||
else
|
} else {
|
||||||
wsa2_priv->thermal_cur_state = wsa2_priv->thermal_max_state;
|
dev_err(wsa2_priv->dev,
|
||||||
|
"%s: incorrect requested state:%d\n",
|
||||||
|
__func__, state);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
dev_dbg(wsa2_priv->dev,
|
dev_dbg(wsa2_priv->dev,
|
||||||
"%s: requested state:%d, actual state: %d\n",
|
"%s: set the thermal current state to %d\n",
|
||||||
__func__, state, wsa2_priv->thermal_cur_state);
|
__func__, wsa2_priv->thermal_cur_state);
|
||||||
|
|
||||||
schedule_work(&wsa2_priv->lpass_cdc_wsa2_macro_cooling_work);
|
schedule_work(&wsa2_priv->lpass_cdc_wsa2_macro_cooling_work);
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户