From: Zijun Hu <zijun_hu@icloud.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
linux-kernel@vger.kernel.org, Zijun Hu <quic_zijuhu@quicinc.com>
Subject: [PATCH v3] driver core: Explicitly initialize struct member @data.have_async in __device_attach()
Date: Fri, 13 Sep 2024 22:05:38 +0800 [thread overview]
Message-ID: <20240913-fix_have_async-v3-1-793707cfc0d1@quicinc.com> (raw)
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,
};
---
Changes in v3:
- Correct commit message.
- Link to v2: https://lore.kernel.org/r/20240823-fix_have_async-v2-1-ed1039527365@quicinc.com
Changes in v2:
- Remove both fix and stable tag
- Correct both title and commit messages
- Link to v1: https://lore.kernel.org/r/20240823-fix_have_async-v1-1-43a354b6614b@quicinc.com
---
drivers/base/dd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index a7cc7ff0923b..9e8596773e7f 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1021,6 +1021,7 @@ static int __device_attach(struct device *dev, bool allow_async)
.dev = dev,
.check_async = allow_async,
.want_async = false,
+ .have_async = false,
};
if (dev->parent)
---
base-commit: efb0b309fa0d8a92f9b303d292944cda08349eed
change-id: 20240823-fix_have_async-3a135618d91b
Best regards,
--
Zijun Hu <quic_zijuhu@quicinc.com>
next reply other threads:[~2024-09-13 14:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 14:05 Zijun Hu [this message]
2024-09-13 17:39 ` Dmitry Torokhov
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=20240913-fix_have_async-v3-1-793707cfc0d1@quicinc.com \
--to=zijun_hu@icloud.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_zijuhu@quicinc.com \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®