* [PATCH v2 08/17] efi: stmm: Make use of module_tee_client_driver()
2025-12-15 14:16 [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
@ 2025-12-15 14:16 ` Uwe Kleine-König
2025-12-16 9:20 ` Ilias Apalodimas
2025-12-15 14:16 ` [PATCH v2 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2025-12-15 14:16 UTC (permalink / raw)
To: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Ilias Apalodimas, Jan Kiszka, Uwe Kleine-König
Cc: linux-efi, linux-stm32, op-tee, linux-arm-kernel, linux-kernel
Reduce boilerplate by using the newly introduced module_tee_client_driver().
That takes care of assigning the driver's bus, so the explicit assigning
in this driver can be dropped.
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/efi/stmm/tee_stmm_efi.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
index 65c0fe1ba275..5903811858b6 100644
--- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
+++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
@@ -584,24 +584,12 @@ static struct tee_client_driver tee_stmm_efi_driver = {
.id_table = tee_stmm_efi_id_table,
.driver = {
.name = "tee-stmm-efi",
- .bus = &tee_bus_type,
.probe = tee_stmm_efi_probe,
.remove = tee_stmm_efi_remove,
},
};
-static int __init tee_stmm_efi_mod_init(void)
-{
- return driver_register(&tee_stmm_efi_driver.driver);
-}
-
-static void __exit tee_stmm_efi_mod_exit(void)
-{
- driver_unregister(&tee_stmm_efi_driver.driver);
-}
-
-module_init(tee_stmm_efi_mod_init);
-module_exit(tee_stmm_efi_mod_exit);
+module_tee_client_driver(tee_stmm_efi_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Ilias Apalodimas <ilias.apalodimas@linaro.org>");
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 08/17] efi: stmm: Make use of module_tee_client_driver()
2025-12-15 14:16 ` [PATCH v2 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-16 9:20 ` Ilias Apalodimas
0 siblings, 0 replies; 10+ messages in thread
From: Ilias Apalodimas @ 2025-12-16 9:20 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Jan Kiszka, linux-efi, linux-stm32, op-tee,
linux-arm-kernel, linux-kernel
On Mon, 15 Dec 2025 at 16:17, Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> Reduce boilerplate by using the newly introduced module_tee_client_driver().
> That takes care of assigning the driver's bus, so the explicit assigning
> in this driver can be dropped.
>
> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> drivers/firmware/efi/stmm/tee_stmm_efi.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> index 65c0fe1ba275..5903811858b6 100644
> --- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
> +++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> @@ -584,24 +584,12 @@ static struct tee_client_driver tee_stmm_efi_driver = {
> .id_table = tee_stmm_efi_id_table,
> .driver = {
> .name = "tee-stmm-efi",
> - .bus = &tee_bus_type,
> .probe = tee_stmm_efi_probe,
> .remove = tee_stmm_efi_remove,
> },
> };
>
> -static int __init tee_stmm_efi_mod_init(void)
> -{
> - return driver_register(&tee_stmm_efi_driver.driver);
> -}
> -
> -static void __exit tee_stmm_efi_mod_exit(void)
> -{
> - driver_unregister(&tee_stmm_efi_driver.driver);
> -}
> -
> -module_init(tee_stmm_efi_mod_init);
> -module_exit(tee_stmm_efi_mod_exit);
> +module_tee_client_driver(tee_stmm_efi_driver);
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Ilias Apalodimas <ilias.apalodimas@linaro.org>");
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 09/17] efi: stmm: Make use of tee bus methods
2025-12-15 14:16 [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
2025-12-15 14:16 ` [PATCH v2 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-15 14:16 ` Uwe Kleine-König
2025-12-16 9:19 ` Ilias Apalodimas
2025-12-15 14:16 ` [PATCH v2 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2025-12-15 14:16 UTC (permalink / raw)
To: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Ilias Apalodimas, Jan Kiszka, Uwe Kleine-König
Cc: linux-efi, linux-stm32, op-tee, linux-arm-kernel, linux-kernel
The tee bus got dedicated callbacks for probe and remove.
Make use of these. This fixes a runtime warning about the driver needing
to be converted to the bus methods.
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/efi/stmm/tee_stmm_efi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
index 5903811858b6..7b04dd649629 100644
--- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
+++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
@@ -520,8 +520,9 @@ static void tee_stmm_restore_efivars_generic_ops(void)
efivars_generic_ops_register();
}
-static int tee_stmm_efi_probe(struct device *dev)
+static int tee_stmm_efi_probe(struct tee_client_device *tee_dev)
{
+ struct device *dev = &tee_dev->dev;
struct tee_ioctl_open_session_arg sess_arg;
efi_status_t ret;
int rc;
@@ -571,21 +572,19 @@ static int tee_stmm_efi_probe(struct device *dev)
return 0;
}
-static int tee_stmm_efi_remove(struct device *dev)
+static void tee_stmm_efi_remove(struct tee_client_device *dev)
{
tee_stmm_restore_efivars_generic_ops();
-
- return 0;
}
MODULE_DEVICE_TABLE(tee, tee_stmm_efi_id_table);
static struct tee_client_driver tee_stmm_efi_driver = {
.id_table = tee_stmm_efi_id_table,
+ .probe = tee_stmm_efi_probe,
+ .remove = tee_stmm_efi_remove,
.driver = {
.name = "tee-stmm-efi",
- .probe = tee_stmm_efi_probe,
- .remove = tee_stmm_efi_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 09/17] efi: stmm: Make use of tee bus methods
2025-12-15 14:16 ` [PATCH v2 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-16 9:19 ` Ilias Apalodimas
0 siblings, 0 replies; 10+ messages in thread
From: Ilias Apalodimas @ 2025-12-16 9:19 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Jan Kiszka, linux-efi, linux-stm32, op-tee,
linux-arm-kernel, linux-kernel
On Mon, 15 Dec 2025 at 16:17, Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> The tee bus got dedicated callbacks for probe and remove.
> Make use of these. This fixes a runtime warning about the driver needing
> to be converted to the bus methods.
>
> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> drivers/firmware/efi/stmm/tee_stmm_efi.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> index 5903811858b6..7b04dd649629 100644
> --- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
> +++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> @@ -520,8 +520,9 @@ static void tee_stmm_restore_efivars_generic_ops(void)
> efivars_generic_ops_register();
> }
>
> -static int tee_stmm_efi_probe(struct device *dev)
> +static int tee_stmm_efi_probe(struct tee_client_device *tee_dev)
> {
> + struct device *dev = &tee_dev->dev;
> struct tee_ioctl_open_session_arg sess_arg;
> efi_status_t ret;
> int rc;
> @@ -571,21 +572,19 @@ static int tee_stmm_efi_probe(struct device *dev)
> return 0;
> }
>
> -static int tee_stmm_efi_remove(struct device *dev)
> +static void tee_stmm_efi_remove(struct tee_client_device *dev)
> {
> tee_stmm_restore_efivars_generic_ops();
> -
> - return 0;
> }
>
> MODULE_DEVICE_TABLE(tee, tee_stmm_efi_id_table);
>
> static struct tee_client_driver tee_stmm_efi_driver = {
> .id_table = tee_stmm_efi_id_table,
> + .probe = tee_stmm_efi_probe,
> + .remove = tee_stmm_efi_remove,
> .driver = {
> .name = "tee-stmm-efi",
> - .probe = tee_stmm_efi_probe,
> - .remove = tee_stmm_efi_remove,
> },
> };
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver()
2025-12-15 14:16 [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
2025-12-15 14:16 ` [PATCH v2 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-15 14:16 ` [PATCH v2 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 14:16 ` Uwe Kleine-König
2025-12-15 14:16 ` [PATCH v2 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
2025-12-18 7:21 ` [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Jens Wiklander
4 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2025-12-15 14:16 UTC (permalink / raw)
To: Jens Wiklander, Sudeep Holla, Sumit Garg, Uwe Kleine-König,
Christophe JAILLET
Cc: Cristian Marussi, arm-scmi, linux-arm-kernel, op-tee,
linux-kernel
Reduce boilerplate by using the newly introduced module_tee_client_driver().
That takes care of assigning the driver's bus, so the explicit assigning
in this driver can be dropped.
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/arm_scmi/transports/optee.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/firmware/arm_scmi/transports/optee.c b/drivers/firmware/arm_scmi/transports/optee.c
index dc0f46340153..8fdb80d3fabd 100644
--- a/drivers/firmware/arm_scmi/transports/optee.c
+++ b/drivers/firmware/arm_scmi/transports/optee.c
@@ -612,23 +612,12 @@ static struct tee_client_driver scmi_optee_service_driver = {
.id_table = scmi_optee_service_id,
.driver = {
.name = "scmi-optee",
- .bus = &tee_bus_type,
.probe = scmi_optee_service_probe,
.remove = scmi_optee_service_remove,
},
};
-static int __init scmi_transport_optee_init(void)
-{
- return driver_register(&scmi_optee_service_driver.driver);
-}
-module_init(scmi_transport_optee_init);
-
-static void __exit scmi_transport_optee_exit(void)
-{
- driver_unregister(&scmi_optee_service_driver.driver);
-}
-module_exit(scmi_transport_optee_exit);
+module_tee_client_driver(scmi_optee_service_driver);
MODULE_AUTHOR("Etienne Carriere <etienne.carriere@foss.st.com>");
MODULE_DESCRIPTION("SCMI OPTEE Transport driver");
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 11/17] firmware: arm_scmi: Make use of tee bus methods
2025-12-15 14:16 [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (2 preceding siblings ...)
2025-12-15 14:16 ` [PATCH v2 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-15 14:16 ` Uwe Kleine-König
2025-12-18 7:21 ` [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Jens Wiklander
4 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2025-12-15 14:16 UTC (permalink / raw)
To: Jens Wiklander, Sudeep Holla, Sumit Garg, Uwe Kleine-König,
Christophe JAILLET
Cc: Cristian Marussi, arm-scmi, linux-arm-kernel, op-tee,
linux-kernel
The tee bus got dedicated callbacks for probe and remove.
Make use of these. This fixes a runtime warning about the driver needing
to be converted to the bus methods. Note that the return value of .remove()
was already ignored before, so there is no problem introduced by dropping
the error returns.
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/arm_scmi/transports/optee.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/firmware/arm_scmi/transports/optee.c b/drivers/firmware/arm_scmi/transports/optee.c
index 8fdb80d3fabd..07ae18d5279d 100644
--- a/drivers/firmware/arm_scmi/transports/optee.c
+++ b/drivers/firmware/arm_scmi/transports/optee.c
@@ -529,8 +529,9 @@ static const struct of_device_id scmi_of_match[] = {
DEFINE_SCMI_TRANSPORT_DRIVER(scmi_optee, scmi_optee_driver, scmi_optee_desc,
scmi_of_match, core);
-static int scmi_optee_service_probe(struct device *dev)
+static int scmi_optee_service_probe(struct tee_client_device *scmi_pta)
{
+ struct device *dev = &scmi_pta->dev;
struct scmi_optee_agent *agent;
struct tee_context *tee_ctx;
int ret;
@@ -578,24 +579,22 @@ static int scmi_optee_service_probe(struct device *dev)
return ret;
}
-static int scmi_optee_service_remove(struct device *dev)
+static void scmi_optee_service_remove(struct tee_client_device *scmi_pta)
{
struct scmi_optee_agent *agent = scmi_optee_private;
if (!scmi_optee_private)
- return -EINVAL;
+ return;
platform_driver_unregister(&scmi_optee_driver);
if (!list_empty(&scmi_optee_private->channel_list))
- return -EBUSY;
+ return;
/* Ensure cleared reference is visible before resources are released */
smp_store_mb(scmi_optee_private, NULL);
tee_client_close_context(agent->tee_ctx);
-
- return 0;
}
static const struct tee_client_device_id scmi_optee_service_id[] = {
@@ -609,11 +608,11 @@ static const struct tee_client_device_id scmi_optee_service_id[] = {
MODULE_DEVICE_TABLE(tee, scmi_optee_service_id);
static struct tee_client_driver scmi_optee_service_driver = {
- .id_table = scmi_optee_service_id,
- .driver = {
+ .probe = scmi_optee_service_probe,
+ .remove = scmi_optee_service_remove,
+ .id_table = scmi_optee_service_id,
+ .driver = {
.name = "scmi-optee",
- .probe = scmi_optee_service_probe,
- .remove = scmi_optee_service_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks
2025-12-15 14:16 [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (3 preceding siblings ...)
2025-12-15 14:16 ` [PATCH v2 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-18 7:21 ` Jens Wiklander
2025-12-18 13:53 ` Alexandre Belloni
4 siblings, 1 reply; 10+ messages in thread
From: Jens Wiklander @ 2025-12-18 7:21 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Corbet, Sumit Garg, Olivia Mackall, Herbert Xu,
Clément Léger, Alexandre Belloni, Ard Biesheuvel,
Maxime Coquelin, Alexandre Torgue, Sumit Garg, Ilias Apalodimas,
Jan Kiszka, Sudeep Holla, Christophe JAILLET,
Rafał Miłecki, Michael Chan, Pavan Chebbi,
James Bottomley, Jarkko Sakkinen, Mimi Zohar, David Howells,
Paul Moore, James Morris, Serge E. Hallyn, Peter Huewe, op-tee,
linux-kernel, linux-doc, linux-crypto, linux-rtc, linux-efi,
linux-stm32, linux-arm-kernel, Cristian Marussi, arm-scmi,
linux-mips, netdev, linux-integrity, keyrings,
linux-security-module, Jason Gunthorpe
Hi,
On Mon, Dec 15, 2025 at 3:17 PM Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> Hello,
>
> the objective of this series is to make tee driver stop using callbacks
> in struct device_driver. These were superseded by bus methods in 2006
> (commit 594c8281f905 ("[PATCH] Add bus_type probe, remove, shutdown
> methods.")) but nobody cared to convert all subsystems accordingly.
>
> Here the tee drivers are converted. The first commit is somewhat
> unrelated, but simplifies the conversion (and the drivers). It
> introduces driver registration helpers that care about setting the bus
> and owner. (The latter is missing in all drivers, so by using these
> helpers the drivers become more correct.)
>
> v1 of this series is available at
> https://lore.kernel.org/all/cover.1765472125.git.u.kleine-koenig@baylibre.com
>
> Changes since v1:
>
> - rebase to v6.19-rc1 (no conflicts)
> - add tags received so far
> - fix whitespace issues pointed out by Sumit Garg
> - fix shutdown callback to shutdown and not remove
>
> As already noted in v1's cover letter, this series should go in during a
> single merge window as there are runtime warnings when the series is
> only applied partially. Sumit Garg suggested to apply the whole series
> via Jens Wiklander's tree.
> If this is done the dependencies in this series are honored, in case the
> plan changes: Patches #4 - #17 depend on the first two.
>
> Note this series is only build tested.
>
> Uwe Kleine-König (17):
> tee: Add some helpers to reduce boilerplate for tee client drivers
> tee: Add probe, remove and shutdown bus callbacks to tee_client_driver
> tee: Adapt documentation to cover recent additions
> hwrng: optee - Make use of module_tee_client_driver()
> hwrng: optee - Make use of tee bus methods
> rtc: optee: Migrate to use tee specific driver registration function
> rtc: optee: Make use of tee bus methods
> efi: stmm: Make use of module_tee_client_driver()
> efi: stmm: Make use of tee bus methods
> firmware: arm_scmi: optee: Make use of module_tee_client_driver()
> firmware: arm_scmi: Make use of tee bus methods
> firmware: tee_bnxt: Make use of module_tee_client_driver()
> firmware: tee_bnxt: Make use of tee bus methods
> KEYS: trusted: Migrate to use tee specific driver registration
> function
> KEYS: trusted: Make use of tee bus methods
> tpm/tpm_ftpm_tee: Make use of tee specific driver registration
> tpm/tpm_ftpm_tee: Make use of tee bus methods
>
> Documentation/driver-api/tee.rst | 18 +----
> drivers/char/hw_random/optee-rng.c | 26 ++----
> drivers/char/tpm/tpm_ftpm_tee.c | 31 +++++---
> drivers/firmware/arm_scmi/transports/optee.c | 32 +++-----
> drivers/firmware/broadcom/tee_bnxt_fw.c | 30 ++-----
> drivers/firmware/efi/stmm/tee_stmm_efi.c | 25 ++----
> drivers/rtc/rtc-optee.c | 27 ++-----
> drivers/tee/tee_core.c | 84 ++++++++++++++++++++
> include/linux/tee_drv.h | 12 +++
> security/keys/trusted-keys/trusted_tee.c | 17 ++--
> 10 files changed, 164 insertions(+), 138 deletions(-)
>
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> --
> 2.47.3
>
Thank you for the nice cleanup, Uwe.
I've applied patch 1-3 to the branch tee_bus_callback_for_6.20 in my
tree at https://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee.git/
The branch is based on v6.19-rc1, and I'll try to keep it stable for
others to depend on, if needed. Let's see if we can agree on taking
the remaining patches via that branch.
Cheers,
Jens
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks
2025-12-18 7:21 ` [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks Jens Wiklander
@ 2025-12-18 13:53 ` Alexandre Belloni
2025-12-18 16:29 ` Jens Wiklander
0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2025-12-18 13:53 UTC (permalink / raw)
To: Jens Wiklander
Cc: Uwe Kleine-König, Jonathan Corbet, Sumit Garg,
Olivia Mackall, Herbert Xu, Clément Léger,
Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue, Sumit Garg,
Ilias Apalodimas, Jan Kiszka, Sudeep Holla, Christophe JAILLET,
Rafał Miłecki, Michael Chan, Pavan Chebbi,
James Bottomley, Jarkko Sakkinen, Mimi Zohar, David Howells,
Paul Moore, James Morris, Serge E. Hallyn, Peter Huewe, op-tee,
linux-kernel, linux-doc, linux-crypto, linux-rtc, linux-efi,
linux-stm32, linux-arm-kernel, Cristian Marussi, arm-scmi,
linux-mips, netdev, linux-integrity, keyrings,
linux-security-module, Jason Gunthorpe
On 18/12/2025 08:21:27+0100, Jens Wiklander wrote:
> Hi,
>
> On Mon, Dec 15, 2025 at 3:17 PM Uwe Kleine-König
> <u.kleine-koenig@baylibre.com> wrote:
> >
> > Hello,
> >
> > the objective of this series is to make tee driver stop using callbacks
> > in struct device_driver. These were superseded by bus methods in 2006
> > (commit 594c8281f905 ("[PATCH] Add bus_type probe, remove, shutdown
> > methods.")) but nobody cared to convert all subsystems accordingly.
> >
> > Here the tee drivers are converted. The first commit is somewhat
> > unrelated, but simplifies the conversion (and the drivers). It
> > introduces driver registration helpers that care about setting the bus
> > and owner. (The latter is missing in all drivers, so by using these
> > helpers the drivers become more correct.)
> >
> > v1 of this series is available at
> > https://lore.kernel.org/all/cover.1765472125.git.u.kleine-koenig@baylibre.com
> >
> > Changes since v1:
> >
> > - rebase to v6.19-rc1 (no conflicts)
> > - add tags received so far
> > - fix whitespace issues pointed out by Sumit Garg
> > - fix shutdown callback to shutdown and not remove
> >
> > As already noted in v1's cover letter, this series should go in during a
> > single merge window as there are runtime warnings when the series is
> > only applied partially. Sumit Garg suggested to apply the whole series
> > via Jens Wiklander's tree.
> > If this is done the dependencies in this series are honored, in case the
> > plan changes: Patches #4 - #17 depend on the first two.
> >
> > Note this series is only build tested.
> >
> > Uwe Kleine-König (17):
> > tee: Add some helpers to reduce boilerplate for tee client drivers
> > tee: Add probe, remove and shutdown bus callbacks to tee_client_driver
> > tee: Adapt documentation to cover recent additions
> > hwrng: optee - Make use of module_tee_client_driver()
> > hwrng: optee - Make use of tee bus methods
> > rtc: optee: Migrate to use tee specific driver registration function
> > rtc: optee: Make use of tee bus methods
> > efi: stmm: Make use of module_tee_client_driver()
> > efi: stmm: Make use of tee bus methods
> > firmware: arm_scmi: optee: Make use of module_tee_client_driver()
> > firmware: arm_scmi: Make use of tee bus methods
> > firmware: tee_bnxt: Make use of module_tee_client_driver()
> > firmware: tee_bnxt: Make use of tee bus methods
> > KEYS: trusted: Migrate to use tee specific driver registration
> > function
> > KEYS: trusted: Make use of tee bus methods
> > tpm/tpm_ftpm_tee: Make use of tee specific driver registration
> > tpm/tpm_ftpm_tee: Make use of tee bus methods
> >
> > Documentation/driver-api/tee.rst | 18 +----
> > drivers/char/hw_random/optee-rng.c | 26 ++----
> > drivers/char/tpm/tpm_ftpm_tee.c | 31 +++++---
> > drivers/firmware/arm_scmi/transports/optee.c | 32 +++-----
> > drivers/firmware/broadcom/tee_bnxt_fw.c | 30 ++-----
> > drivers/firmware/efi/stmm/tee_stmm_efi.c | 25 ++----
> > drivers/rtc/rtc-optee.c | 27 ++-----
> > drivers/tee/tee_core.c | 84 ++++++++++++++++++++
> > include/linux/tee_drv.h | 12 +++
> > security/keys/trusted-keys/trusted_tee.c | 17 ++--
> > 10 files changed, 164 insertions(+), 138 deletions(-)
> >
> > base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> > --
> > 2.47.3
> >
>
> Thank you for the nice cleanup, Uwe.
>
> I've applied patch 1-3 to the branch tee_bus_callback_for_6.20 in my
> tree at https://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee.git/
>
> The branch is based on v6.19-rc1, and I'll try to keep it stable for
> others to depend on, if needed. Let's see if we can agree on taking
> the remaining patches via that branch.
6 and 7 can go through your branch.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 00/17] tee: Use bus callbacks instead of driver callbacks
2025-12-18 13:53 ` Alexandre Belloni
@ 2025-12-18 16:29 ` Jens Wiklander
0 siblings, 0 replies; 10+ messages in thread
From: Jens Wiklander @ 2025-12-18 16:29 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Uwe Kleine-König, Jonathan Corbet, Sumit Garg,
Olivia Mackall, Herbert Xu, Clément Léger,
Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue, Sumit Garg,
Ilias Apalodimas, Jan Kiszka, Sudeep Holla, Christophe JAILLET,
Rafał Miłecki, Michael Chan, Pavan Chebbi,
James Bottomley, Jarkko Sakkinen, Mimi Zohar, David Howells,
Paul Moore, James Morris, Serge E. Hallyn, Peter Huewe, op-tee,
linux-kernel, linux-doc, linux-crypto, linux-rtc, linux-efi,
linux-stm32, linux-arm-kernel, Cristian Marussi, arm-scmi,
linux-mips, netdev, linux-integrity, keyrings,
linux-security-module, Jason Gunthorpe
On Thu, Dec 18, 2025 at 2:53 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> On 18/12/2025 08:21:27+0100, Jens Wiklander wrote:
> > Hi,
> >
> > On Mon, Dec 15, 2025 at 3:17 PM Uwe Kleine-König
> > <u.kleine-koenig@baylibre.com> wrote:
> > >
> > > Hello,
> > >
> > > the objective of this series is to make tee driver stop using callbacks
> > > in struct device_driver. These were superseded by bus methods in 2006
> > > (commit 594c8281f905 ("[PATCH] Add bus_type probe, remove, shutdown
> > > methods.")) but nobody cared to convert all subsystems accordingly.
> > >
> > > Here the tee drivers are converted. The first commit is somewhat
> > > unrelated, but simplifies the conversion (and the drivers). It
> > > introduces driver registration helpers that care about setting the bus
> > > and owner. (The latter is missing in all drivers, so by using these
> > > helpers the drivers become more correct.)
> > >
> > > v1 of this series is available at
> > > https://lore.kernel.org/all/cover.1765472125.git.u.kleine-koenig@baylibre.com
> > >
> > > Changes since v1:
> > >
> > > - rebase to v6.19-rc1 (no conflicts)
> > > - add tags received so far
> > > - fix whitespace issues pointed out by Sumit Garg
> > > - fix shutdown callback to shutdown and not remove
> > >
> > > As already noted in v1's cover letter, this series should go in during a
> > > single merge window as there are runtime warnings when the series is
> > > only applied partially. Sumit Garg suggested to apply the whole series
> > > via Jens Wiklander's tree.
> > > If this is done the dependencies in this series are honored, in case the
> > > plan changes: Patches #4 - #17 depend on the first two.
> > >
> > > Note this series is only build tested.
> > >
> > > Uwe Kleine-König (17):
> > > tee: Add some helpers to reduce boilerplate for tee client drivers
> > > tee: Add probe, remove and shutdown bus callbacks to tee_client_driver
> > > tee: Adapt documentation to cover recent additions
> > > hwrng: optee - Make use of module_tee_client_driver()
> > > hwrng: optee - Make use of tee bus methods
> > > rtc: optee: Migrate to use tee specific driver registration function
> > > rtc: optee: Make use of tee bus methods
> > > efi: stmm: Make use of module_tee_client_driver()
> > > efi: stmm: Make use of tee bus methods
> > > firmware: arm_scmi: optee: Make use of module_tee_client_driver()
> > > firmware: arm_scmi: Make use of tee bus methods
> > > firmware: tee_bnxt: Make use of module_tee_client_driver()
> > > firmware: tee_bnxt: Make use of tee bus methods
> > > KEYS: trusted: Migrate to use tee specific driver registration
> > > function
> > > KEYS: trusted: Make use of tee bus methods
> > > tpm/tpm_ftpm_tee: Make use of tee specific driver registration
> > > tpm/tpm_ftpm_tee: Make use of tee bus methods
> > >
> > > Documentation/driver-api/tee.rst | 18 +----
> > > drivers/char/hw_random/optee-rng.c | 26 ++----
> > > drivers/char/tpm/tpm_ftpm_tee.c | 31 +++++---
> > > drivers/firmware/arm_scmi/transports/optee.c | 32 +++-----
> > > drivers/firmware/broadcom/tee_bnxt_fw.c | 30 ++-----
> > > drivers/firmware/efi/stmm/tee_stmm_efi.c | 25 ++----
> > > drivers/rtc/rtc-optee.c | 27 ++-----
> > > drivers/tee/tee_core.c | 84 ++++++++++++++++++++
> > > include/linux/tee_drv.h | 12 +++
> > > security/keys/trusted-keys/trusted_tee.c | 17 ++--
> > > 10 files changed, 164 insertions(+), 138 deletions(-)
> > >
> > > base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> > > --
> > > 2.47.3
> > >
> >
> > Thank you for the nice cleanup, Uwe.
> >
> > I've applied patch 1-3 to the branch tee_bus_callback_for_6.20 in my
> > tree at https://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee.git/
> >
> > The branch is based on v6.19-rc1, and I'll try to keep it stable for
> > others to depend on, if needed. Let's see if we can agree on taking
> > the remaining patches via that branch.
>
> 6 and 7 can go through your branch.
Good, I've added them to my branch now.
Thanks,
Jens
^ permalink raw reply [flat|nested] 10+ messages in thread