Skip to content

Commit 24cbfe1

Browse files
covanamrostedt
authored andcommitted
rv: Merge struct rv_monitor_def into struct rv_monitor
Each struct rv_monitor has a unique struct rv_monitor_def associated with it. struct rv_monitor is statically allocated, while struct rv_monitor_def is dynamically allocated. This makes the code more complicated than it should be: - Lookup is required to get the associated rv_monitor_def from rv_monitor - Dynamic memory allocation is required for rv_monitor_def. This is harder to get right compared to static memory. For instance, there is an existing mistake: rv_unregister_monitor() does not free the memory allocated by rv_register_monitor(). This is fortunately not a real memory leak problem, as rv_unregister_monitor() is never called. Simplify and merge rv_monitor_def into rv_monitor. Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/194449c00f87945c207aab4c96920c75796a4f53.1753378331.git.namcao@linutronix.de Reviewed-by: Gabriele Monaco <[email protected]> Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent b0c08dd commit 24cbfe1

File tree

4 files changed

+140
-168
lines changed

4 files changed

+140
-168
lines changed

include/linux/rv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#ifndef _LINUX_RV_H
88
#define _LINUX_RV_H
99

10+
#include <linux/types.h>
11+
#include <linux/list.h>
12+
1013
#define MAX_DA_NAME_LEN 32
1114

1215
#ifdef CONFIG_RV
@@ -98,8 +101,13 @@ struct rv_monitor {
98101
void (*disable)(void);
99102
void (*reset)(void);
100103
#ifdef CONFIG_RV_REACTORS
104+
struct rv_reactor_def *rdef;
101105
__printf(1, 2) void (*react)(const char *msg, ...);
106+
bool reacting;
102107
#endif
108+
struct list_head list;
109+
struct rv_monitor *parent;
110+
struct dentry *root_d;
103111
};
104112

105113
bool rv_monitoring_on(void);

0 commit comments

Comments
 (0)