summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2019-05-27 02:11:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-05-28 17:37:43 -0400
commit7cb10a08df98e643b87d4bc8422e50e9c43b5c60 (patch)
tree725153387454ccf8336ad6c26263d628862c84b1
parenta0c0a4ac021b017e385d0328541ccfebeef165fc (diff)
perf tools: Remove const from thread read accessors
The namespaces and comm fields of a thread are protected by rwsem and require write access for it. So it ended up using a cast to remove the const qualifier. Let's get rid of the const then. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Hari Bathini <hbathini@linux.vnet.ibm.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Krister Johansen <kjlx@templeofstupid.com> Link: http://lkml.kernel.org/r/20190527061149.168640-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/hist.c2
-rw-r--r--tools/perf/util/thread.c12
-rw-r--r--tools/perf/util/thread.h4
3 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 7ace7a10054d..fb3271fd420c 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -2561,7 +2561,7 @@ int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool sh
2561 char unit; 2561 char unit;
2562 int printed; 2562 int printed;
2563 const struct dso *dso = hists->dso_filter; 2563 const struct dso *dso = hists->dso_filter;
2564 const struct thread *thread = hists->thread_filter; 2564 struct thread *thread = hists->thread_filter;
2565 int socket_id = hists->socket_filter; 2565 int socket_id = hists->socket_filter;
2566 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 2566 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
2567 u64 nr_events = hists->stats.total_period; 2567 u64 nr_events = hists->stats.total_period;
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index b413ba5b9835..aab7807d445f 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -141,13 +141,13 @@ static struct namespaces *__thread__namespaces(const struct thread *thread)
141 return list_first_entry(&thread->namespaces_list, struct namespaces, list); 141 return list_first_entry(&thread->namespaces_list, struct namespaces, list);
142} 142}
143 143
144struct namespaces *thread__namespaces(const struct thread *thread) 144struct namespaces *thread__namespaces(struct thread *thread)
145{ 145{
146 struct namespaces *ns; 146 struct namespaces *ns;
147 147
148 down_read((struct rw_semaphore *)&thread->namespaces_lock); 148 down_read(&thread->namespaces_lock);
149 ns = __thread__namespaces(thread); 149 ns = __thread__namespaces(thread);
150 up_read((struct rw_semaphore *)&thread->namespaces_lock); 150 up_read(&thread->namespaces_lock);
151 151
152 return ns; 152 return ns;
153} 153}
@@ -271,13 +271,13 @@ static const char *__thread__comm_str(const struct thread *thread)
271 return comm__str(comm); 271 return comm__str(comm);
272} 272}
273 273
274const char *thread__comm_str(const struct thread *thread) 274const char *thread__comm_str(struct thread *thread)
275{ 275{
276 const char *str; 276 const char *str;
277 277
278 down_read((struct rw_semaphore *)&thread->comm_lock); 278 down_read(&thread->comm_lock);
279 str = __thread__comm_str(thread); 279 str = __thread__comm_str(thread);
280 up_read((struct rw_semaphore *)&thread->comm_lock); 280 up_read(&thread->comm_lock);
281 281
282 return str; 282 return str;
283} 283}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index cf8375c017a0..e97ef6977eb9 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -76,7 +76,7 @@ static inline void thread__exited(struct thread *thread)
76 thread->dead = true; 76 thread->dead = true;
77} 77}
78 78
79struct namespaces *thread__namespaces(const struct thread *thread); 79struct namespaces *thread__namespaces(struct thread *thread);
80int thread__set_namespaces(struct thread *thread, u64 timestamp, 80int thread__set_namespaces(struct thread *thread, u64 timestamp,
81 struct namespaces_event *event); 81 struct namespaces_event *event);
82 82
@@ -93,7 +93,7 @@ int thread__set_comm_from_proc(struct thread *thread);
93int thread__comm_len(struct thread *thread); 93int thread__comm_len(struct thread *thread);
94struct comm *thread__comm(const struct thread *thread); 94struct comm *thread__comm(const struct thread *thread);
95struct comm *thread__exec_comm(const struct thread *thread); 95struct comm *thread__exec_comm(const struct thread *thread);
96const char *thread__comm_str(const struct thread *thread); 96const char *thread__comm_str(struct thread *thread);
97int thread__insert_map(struct thread *thread, struct map *map); 97int thread__insert_map(struct thread *thread, struct map *map);
98int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bool do_maps_clone); 98int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bool do_maps_clone);
99size_t thread__fprintf(struct thread *thread, FILE *fp); 99size_t thread__fprintf(struct thread *thread, FILE *fp);