[RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE4187d

5 messages, 3 authors, 2015-02-25 · open the first message on its own page

[RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

From: Cédric Le Goater <hidden>
Date: 2015-02-20 15:10:23

Signed-off-by: Cédric Le Goater <redacted>
---
 arch/powerpc/platforms/powernv/opal-sensor.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef7abc9..544292f2020f 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -72,6 +72,9 @@ static __init int opal_sensor_init(void)
 	struct platform_device *pdev;
 	struct device_node *sensor;
 
+	if (!opal_check_token(OPAL_SENSOR_READ))
+		return -ENODEV;
+
 	sensor = of_find_node_by_path("/ibm,opal/sensors");
 	if (!sensor) {
 		pr_err("Opal node 'sensors' not found\n");
-- 
1.7.10.4

Re: [RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

From: Guenter Roeck <linux@roeck-us.net>
Date: 2015-02-20 16:53:13

On Fri, Feb 20, 2015 at 04:07:35PM +0100, Cédric Le Goater wrote:

You should explain here why this patch is needed.
quoted hunk
Signed-off-by: Cédric Le Goater <redacted>
---
 arch/powerpc/platforms/powernv/opal-sensor.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef7abc9..544292f2020f 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -72,6 +72,9 @@ static __init int opal_sensor_init(void)
 	struct platform_device *pdev;
 	struct device_node *sensor;
 
+	if (!opal_check_token(OPAL_SENSOR_READ))
+		return -ENODEV;
+
 	sensor = of_find_node_by_path("/ibm,opal/sensors");
 	if (!sensor) {
 		pr_err("Opal node 'sensors' not found\n");
-- 
1.7.10.4

Re: [RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

From: Cedric Le Goater <hidden>
Date: 2015-02-20 20:18:42

On 02/20/2015 05:53 PM, Guenter Roeck wrote:
On Fri, Feb 20, 2015 at 04:07:35PM +0100, Cédric Le Goater wrote:

You should explain here why this patch is needed.
Yes. What it does is to check that the firmware exposes the service
this driver is using (OPAL_SENSOR_READ). I will fix it.

Thanks,

C. 

quoted
Signed-off-by: Cédric Le Goater <redacted>
---
 arch/powerpc/platforms/powernv/opal-sensor.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef7abc9..544292f2020f 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -72,6 +72,9 @@ static __init int opal_sensor_init(void)
 	struct platform_device *pdev;
 	struct device_node *sensor;
 
+	if (!opal_check_token(OPAL_SENSOR_READ))
+		return -ENODEV;
+
 	sensor = of_find_node_by_path("/ibm,opal/sensors");
 	if (!sensor) {
 		pr_err("Opal node 'sensors' not found\n");
-- 
1.7.10.4

Re: [RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-02-24 04:54:59

On Fri, 2015-02-20 at 16:07 +0100, Cédric Le Goater wrote:
quoted hunk
Signed-off-by: Cédric Le Goater <redacted>
---
 arch/powerpc/platforms/powernv/opal-sensor.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef7abc9..544292f2020f 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -72,6 +72,9 @@ static __init int opal_sensor_init(void)
 	struct platform_device *pdev;
 	struct device_node *sensor;
 
+	if (!opal_check_token(OPAL_SENSOR_READ))
+		return -ENODEV;
+
 	sensor = of_find_node_by_path("/ibm,opal/sensors");
 	if (!sensor) {
 		pr_err("Opal node 'sensors' not found\n");
Are you actually seeing this in practice?

It's a bit annoying that we have to check for the token, and then also check
the device tree. It would be nice if one implied the presence of the other.

cheers

Re: [RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist

From: Cedric Le Goater <hidden>
Date: 2015-02-25 17:28:38

On 02/24/2015 05:54 AM, Michael Ellerman wrote:
On Fri, 2015-02-20 at 16:07 +0100, Cédric Le Goater wrote:
quoted
Signed-off-by: Cédric Le Goater <redacted>
---
 arch/powerpc/platforms/powernv/opal-sensor.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef7abc9..544292f2020f 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -72,6 +72,9 @@ static __init int opal_sensor_init(void)
 	struct platform_device *pdev;
 	struct device_node *sensor;
 
+	if (!opal_check_token(OPAL_SENSOR_READ))
+		return -ENODEV;
+
 	sensor = of_find_node_by_path("/ibm,opal/sensors");
 	if (!sensor) {
 		pr_err("Opal node 'sensors' not found\n");
Are you actually seeing this in practice?
No. Not this one. I have seen others though. I will send you patches.
It's a bit annoying that we have to check for the token, and then also check
the device tree. It would be nice if one implied the presence of the other.
Should we expose the OPAL call token in the device tree ? 

Cheers,

C. 
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help