Skip to content

Commit 7410d60

Browse files
captain5050acmel
authored andcommitted
perf dsos: Remove __dsos__findnew_link_by_longname_id()
Function was only called in dsos.c with the dso parameter as NULL. Remove the function and specialize for the dso being NULL case removing other unused functions along the way. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Ben Gainey <ben.gainey@arm.com> Cc: Changbin Du <changbin.du@huawei.com> Cc: Chengen Du <chengen.du@canonical.com> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: Dima Kogan <dima@secretsauce.net> Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Li Dong <lidong@vivo.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paran Lee <p4ranlee@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: zhaimingbing <zhaimingbing@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20240504213803.218974-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent dfd4816 commit 7410d60

2 files changed

Lines changed: 10 additions & 47 deletions

File tree

tools/perf/util/dsos.c

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ static int __dso__cmp_short_name(const char *short_name, struct dso_id *id, stru
119119
return rc ?: dso_id__cmp(id, &b->id);
120120
}
121121

122-
static int dso__cmp_short_name(struct dso *a, struct dso *b)
123-
{
124-
return __dso__cmp_short_name(a->short_name, &a->id, b);
125-
}
126-
127122
static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb)
128123
{
129124
const struct dso *a = *((const struct dso **)va);
@@ -143,20 +138,21 @@ static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb)
143138
* Either one of the dso or name parameter must be non-NULL or the
144139
* function will not work.
145140
*/
146-
struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos,
147-
struct dso *dso,
148-
const char *name,
149-
struct dso_id *id,
150-
bool write_locked)
141+
static struct dso *__dsos__find_by_longname_id(struct dsos *dsos,
142+
const char *name,
143+
struct dso_id *id,
144+
bool write_locked)
151145
{
152146
int low = 0, high = dsos->cnt - 1;
153147

154148
if (!dsos->sorted) {
155149
if (!write_locked) {
150+
struct dso *dso;
151+
156152
up_read(&dsos->lock);
157153
down_write(&dsos->lock);
158-
dso = __dsos__findnew_link_by_longname_id(dsos, dso, name, id,
159-
/*write_locked=*/true);
154+
dso = __dsos__find_by_longname_id(dsos, name, id,
155+
/*write_locked=*/true);
160156
up_write(&dsos->lock);
161157
down_read(&dsos->lock);
162158
return dso;
@@ -166,9 +162,6 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos,
166162
dsos->sorted = true;
167163
}
168164

169-
if (!name)
170-
name = dso->long_name;
171-
172165
/*
173166
* Find node with the matching name
174167
*/
@@ -178,31 +171,13 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos,
178171
int rc = __dso__cmp_long_name(name, id, this);
179172

180173
if (rc == 0) {
181-
/*
182-
* In case the new DSO is a duplicate of an existing
183-
* one, print a one-time warning & put the new entry
184-
* at the end of the list of duplicates.
185-
*/
186-
if (!dso || (dso == this))
187-
return dso__get(this); /* Find matching dso */
188-
/*
189-
* The core kernel DSOs may have duplicated long name.
190-
* In this case, the short name should be different.
191-
* Comparing the short names to differentiate the DSOs.
192-
*/
193-
rc = dso__cmp_short_name(dso, this);
194-
if (rc == 0) {
195-
pr_err("Duplicated dso name: %s\n", name);
196-
return NULL;
197-
}
174+
return dso__get(this); /* Find matching dso */
198175
}
199176
if (rc < 0)
200177
high = mid - 1;
201178
else
202179
low = mid + 1;
203180
}
204-
if (dso)
205-
__dsos__add(dsos, dso);
206181
return NULL;
207182
}
208183

@@ -240,12 +215,6 @@ int dsos__add(struct dsos *dsos, struct dso *dso)
240215
return ret;
241216
}
242217

243-
static struct dso *__dsos__findnew_by_longname_id(struct dsos *dsos, const char *name,
244-
struct dso_id *id, bool write_locked)
245-
{
246-
return __dsos__findnew_link_by_longname_id(dsos, NULL, name, id, write_locked);
247-
}
248-
249218
struct dsos__find_id_cb_args {
250219
const char *name;
251220
struct dso_id *id;
@@ -279,7 +248,7 @@ static struct dso *__dsos__find_id(struct dsos *dsos, const char *name, struct d
279248
__dsos__for_each_dso(dsos, dsos__find_id_cb, &args);
280249
return args.res;
281250
}
282-
res = __dsos__findnew_by_longname_id(dsos, name, id, write_locked);
251+
res = __dsos__find_by_longname_id(dsos, name, id, write_locked);
283252
return res;
284253
}
285254

tools/perf/util/dsos.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id
3636

3737
bool dsos__read_build_ids(struct dsos *dsos, bool with_hits);
3838

39-
struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos,
40-
struct dso *dso,
41-
const char *name,
42-
struct dso_id *id,
43-
bool write_locked);
44-
4539
size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp,
4640
bool (skip)(struct dso *dso, int parm), int parm);
4741
size_t dsos__fprintf(struct dsos *dsos, FILE *fp);

0 commit comments

Comments
 (0)