@@ -706,6 +706,17 @@ static void add_sensor_node(const char *loc, const char *type, int i, int attr,
*phandle = node->phandle;
}
+static bool check_sensor_sample(struct occ_sensor_data_header *hb, u32 offset)
+{
+ struct occ_sensor_record *ping, *pong;
+
+ ping = (struct occ_sensor_record *)((u64)hb + hb->reading_ping_offset
+ + offset);
+ pong = (struct occ_sensor_record *)((u64)hb + hb->reading_pong_offset
+ + offset);
+ return ping->sample || pong->sample;
+}
+
void occ_sensors_init(void)
{
struct proc_chip *chip;
@@ -759,6 +770,9 @@ void occ_sensors_init(void)
if (!(md[i].type & HWMON_SENSORS_MASK))
continue;
+ if (!check_sensor_sample(hb, md[i].reading_offset))
+ continue;
+
if (md[i].location == OCC_SENSOR_LOC_CORE) {
int num = parse_entity(md[i].name, NULL);
OCC copies APSS, GPU sensors on platforms that dont have them. The de-configured sensors are copied with 0 sensor values. So filter out the zero'ed environment sensors as they are not present on the system. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> --- hw/occ-sensor.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)