linux/include/trace/events/clk.h
Steven Rostedt (Google) 2c92ca849f tracing/treewide: Remove second parameter of __assign_str()
With the rework of how the __string() handles dynamic strings where it
saves off the source string in field in the helper structure[1], the
assignment of that value to the trace event field is stored in the helper
value and does not need to be passed in again.

This means that with:

  __string(field, mystring)

Which use to be assigned with __assign_str(field, mystring), no longer
needs the second parameter and it is unused. With this, __assign_str()
will now only get a single parameter.

There's over 700 users of __assign_str() and because coccinelle does not
handle the TRACE_EVENT() macro I ended up using the following sed script:

  git grep -l __assign_str | while read a ; do
      sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file;
      mv /tmp/test-file $a;
  done

I then searched for __assign_str() that did not end with ';' as those
were multi line assignments that the sed script above would fail to catch.

Note, the same updates will need to be done for:

  __assign_str_len()
  __assign_rel_str()
  __assign_rel_str_len()

I tested this with both an allmodconfig and an allyesconfig (build only for both).

[1] https://lore.kernel.org/linux-trace-kernel/20240222211442.634192653@goodmis.org/

Link: https://lore.kernel.org/linux-trace-kernel/20240516133454.681ba6a0@rorschach.local.home

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Christian König <christian.koenig@amd.com> for the amdgpu parts.
Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #for
Acked-by: Rafael J. Wysocki <rafael@kernel.org> # for thermal
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Darrick J. Wong <djwong@kernel.org>	# xfs
Tested-by: Guenter Roeck <linux@roeck-us.net>
2024-05-22 20:14:47 -04:00

314 lines
6.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM clk
#if !defined(_TRACE_CLK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_CLK_H
#include <linux/tracepoint.h>
struct clk_core;
DECLARE_EVENT_CLASS(clk,
TP_PROTO(struct clk_core *core),
TP_ARGS(core),
TP_STRUCT__entry(
__string( name, core->name )
),
TP_fast_assign(
__assign_str(name);
),
TP_printk("%s", __get_str(name))
);
DEFINE_EVENT(clk, clk_enable,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_enable_complete,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_disable,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_disable_complete,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_prepare,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_prepare_complete,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_unprepare,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DEFINE_EVENT(clk, clk_unprepare_complete,
TP_PROTO(struct clk_core *core),
TP_ARGS(core)
);
DECLARE_EVENT_CLASS(clk_rate,
TP_PROTO(struct clk_core *core, unsigned long rate),
TP_ARGS(core, rate),
TP_STRUCT__entry(
__string( name, core->name )
__field(unsigned long, rate )
),
TP_fast_assign(
__assign_str(name);
__entry->rate = rate;
),
TP_printk("%s %lu", __get_str(name), (unsigned long)__entry->rate)
);
DEFINE_EVENT(clk_rate, clk_set_rate,
TP_PROTO(struct clk_core *core, unsigned long rate),
TP_ARGS(core, rate)
);
DEFINE_EVENT(clk_rate, clk_set_rate_complete,
TP_PROTO(struct clk_core *core, unsigned long rate),
TP_ARGS(core, rate)
);
DEFINE_EVENT(clk_rate, clk_set_min_rate,
TP_PROTO(struct clk_core *core, unsigned long rate),
TP_ARGS(core, rate)
);
DEFINE_EVENT(clk_rate, clk_set_max_rate,
TP_PROTO(struct clk_core *core, unsigned long rate),
TP_ARGS(core, rate)
);
DECLARE_EVENT_CLASS(clk_rate_range,
TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
TP_ARGS(core, min, max),
TP_STRUCT__entry(
__string( name, core->name )
__field(unsigned long, min )
__field(unsigned long, max )
),
TP_fast_assign(
__assign_str(name);
__entry->min = min;
__entry->max = max;
),
TP_printk("%s min %lu max %lu", __get_str(name),
(unsigned long)__entry->min,
(unsigned long)__entry->max)
);
DEFINE_EVENT(clk_rate_range, clk_set_rate_range,
TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
TP_ARGS(core, min, max)
);
DECLARE_EVENT_CLASS(clk_parent,
TP_PROTO(struct clk_core *core, struct clk_core *parent),
TP_ARGS(core, parent),
TP_STRUCT__entry(
__string( name, core->name )
__string( pname, parent ? parent->name : "none" )
),
TP_fast_assign(
__assign_str(name);
__assign_str(pname);
),
TP_printk("%s %s", __get_str(name), __get_str(pname))
);
DEFINE_EVENT(clk_parent, clk_set_parent,
TP_PROTO(struct clk_core *core, struct clk_core *parent),
TP_ARGS(core, parent)
);
DEFINE_EVENT(clk_parent, clk_set_parent_complete,
TP_PROTO(struct clk_core *core, struct clk_core *parent),
TP_ARGS(core, parent)
);
DECLARE_EVENT_CLASS(clk_phase,
TP_PROTO(struct clk_core *core, int phase),
TP_ARGS(core, phase),
TP_STRUCT__entry(
__string( name, core->name )
__field( int, phase )
),
TP_fast_assign(
__assign_str(name);
__entry->phase = phase;
),
TP_printk("%s %d", __get_str(name), (int)__entry->phase)
);
DEFINE_EVENT(clk_phase, clk_set_phase,
TP_PROTO(struct clk_core *core, int phase),
TP_ARGS(core, phase)
);
DEFINE_EVENT(clk_phase, clk_set_phase_complete,
TP_PROTO(struct clk_core *core, int phase),
TP_ARGS(core, phase)
);
DECLARE_EVENT_CLASS(clk_duty_cycle,
TP_PROTO(struct clk_core *core, struct clk_duty *duty),
TP_ARGS(core, duty),
TP_STRUCT__entry(
__string( name, core->name )
__field( unsigned int, num )
__field( unsigned int, den )
),
TP_fast_assign(
__assign_str(name);
__entry->num = duty->num;
__entry->den = duty->den;
),
TP_printk("%s %u/%u", __get_str(name), (unsigned int)__entry->num,
(unsigned int)__entry->den)
);
DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle,
TP_PROTO(struct clk_core *core, struct clk_duty *duty),
TP_ARGS(core, duty)
);
DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle_complete,
TP_PROTO(struct clk_core *core, struct clk_duty *duty),
TP_ARGS(core, duty)
);
DECLARE_EVENT_CLASS(clk_rate_request,
TP_PROTO(struct clk_rate_request *req),
TP_ARGS(req),
TP_STRUCT__entry(
__string( name, req->core ? req->core->name : "none")
__string( pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none" )
__field(unsigned long, min )
__field(unsigned long, max )
__field(unsigned long, prate )
),
TP_fast_assign(
__assign_str(name);
__assign_str(pname);
__entry->min = req->min_rate;
__entry->max = req->max_rate;
__entry->prate = req->best_parent_rate;
),
TP_printk("%s min %lu max %lu, parent %s (%lu)", __get_str(name),
(unsigned long)__entry->min,
(unsigned long)__entry->max,
__get_str(pname),
(unsigned long)__entry->prate)
);
DEFINE_EVENT(clk_rate_request, clk_rate_request_start,
TP_PROTO(struct clk_rate_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(clk_rate_request, clk_rate_request_done,
TP_PROTO(struct clk_rate_request *req),
TP_ARGS(req)
);
#endif /* _TRACE_CLK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>