From: 陈亮 <cl@rock-chips.com> Date: Wed, 17 Sep 2014 01:17:27 +0000 (-0700) Subject: tsadc: define INVALID_TEMP and return it when some err happen X-Git-Tag: firefly_0821_release~4693 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e0384471e3722617652121f77a1385da2f43003c;p=firefly-linux-kernel-4.4.55.git tsadc: define INVALID_TEMP and return it when some err happen Signed-off-by: 陈亮 <cl@rock-chips.com> --- 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 <linux/slab.h> #include <linux/sysfs.h> #include <linux/workqueue.h> +#include <linux/rockchip/common.h> #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 <linux/of_platform.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/rockchip/common.h> #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