From: Steven Rostedt <rostedt@goodmis.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Costa Shulyupin <costa.shul@redhat.com>,
Daniel Bristot de Oliveira <bristot@kernel.org>,
John Kacur <jkacur@redhat.com>,
"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
Eder Zulian <ezulian@redhat.com>,
Tomas Glozar <tglozar@redhat.com>,
Gabriele Monaco <gmonaco@redhat.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Fix bug and add osnoise_trace_is_off()
Date: Wed, 15 Jan 2025 10:26:51 -0500 [thread overview]
Message-ID: <20250115102651.306f3b7b@gandalf.local.home> (raw)
In-Reply-To: <4ee1e1a7-f0b3-4062-97d9-45a342d0ca21@stanley.mountain>
On Wed, 15 Jan 2025 12:02:00 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> You introduced a bug by changing the order.
>
> You have to undestand that to the original authors this stuff was really
> easy and they knew the order of the struct members because they chose it
> deliberately. In the end, they get so used to the code that
> "&record->trace" just becomes an idiom for casting "record" and they
> forget how it looks to a newcomer.
>
> I *personally* am not a fan of code which assumes we know the order of
> the struct members so I don't have a problem with you re-writing the
> code. But the commit message must say that it is just a cleanup and not
> a fix.
>
> Which reminds me that I had intended to create a container_of_first()
> for code like this which assumes that container_of() is just a cast.
> There is lots of code like this:
>
> struct something *member = container_of(p, struct foo, first_member);
>
> if (IS_ERR(member)) {
>
> Which relies on the face that "first_member" is the first member of
> foo struct. It's a quite common thing.
I agree that this is not a bug, but I will happily take a clean up to make
it more robust.
-- Steve
next prev parent reply other threads:[~2025-01-15 15:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 8:09 [PATCH v2] Fix bug and add osnoise_trace_is_off() Costa Shulyupin
2025-01-15 9:02 ` Dan Carpenter
2025-01-15 15:26 ` Steven Rostedt [this message]
2025-01-15 11:12 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250115102651.306f3b7b@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bristot@kernel.org \
--cc=costa.shul@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=ezulian@redhat.com \
--cc=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=tglozar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox