Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1409885 > unrolled thread
| Started by | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| First post | 2016-05-31 08:40 +0200 |
| Last post | 2016-05-31 08:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 07/15] thermal: sysfs: lock tz while on policy properties Eduardo Valentin <edubezval@gmail.com> - 2016-05-31 08:40 +0200
| From | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| Date | 2016-05-31 08:40 +0200 |
| Subject | [PATCH 07/15] thermal: sysfs: lock tz while on policy properties |
| Message-ID | <rELvk-7hB-51@gated-at.bofh.it> |
Serialized calls to tz.ops in user facing
sysfs handler policy_show().
policy_store() is already locked by
the thermal core.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/thermal_sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index dcaeb17..234eb18 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -311,8 +311,14 @@ static ssize_t
policy_show(struct device *dev, struct device_attribute *devattr, char *buf)
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
+ char *name;
- return sprintf(buf, "%s\n", tz->governor->name);
+ /* locking the zone because governor->name does not change */
+ mutex_lock(&tz->lock);
+ name = tz->governor->name;
+ mutex_unlock(&tz->lock);
+
+ return sprintf(buf, "%s\n", name);
}
static ssize_t
--
2.1.4
Back to top | Article view | linux.kernel
csiph-web