* [PATCH] perf thread: cleanup with list_first_entry_or_null()
@ 2016-09-12 18:29 Masahiro Yamada
2016-11-06 3:00 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2016-09-12 18:29 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Alexander Shishkin, linux-kernel
Cc: Masahiro Yamada, Andi Kleen, Eric Engestrom, He Kuang, Jiri Olsa
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
tools/perf/util/thread.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 8b10a55..ea951df 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -107,10 +107,7 @@ void thread__put(struct thread *thread)
struct comm *thread__comm(const struct thread *thread)
{
- if (list_empty(&thread->comm_list))
- return NULL;
-
- return list_first_entry(&thread->comm_list, struct comm, list);
+ return list_first_entry_or_null(&thread->comm_list, struct comm, list);
}
struct comm *thread__exec_comm(const struct thread *thread)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf thread: cleanup with list_first_entry_or_null()
2016-09-12 18:29 [PATCH] perf thread: cleanup with list_first_entry_or_null() Masahiro Yamada
@ 2016-11-06 3:00 ` Masahiro Yamada
2016-11-06 4:03 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2016-11-06 3:00 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Alexander Shishkin, Linux Kernel Mailing List
Cc: Masahiro Yamada, Andi Kleen, Eric Engestrom, He Kuang, Jiri Olsa
Hi maintainers,
Does this patch look good?
2016-09-13 3:29 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> The combo of list_empty() check and return list_first_entry()
> can be replaced with list_first_entry_or_null().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> tools/perf/util/thread.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> index 8b10a55..ea951df 100644
> --- a/tools/perf/util/thread.c
> +++ b/tools/perf/util/thread.c
> @@ -107,10 +107,7 @@ void thread__put(struct thread *thread)
>
> struct comm *thread__comm(const struct thread *thread)
> {
> - if (list_empty(&thread->comm_list))
> - return NULL;
> -
> - return list_first_entry(&thread->comm_list, struct comm, list);
> + return list_first_entry_or_null(&thread->comm_list, struct comm, list);
> }
>
> struct comm *thread__exec_comm(const struct thread *thread)
> --
> 1.9.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf thread: cleanup with list_first_entry_or_null()
2016-11-06 3:00 ` Masahiro Yamada
@ 2016-11-06 4:03 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-06 4:03 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
Linux Kernel Mailing List, Andi Kleen, Eric Engestrom, He Kuang,
Jiri Olsa
Em Sun, Nov 06, 2016 at 12:00:22PM +0900, Masahiro Yamada escreveu:
> Hi maintainers,
>
> Does this patch look good?
>From a quick look it seems ok, I'll try and process it when back home.
- Arnaldo
> 2016-09-13 3:29 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> > The combo of list_empty() check and return list_first_entry()
> > can be replaced with list_first_entry_or_null().
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> > tools/perf/util/thread.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > index 8b10a55..ea951df 100644
> > --- a/tools/perf/util/thread.c
> > +++ b/tools/perf/util/thread.c
> > @@ -107,10 +107,7 @@ void thread__put(struct thread *thread)
> >
> > struct comm *thread__comm(const struct thread *thread)
> > {
> > - if (list_empty(&thread->comm_list))
> > - return NULL;
> > -
> > - return list_first_entry(&thread->comm_list, struct comm, list);
> > + return list_first_entry_or_null(&thread->comm_list, struct comm, list);
> > }
> >
> > struct comm *thread__exec_comm(const struct thread *thread)
> > --
> > 1.9.1
> >
>
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-06 4:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 18:29 [PATCH] perf thread: cleanup with list_first_entry_or_null() Masahiro Yamada
2016-11-06 3:00 ` Masahiro Yamada
2016-11-06 4:03 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).