From nobody Wed Oct 8 00:43:22 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0AA62F948D; Fri, 4 Jul 2025 13:20:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751635236; cv=none; b=qUbsucX5OmG0VsrgW2GffLC6K3g+G+ivaAlUkFMxO4VxpluhXNslY8ufolndiKGJOGQSkezHV6bqsmRYFzZ7J0BSXWzEE9oXc7Zl21R7Wdq5UJ+JhpX3gOy9BZF0rFsJBOYvNBfZv/y6p1a2ViNAVNmbYJz2qQwth9HFmRYIrww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751635236; c=relaxed/simple; bh=2mK6sinmKtyV1wCugMEgB2iIJSIT6o63JPL6+Fwhw2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W04B57/7N2F4ouvv1Zk7zV+I8Ibo02Ni5dMDacoMBuzrx9rixxAyDW9AL2vZBBLvF2IxtUS2AMpWZo+x3rsbiduAxJsufnRS74xfrzQnAVC6csB+ILQaepQ+NmZXRyfMPlwLf4UyRvRQC39fa+NF3EUfrczI2LjjVce/EGFAOWE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=N5oSZICR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BFvc4WNI; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="N5oSZICR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BFvc4WNI" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1751635233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+WCyvCXKRf/F4qW3dfDg+7ZIfppz2CYPNGxpMfZcwg0=; b=N5oSZICRtLrlxrRxLecbwDslgCok4Xzg6oOKgpvLunCQo/5x34oSEKuR9oxUCg4DBu80uC RhtdVYFLcGyDLH+ZT//DQ+EpOjOSFpCOTo/00jRLmNcqrh5ugezuP3AA/76EbJYfv4vBpI 9ZmQexGNWd9SMTsqYoxfVCclL82ChNzL4U2XgeouTdMHmP7NJ5iYbLGnFWO6Ro3CD22ono +IALe78EZRKaNjblMXZ36CREpyq+4Ifps2eXkKUYlTCB8Dy+X6YJ4+WcQ/xPLkNJAZhX4/ AfomGfIAL1jCZi//RzL9GeNXx2CjWhlb6YZnyWBJVhIXk98UbnfR+snyuc0k8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1751635233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+WCyvCXKRf/F4qW3dfDg+7ZIfppz2CYPNGxpMfZcwg0=; b=BFvc4WNIXMWt0P1xUQ3fCnnZjFVazuUEFl6BvfAK5XEstv/4Q+mlxxbaXmwEpF4h0hA7vB JBdr5Ml42HJxQ4DA== To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Gabriele Monaco , john.ogness@linutronix.de, Nam Cao Subject: [PATCH v11 06/21] verification/dot2k: Remove __buff_to_string() Date: Fri, 4 Jul 2025 15:19:58 +0200 Message-Id: <860d6002659f604c743e0f23d5cf3c99ea6a82d8.1751634289.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" str.join() can do what __buff_to_string() does. Therefore replace __buff_to_string() to make the scripts more pythonic. Reviewed-by: Gabriele Monaco Signed-off-by: Nam Cao --- tools/verification/dot2/dot2k.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tools/verification/dot2/dot2k.py b/tools/verification/dot2/dot= 2k.py index dd4b5528a4f2..0922754454b9 100644 --- a/tools/verification/dot2/dot2k.py +++ b/tools/verification/dot2/dot2k.py @@ -109,15 +109,6 @@ class dot2k(Dot2c): fd.close() return content =20 - def __buff_to_string(self, buff): - string =3D "" - - for line in buff: - string =3D string + line + "\n" - - # cut off the last \n - return string[:-1] - def fill_monitor_type(self): return self.monitor_type.upper() =20 @@ -148,19 +139,19 @@ class dot2k(Dot2c): buff.append("\tda_%s_%s(%s%s);" % (handle, self.name, even= t, self.enum_suffix)); buff.append("}") buff.append("") - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_tracepoint_attach_probe(self): buff =3D [] for event in self.events: buff.append("\trv_attach_trace_probe(\"%s\", /* XXX: tracepoin= t */, handle_%s);" % (self.name, event)) - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_tracepoint_detach_helper(self): buff =3D [] for event in self.events: buff.append("\trv_detach_trace_probe(\"%s\", /* XXX: tracepoin= t */, handle_%s);" % (self.name, event)) - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_main_c(self): main_c =3D self.main_c @@ -210,7 +201,7 @@ class dot2k(Dot2c): buff =3D self.fill_model_h_header() buff +=3D self.format_model() =20 - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_monitor_class_type(self): if self.monitor_type =3D=3D "per_task": @@ -242,7 +233,7 @@ class dot2k(Dot2c): tp_args_c =3D ", ".join([b for a,b in tp_args]) buff.append(" TP_PROTO(%s)," % tp_proto_c) buff.append(" TP_ARGS(%s)" % tp_args_c) - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_monitor_deps(self): buff =3D [] @@ -250,7 +241,7 @@ class dot2k(Dot2c): if self.parent: buff.append(" depends on RV_MON_%s" % self.parent.upper()) buff.append(" default y") - return self.__buff_to_string(buff) + return '\n'.join(buff) =20 def fill_trace_h(self): trace_h =3D self.trace_h --=20 2.39.5