From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Zijun Hu <zijun_hu@icloud.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org, Zijun Hu <quic_zijuhu@quicinc.com>
Subject: Re: [PATCH v3] driver core: Explicitly initialize struct member @data.have_async in __device_attach()
Date: Fri, 13 Sep 2024 10:39:15 -0700 [thread overview]
Message-ID: <ZuR4w5l7kLkwSAQS@google.com> (raw)
In-Reply-To: <20240913-fix_have_async-v3-1-793707cfc0d1@quicinc.com>
Hi,
On Fri, Sep 13, 2024 at 10:05:38PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
>
> __device_attach() defines struct device_attach_data @data as auto
> variable and needs to use both @data.want_async and @data.have_async
> but it explicitly initializes the former and leaves compiler implicitly
> initialize the later, that does not have an elegant look, solved by
> explicitly initializing the later member as well that also makes @data
> have full initialization.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> IMO, this change still has a little bit of value as explained below:
>
> - Looks at below similar commit:
> Commit: 8f45f5071ad2 ("gpu: host1x: Explicitly initialize host1x_info structures")
>
> - This change's initialization way is obvious better than
>
> struct device_attach_data data = {
> .dev = dev,
> .check_async = allow_async,
> };
>
> which is better than current
>
> struct device_attach_data data = {
> .dev = dev,
> .check_async = allow_async,
> .want_async = false,
> };
Unlike host1x_info structure from commit 8f45f5071ad2 that you
referenced, which sole purpose is to describe hardware, this is an
internal structure in drivers/base/dd.c that mixes together scan
parameters and internal state/result. The scan parameters are
initialized explicitly to convey the exact request (i.e. for given
device we want to try to attach a driver synchronously, but also we
might be interested in knowing if there is a matching driver that
supports asynchronous probe), the state is not mentioned not to draw
attention from the particulars of the request.
I'll leave this to Greg to decide if we wants to apply this change (I
would not), but if you are doing this you need to make similar change
for the 2nd instance of struct device_attach_data.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2024-09-13 17:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 14:05 [PATCH v3] driver core: Explicitly initialize struct member @data.have_async in __device_attach() Zijun Hu
2024-09-13 17:39 ` Dmitry Torokhov [this message]
2024-09-13 20:44 ` Zijun Hu
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=ZuR4w5l7kLkwSAQS@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_zijuhu@quicinc.com \
--cc=rafael@kernel.org \
--cc=zijun_hu@icloud.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.