wlcore: debugfs: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
Using pm_runtime_resume_and_get is more appropriate for simplifing code Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220408081205.2494512-1-chi.minghao@zte.com.cn
This commit is contained in:
parent
b9eb5f0742
commit
b2268fd81c
@ -52,11 +52,9 @@ void wl1271_debugfs_update_stats(struct wl1271 *wl)
|
||||
if (unlikely(wl->state != WLCORE_STATE_ON))
|
||||
goto out;
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!wl->plt &&
|
||||
time_after(jiffies, wl->stats.fw_stats_update +
|
||||
@ -108,12 +106,9 @@ static void chip_op_handler(struct wl1271 *wl, unsigned long value,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
chip_op = arg;
|
||||
chip_op(wl);
|
||||
@ -279,11 +274,9 @@ static ssize_t dynamic_ps_timeout_write(struct file *file,
|
||||
if (unlikely(wl->state != WLCORE_STATE_ON))
|
||||
goto out;
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* In case we're already in PSM, trigger it again to set new timeout
|
||||
* immediately without waiting for re-association
|
||||
@ -349,11 +342,9 @@ static ssize_t forced_ps_write(struct file *file,
|
||||
if (unlikely(wl->state != WLCORE_STATE_ON))
|
||||
goto out;
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* In case we're already in PSM, trigger it again to switch mode
|
||||
* immediately without waiting for re-association
|
||||
@ -831,11 +822,9 @@ static ssize_t rx_streaming_interval_write(struct file *file,
|
||||
|
||||
wl->conf.rx_streaming.interval = value;
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
wl12xx_for_each_wlvif_sta(wl, wlvif) {
|
||||
wl1271_recalc_rx_streaming(wl, wlvif);
|
||||
@ -889,11 +878,9 @@ static ssize_t rx_streaming_always_write(struct file *file,
|
||||
|
||||
wl->conf.rx_streaming.always = value;
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
wl12xx_for_each_wlvif_sta(wl, wlvif) {
|
||||
wl1271_recalc_rx_streaming(wl, wlvif);
|
||||
@ -939,11 +926,9 @@ static ssize_t beacon_filtering_write(struct file *file,
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
wl12xx_for_each_wlvif(wl, wlvif) {
|
||||
ret = wl1271_acx_beacon_filter_opt(wl, wlvif, !!value);
|
||||
@ -1021,11 +1006,9 @@ static ssize_t sleep_auth_write(struct file *file,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = wl1271_acx_sleep_auth(wl, value);
|
||||
if (ret < 0)
|
||||
@ -1254,9 +1237,8 @@ static ssize_t fw_logger_write(struct file *file,
|
||||
}
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
ret = pm_runtime_get_sync(wl->dev);
|
||||
ret = pm_runtime_resume_and_get(wl->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(wl->dev);
|
||||
count = ret;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user