[PATCH v3 3/3] powerpc/powernv: remove opal_sensor_mutex

Cédric Le Goater clg at fr.ibm.com
Sat Mar 28 03:39:21 AEDT 2015


The opal sensor mutex protects the opal_sensor_read call which
can return a OPAL_BUSY code on IBM Power systems if a previous 
request is in progress.

This can be handled at user level with a retry.

Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---

 Changes since v2 :

 - removed a goto label

 arch/powerpc/platforms/powernv/opal-sensor.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Index: linux.git/arch/powerpc/platforms/powernv/opal-sensor.c
===================================================================
--- linux.git.orig/arch/powerpc/platforms/powernv/opal-sensor.c
+++ linux.git/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -19,13 +19,10 @@
  */
 
 #include <linux/delay.h>
-#include <linux/mutex.h>
 #include <linux/of_platform.h>
 #include <asm/opal.h>
 #include <asm/machdep.h>
 
-static DEFINE_MUTEX(opal_sensor_mutex);
-
 /*
  * This will return sensor information to driver based on the requested sensor
  * handle. A handle is an opaque id for the powernv, read by the driver from the
@@ -40,11 +37,9 @@ int opal_get_sensor_data(u32 sensor_hndl
 	token = opal_async_get_token_interruptible();
 	if (token < 0) {
 		pr_err("%s: Couldn't get the token, returning\n", __func__);
-		ret = token;
-		goto out;
+		return token;
 	}
 
-	mutex_lock(&opal_sensor_mutex);
 	ret = opal_sensor_read(sensor_hndl, token, &data);
 	switch (ret) {
 	case OPAL_ASYNC_COMPLETION:
@@ -70,9 +65,7 @@ int opal_get_sensor_data(u32 sensor_hndl
 	}
 
 out_token:
-	mutex_unlock(&opal_sensor_mutex);
 	opal_async_release_token(token);
-out:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(opal_get_sensor_data);



More information about the Linuxppc-dev mailing list