From: Danilo Krummrich <dakr@kernel.org>
To: gregkh@linuxfoundation.org, rafael@kernel.org, ojeda@kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, benno.lossin@proton.me,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
airlied@gmail.com, acourbot@nvidia.com, jhubbard@nvidia.com
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
Danilo Krummrich <dakr@kernel.org>
Subject: [PATCH v3 2/5] driver: core: auxiliary: export auxiliary_bus_type
Date: Wed, 19 Mar 2025 21:33:54 +0100 [thread overview]
Message-ID: <20250319203455.132539-3-dakr@kernel.org> (raw)
In-Reply-To: <20250319203455.132539-1-dakr@kernel.org>
In Rust we can safely derive a struct auxiliary_device pointer from a
generic struct device pointer by checking
dev->bus == auxiliary_bus_type
hence, export auxiliary_bus_type.
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/base/auxiliary.c | 3 ++-
include/linux/auxiliary_bus.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index afa4df4c5a3f..213e26c2747d 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device *dev)
auxdrv->shutdown(auxdev);
}
-static const struct bus_type auxiliary_bus_type = {
+const struct bus_type auxiliary_bus_type = {
.name = "auxiliary",
.probe = auxiliary_bus_probe,
.remove = auxiliary_bus_remove,
@@ -253,6 +253,7 @@ static const struct bus_type auxiliary_bus_type = {
.uevent = auxiliary_uevent,
.pm = &auxiliary_dev_pm_ops,
};
+EXPORT_SYMBOL_GPL(auxiliary_bus_type);
/**
* auxiliary_device_init - check auxiliary_device and initialize
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
index 65dd7f154374..d4ad9233bfd0 100644
--- a/include/linux/auxiliary_bus.h
+++ b/include/linux/auxiliary_bus.h
@@ -197,6 +197,8 @@ struct auxiliary_driver {
const struct auxiliary_device_id *id_table;
};
+extern const struct bus_type auxiliary_bus_type;
+
static inline void *auxiliary_get_drvdata(struct auxiliary_device *auxdev)
{
return dev_get_drvdata(&auxdev->dev);
--
2.48.1
next prev parent reply other threads:[~2025-03-19 20:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 20:33 [PATCH v3 0/5] Auxiliary bus Rust abstractions Danilo Krummrich
2025-03-19 20:33 ` [PATCH v3 1/5] rust: types: add `Opaque::zeroed` Danilo Krummrich
2025-03-20 8:37 ` Alice Ryhl
2025-03-19 20:33 ` Danilo Krummrich [this message]
2025-03-19 20:33 ` [PATCH v3 3/5] rust: auxiliary: add auxiliary device / driver abstractions Danilo Krummrich
2025-03-19 20:33 ` [PATCH v3 4/5] rust: auxiliary: add auxiliary registration Danilo Krummrich
2025-03-19 20:33 ` [PATCH v3 5/5] samples: rust: add Rust auxiliary driver sample Danilo Krummrich
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=20250319203455.132539-3-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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