drivers: thermal: Handle min state clear condition properly
Currently thermal framework passes min_state value as ULONG_MAX to clear the vote. But the min_state callback API for few cooling device drivers are checking whether requested state is within cooling device max limit or not. If it is not within max limit, it returns error. It leads to a case where framework clears the request, but cooling device is still holding previous request. If min_state request is greater than max_state, cap the min_state request to max state and apply max state vote for cooling device. Change-Id: I69d8f1af704532b6a223c34ad825d231e50b8ca3 Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
This commit is contained in:
parent
39cb43efbc
commit
9a6dc22214
3 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s:%s " fmt, KBUILD_MODNAME, __func__
|
||||
|
@ -291,7 +291,7 @@ static int qmi_set_min_state(struct thermal_cooling_device *cdev,
|
|||
return 0;
|
||||
|
||||
if (state > qmi_cdev->max_level)
|
||||
return -EINVAL;
|
||||
state = qmi_cdev->max_level;
|
||||
|
||||
/* Convert state into QMI client expects for min state */
|
||||
state = qmi_cdev->max_level - state;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -92,7 +92,7 @@ static int reg_send_min_state(struct thermal_cooling_device *cdev,
|
|||
int ret = 0;
|
||||
|
||||
if (state > REG_CDEV_MAX_STATE)
|
||||
return -EINVAL;
|
||||
state = REG_CDEV_MAX_STATE;
|
||||
|
||||
if (reg_dev->min_state == state)
|
||||
return ret;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -47,7 +47,7 @@ static int reg_set_min_state(struct thermal_cooling_device *cdev,
|
|||
int ret = 0;
|
||||
|
||||
if (state > reg_dev->lvl_ct)
|
||||
return -EINVAL;
|
||||
state = reg_dev->lvl_ct;
|
||||
|
||||
if (reg_dev->min_reg_state == state)
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue