diff mbox series

pm-graph: bug fix for bugzilla 204773

Message ID 14fe4150a85169924cb2d2e915f42cc93f4543e4.1567630666.git.todd.e.brandt@linux.intel.com (mailing list archive)
State Mainlined, archived
Headers show
Series pm-graph: bug fix for bugzilla 204773 | expand

Commit Message

Todd Brandt Sept. 4, 2019, 9:04 p.m. UTC
Raphael, this patch fits right on top of the 5.5 release patch.
It's an important fix for a bug found when running -dev mode.

Fix bugzilla issue 204773
https://bugzilla.kernel.org/show_bug.cgi?id=204773

sleepgraph:
- kprobe_events won't set correctly if the data is buffered
- force sysvals.setVal to be unbuffered and use binary mode
- tested in both python2 and python3

Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
---
 tools/power/pm-graph/sleepgraph.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tools/power/pm-graph/sleepgraph.py b/tools/power/pm-graph/sleepgraph.py
index 1794c79a7d1b..f7d1c1f62f86 100755
--- a/tools/power/pm-graph/sleepgraph.py
+++ b/tools/power/pm-graph/sleepgraph.py
@@ -667,19 +667,19 @@  class SystemValues:
 		if linesack < linesout:
 			return False
 		return True
-	def setVal(self, val, file, mode='w'):
+	def setVal(self, val, file):
 		if not os.path.exists(file):
 			return False
 		try:
-			fp = open(file, mode)
-			fp.write(val)
+			fp = open(file, 'wb', 0)
+			fp.write(val.encode())
 			fp.flush()
 			fp.close()
 		except:
 			return False
 		return True
-	def fsetVal(self, val, path, mode='w'):
-		return self.setVal(val, self.tpath+path, mode)
+	def fsetVal(self, val, path):
+		return self.setVal(val, self.tpath+path)
 	def getVal(self, file):
 		res = ''
 		if not os.path.exists(file):