diff mbox series

[1/2] sensors: occ: Skip GPU sensors for non-gpu systems

Message ID 1516340157-27298-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State Accepted
Headers show
Series [1/2] sensors: occ: Skip GPU sensors for non-gpu systems | expand

Commit Message

Shilpasri G Bhat Jan. 19, 2018, 5:35 a.m. UTC
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 hw/occ-sensor.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Stewart Smith Feb. 1, 2018, 8:27 a.m. UTC | #1
Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> writes:
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
> ---
>  hw/occ-sensor.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Thanks, series merged to master as of
a05e341c9af2700c69bd0477132caead28d0bb89.
diff mbox series

Patch

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index cb05f7c..72c8964 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -553,6 +553,7 @@  void occ_sensors_init(void)
 	struct proc_chip *chip;
 	struct dt_node *sg, *exports;
 	int occ_num = 0, i;
+	bool has_gpu = false;
 
 	/* OCC inband sensors is only supported in P9 */
 	if (proc_gen != proc_gen_p9)
@@ -576,6 +577,9 @@  void occ_sensors_init(void)
 	dt_add_property_cells(sg, "#address-cells", 1);
 	dt_add_property_cells(sg, "#size-cells", 0);
 
+	if (dt_find_compatible_node(dt_root, NULL, "ibm,power9-npu"))
+		has_gpu = true;
+
 	for_each_chip(chip) {
 		struct occ_sensor_data_header *hb;
 		struct occ_sensor_name *md;
@@ -604,6 +608,9 @@  void occ_sensors_init(void)
 			if (!(md[i].type & HWMON_SENSORS_MASK))
 				continue;
 
+			if (md[i].location == OCC_SENSOR_LOC_GPU && !has_gpu)
+				continue;
+
 			if (md[i].location == OCC_SENSOR_LOC_CORE) {
 				int num = parse_entity(md[i].name, NULL);