[2/3] sensors: Fix dtc warning for dts sensors.

Message ID 1508511452-26744-2-git-send-email-ppaidipe@linux.vnet.ibm.com
State New
Headers show
Series
  • [1/3] hw/occ: Fix psr cpu-to-gpu sensors node dtc warning.
Related show

Commit Message

Pridhiviraj Paidipeddi Oct. 20, 2017, 2:57 p.m.
dtc complains about missing reg property when a DT node is having a
unit name or address but no reg property.

Example warning for core dts sensor:
/ibm,opal/sensors/core-temp@5c has a unit name, but no reg property
/ibm,opal/sensors/core-temp@804 has a unit name, but no reg property

This patch fixes this by adding necessary properties.

Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
---
 core/sensor.c | 2 ++
 hw/dts.c      | 2 ++
 2 files changed, 4 insertions(+)

Patch

diff --git a/core/sensor.c b/core/sensor.c
index 57b21bc..6d5fd42 100644
--- a/core/sensor.c
+++ b/core/sensor.c
@@ -58,6 +58,8 @@  void sensor_init(void)
 	sensor_node = dt_new(opal_node, "sensors");
 
 	dt_add_property_string(sensor_node, "compatible", "ibm,opal-sensor");
+	dt_add_property_cells(sensor_node, "#address-cells", 1);
+	dt_add_property_cells(sensor_node, "#size-cells", 0);
 	dts_sensor_create_nodes(sensor_node);
 
 	/* Register OPAL interface */
diff --git a/hw/dts.c b/hw/dts.c
index a10df58..53a3123 100644
--- a/hw/dts.c
+++ b/hw/dts.c
@@ -402,6 +402,7 @@  bool dts_sensor_create_nodes(struct dt_node *sensors)
 			dt_add_property_cells(node, "sensor-status", handler);
 			dt_add_property_string(node, "sensor-type", "temp");
 			dt_add_property_cells(node, "ibm,pir", c->pir);
+			dt_add_property_cells(node, "reg", c->pir);
 			dt_add_property_string(node, "label", "Core");
 		}
 	}
@@ -428,6 +429,7 @@  bool dts_sensor_create_nodes(struct dt_node *sensors)
 		dt_add_property_cells(node, "sensor-status", handler);
 		dt_add_property_string(node, "sensor-type", "temp");
 		dt_add_property_cells(node, "ibm,chip-id", chip_id);
+		dt_add_property_cells(node, "reg", chip_id);
 		dt_add_property_string(node, "label", "Centaur");
 	}