tsadc: define INVALID_TEMP and return it when some err happen

Signed-off-by: 陈亮 <cl@rock-chips.com>
This commit is contained in:
陈亮 2014-09-16 18:17:27 -07:00
parent bb50c81be9
commit e0384471e3
3 changed files with 6 additions and 3 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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