From e0384471e3722617652121f77a1385da2f43003c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=99=88=E4=BA=AE?= Date: Tue, 16 Sep 2014 18:17:27 -0700 Subject: [PATCH] tsadc: define INVALID_TEMP and return it when some err happen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈亮 --- drivers/hwmon/rockchip-hwmon.c | 3 ++- drivers/hwmon/rockchip_tsadc.c | 3 ++- include/linux/rockchip/common.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/rockchip-hwmon.c b/drivers/hwmon/rockchip-hwmon.c index 4aa4d480743e..bed728ed4e49 100755 --- a/drivers/hwmon/rockchip-hwmon.c +++ b/drivers/hwmon/rockchip-hwmon.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "hwmon-rockchip.h" @@ -68,7 +69,7 @@ static void tsadc_monitor(struct work_struct *work) continue; temp = data->ops.read_sensor(i); - if (temp == 150) { + if (temp == INVALID_TEMP) { dev_err(&data->pdev->dev, "TSADC read failed\n"); continue; } diff --git a/drivers/hwmon/rockchip_tsadc.c b/drivers/hwmon/rockchip_tsadc.c index eb7002042490..4290f1a6ae51 100755 --- a/drivers/hwmon/rockchip_tsadc.c +++ b/drivers/hwmon/rockchip_tsadc.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "hwmon-rockchip.h" @@ -317,7 +318,7 @@ static void rockchip_tsadc_get(int chn, int *temp, int *code) *code = 0; if (!g_dev || chn > 4){ - *temp = 150; + *temp = INVALID_TEMP; return ; } #if 0 diff --git a/include/linux/rockchip/common.h b/include/linux/rockchip/common.h index 0a1eb0647a86..986943afa2f1 100644 --- a/include/linux/rockchip/common.h +++ b/include/linux/rockchip/common.h @@ -77,10 +77,11 @@ int rockchip_set_system_status(unsigned long status); int rockchip_clear_system_status(unsigned long status); unsigned long rockchip_get_system_status(void); +#define INVALID_TEMP INT_MAX #if IS_ENABLED(CONFIG_SENSORS_ROCKCHIP_TSADC) int rockchip_tsadc_get_temp(int chn); #else -static inline int rockchip_tsadc_get_temp(int chn) { return 0; } +static inline int rockchip_tsadc_get_temp(int chn) { return INVALID_TEMP; } #endif #ifdef CONFIG_RK_LAST_LOG -- 2.34.1