* [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks
@ 2025-12-11 17:14 Uwe Kleine-König
2025-12-11 17:14 ` [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers Uwe Kleine-König
` (16 more replies)
0 siblings, 17 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander, 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, Michael Chan,
Pavan Chebbi, Rafał Miłecki, James Bottomley,
Jarkko Sakkinen, Mimi Zohar, David Howells, Paul Moore,
James Morris, Serge E. Hallyn, Peter Huewe
Cc: op-tee, linux-kernel, linux-crypto, linux-rtc, linux-efi,
linux-stm32, linux-arm-kernel, Cristian Marussi, arm-scmi, netdev,
linux-mips, linux-integrity, keyrings, linux-security-module,
Jason Gunthorpe
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.)
The patches #4 - #17 depend on the first two, so if they should be
applied to their respective subsystem trees these must contain the first
two patches first.
Note that after patch #2 is applied, unconverted drivers provoke a
warning in driver_register(), so it would be good for the user
experience if the whole series goes in during a single merge window. So
I guess an immutable branch containing the frist three patches that can
be merged into the other subsystem trees would be sensible.
After all patches are applied, tee_bus_type can be made private to
drivers/tee as it's not used in other places any more.
Best regards
Uwe
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: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
--
2.47.3
^ permalink raw reply [flat|nested] 41+ messages in thread
* [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
@ 2025-12-11 17:14 ` Uwe Kleine-König
2025-12-15 7:05 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver Uwe Kleine-König
` (15 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander; +Cc: Sumit Garg, op-tee, linux-kernel
Similar to platform drivers (and others) create dedicated register and
unregister functions and a macro to simplify modules that only need to
handle driver registration in their init and exit handlers.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/tee/tee_core.c | 16 ++++++++++++++++
include/linux/tee_drv.h | 9 +++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index d65d47cc154e..51379f7fc5d5 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -1405,6 +1405,22 @@ const struct bus_type tee_bus_type = {
};
EXPORT_SYMBOL_GPL(tee_bus_type);
+int __tee_client_driver_register(struct tee_client_driver *tee_driver,
+ struct module *owner)
+{
+ tee_driver->driver.owner = owner;
+ tee_driver->driver.bus = &tee_bus_type;
+
+ return driver_register(&tee_driver->driver);
+}
+EXPORT_SYMBOL_GPL(__tee_client_driver_register);
+
+void tee_client_driver_unregister(struct tee_client_driver *tee_driver)
+{
+ driver_unregister(&tee_driver->driver);
+}
+EXPORT_SYMBOL_GPL(tee_client_driver_unregister);
+
static int __init tee_init(void)
{
int rc;
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 88a6f9697c89..850c03b2cdea 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -322,4 +322,13 @@ struct tee_client_driver {
#define to_tee_client_driver(d) \
container_of_const(d, struct tee_client_driver, driver)
+#define tee_client_driver_register(drv) \
+ __tee_client_driver_register(drv, THIS_MODULE)
+int __tee_client_driver_register(struct tee_client_driver *, struct module *);
+void tee_client_driver_unregister(struct tee_client_driver *);
+
+#define module_tee_client_driver(__tee_client_driver) \
+ module_driver(__tee_client_driver, tee_client_driver_register, \
+ tee_client_driver_unregister)
+
#endif /*__TEE_DRV_H*/
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
2025-12-11 17:14 ` [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers Uwe Kleine-König
@ 2025-12-11 17:14 ` Uwe Kleine-König
2025-12-15 7:23 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 03/17] tee: Adapt documentation to cover recent additions Uwe Kleine-König
` (14 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander; +Cc: Sumit Garg, op-tee, linux-kernel
Introduce a bus specific probe, remove and shutdown function. For now
this only allows to get rid of a cast of the generic device to a
tee_client device in the drivers and changes the remove prototype to
return void---a non-zero return value is ignored anyhow.
The objective is to get rid of users of struct device_driver callbacks
.probe(), .remove() and .shutdown() to eventually remove these. Until
all tee_client drivers are converted this results in a runtime warning
about the drivers needing an update because there is a bus probe
function and a driver probe function.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/tee/tee_core.c | 68 +++++++++++++++++++++++++++++++++++++++++
include/linux/tee_drv.h | 3 ++
2 files changed, 71 insertions(+)
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 51379f7fc5d5..89164d35fc5c 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -1398,19 +1398,87 @@ static int tee_client_device_uevent(const struct device *dev,
return add_uevent_var(env, "MODALIAS=tee:%pUb", dev_id);
}
+static int tee_client_device_probe(struct device *dev)
+{
+ struct tee_client_device *tcdev= to_tee_client_device(dev);
+ struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
+
+ if (drv->probe)
+ return drv->probe(tcdev);
+ else
+ return 0;
+}
+
+static void tee_client_device_remove(struct device *dev)
+{
+ struct tee_client_device *tcdev= to_tee_client_device(dev);
+ struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
+
+ if (drv->remove)
+ drv->remove(tcdev);
+}
+
+static void tee_client_device_shutdown(struct device *dev)
+{
+ struct tee_client_device *tcdev= to_tee_client_device(dev);
+ struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
+
+ if (dev->driver && drv->remove)
+ drv->remove(tcdev);
+}
+
const struct bus_type tee_bus_type = {
.name = "tee",
.match = tee_client_device_match,
.uevent = tee_client_device_uevent,
+ .probe = tee_client_device_probe,
+ .remove = tee_client_device_remove,
+ .shutdown = tee_client_device_shutdown,
};
EXPORT_SYMBOL_GPL(tee_bus_type);
+static int tee_client_device_probe_legacy(struct tee_client_device *tcdev)
+{
+ struct device *dev = &tcdev->dev;
+ struct device_driver *driver = dev->driver;
+
+ return driver->probe(dev);
+}
+
+static void tee_client_device_remove_legacy(struct tee_client_device *tcdev)
+{
+ struct device *dev = &tcdev->dev;
+ struct device_driver *driver = dev->driver;
+
+ driver->remove(dev);
+}
+
+static void tee_client_device_shutdown_legacy(struct tee_client_device *tcdev)
+{
+ struct device *dev = &tcdev->dev;
+ struct device_driver *driver = dev->driver;
+
+ driver->shutdown(dev);
+}
+
int __tee_client_driver_register(struct tee_client_driver *tee_driver,
struct module *owner)
{
tee_driver->driver.owner = owner;
tee_driver->driver.bus = &tee_bus_type;
+ /*
+ * Drivers that have callbacks set for tee_driver->driver need updating
+ * to use the callbacks in tee_driver instead. driver_register() warns
+ * about that, so no need to warn here, too.
+ */
+ if (!tee_driver->probe && tee_driver->driver.probe)
+ tee_driver->probe = tee_client_device_probe_legacy;
+ if (!tee_driver->remove && tee_driver->driver.remove)
+ tee_driver->remove= tee_client_device_remove_legacy;
+ if (!tee_driver->shutdown && tee_driver->driver.probe)
+ tee_driver->shutdown = tee_client_device_shutdown_legacy;
+
return driver_register(&tee_driver->driver);
}
EXPORT_SYMBOL_GPL(__tee_client_driver_register);
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 850c03b2cdea..e561a26f537a 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -315,6 +315,9 @@ struct tee_client_device {
* @driver: driver structure
*/
struct tee_client_driver {
+ int (*probe)(struct tee_client_device *);
+ void (*remove)(struct tee_client_device *);
+ void (*shutdown)(struct tee_client_device *);
const struct tee_client_device_id *id_table;
struct device_driver driver;
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 03/17] tee: Adapt documentation to cover recent additions
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
2025-12-11 17:14 ` [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers Uwe Kleine-König
2025-12-11 17:14 ` [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver Uwe Kleine-König
@ 2025-12-11 17:14 ` Uwe Kleine-König
2025-12-15 7:24 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver() Uwe Kleine-König
` (13 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander; +Cc: Sumit Garg, op-tee, linux-kernel
The previous commits introduced some helpers to reduce boilerplate
and bus specific callbacks for probe and remove.
Adapt the reference example to make use of these.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Documentation/driver-api/tee.rst | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/Documentation/driver-api/tee.rst b/Documentation/driver-api/tee.rst
index 5eaeb8103988..4d58ac0712c1 100644
--- a/Documentation/driver-api/tee.rst
+++ b/Documentation/driver-api/tee.rst
@@ -43,24 +43,12 @@ snippet would look like::
MODULE_DEVICE_TABLE(tee, client_id_table);
static struct tee_client_driver client_driver = {
+ .probe = client_probe,
+ .remove = client_remove,
.id_table = client_id_table,
.driver = {
.name = DRIVER_NAME,
- .bus = &tee_bus_type,
- .probe = client_probe,
- .remove = client_remove,
},
};
- static int __init client_init(void)
- {
- return driver_register(&client_driver.driver);
- }
-
- static void __exit client_exit(void)
- {
- driver_unregister(&client_driver.driver);
- }
-
- module_init(client_init);
- module_exit(client_exit);
+ module_tee_client_driver(client_driver);
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver()
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (2 preceding siblings ...)
2025-12-11 17:14 ` [PATCH v1 03/17] tee: Adapt documentation to cover recent additions Uwe Kleine-König
@ 2025-12-11 17:14 ` Uwe Kleine-König
2025-12-15 7:26 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods Uwe Kleine-König
` (12 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander, Sumit Garg, Olivia Mackall, Herbert Xu
Cc: op-tee, linux-crypto, 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/char/hw_random/optee-rng.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index 96b5d546d136..6ee748c0cf57 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -281,24 +281,12 @@ static struct tee_client_driver optee_rng_driver = {
.id_table = optee_rng_id_table,
.driver = {
.name = DRIVER_NAME,
- .bus = &tee_bus_type,
.probe = optee_rng_probe,
.remove = optee_rng_remove,
},
};
-static int __init optee_rng_mod_init(void)
-{
- return driver_register(&optee_rng_driver.driver);
-}
-
-static void __exit optee_rng_mod_exit(void)
-{
- driver_unregister(&optee_rng_driver.driver);
-}
-
-module_init(optee_rng_mod_init);
-module_exit(optee_rng_mod_exit);
+module_tee_client_driver(optee_rng_driver);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Sumit Garg <sumit.garg@linaro.org>");
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (3 preceding siblings ...)
2025-12-11 17:14 ` [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-11 17:14 ` Uwe Kleine-König
2025-12-15 7:27 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function Uwe Kleine-König
` (11 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:14 UTC (permalink / raw)
To: Jens Wiklander, Sumit Garg, Olivia Mackall, Herbert Xu
Cc: op-tee, linux-crypto, 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/char/hw_random/optee-rng.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index 6ee748c0cf57..5a3fa0b38497 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -211,9 +211,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
return 0;
}
-static int optee_rng_probe(struct device *dev)
+static int optee_rng_probe(struct tee_client_device *rng_device)
{
- struct tee_client_device *rng_device = to_tee_client_device(dev);
+ struct device *dev = &rng_device->dev;
int ret = 0, err = -ENODEV;
struct tee_ioctl_open_session_arg sess_arg;
@@ -261,12 +261,10 @@ static int optee_rng_probe(struct device *dev)
return err;
}
-static int optee_rng_remove(struct device *dev)
+static void optee_rng_remove(struct tee_client_device *tee_dev)
{
tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
tee_client_close_context(pvt_data.ctx);
-
- return 0;
}
static const struct tee_client_device_id optee_rng_id_table[] = {
@@ -278,11 +276,11 @@ static const struct tee_client_device_id optee_rng_id_table[] = {
MODULE_DEVICE_TABLE(tee, optee_rng_id_table);
static struct tee_client_driver optee_rng_driver = {
+ .probe = optee_rng_probe,
+ .remove = optee_rng_remove,
.id_table = optee_rng_id_table,
.driver = {
.name = DRIVER_NAME,
- .probe = optee_rng_probe,
- .remove = optee_rng_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (4 preceding siblings ...)
2025-12-11 17:14 ` [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:28 ` Sumit Garg via OP-TEE
2025-12-15 10:41 ` Alexandre Belloni via OP-TEE
2025-12-11 17:15 ` [PATCH v1 07/17] rtc: optee: Make use of tee bus methods Uwe Kleine-König
` (10 subsequent siblings)
16 siblings, 2 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Clément Léger, Alexandre Belloni
Cc: Sumit Garg, op-tee, linux-rtc, linux-kernel
The tee subsystem recently got a set of dedicated functions to register
(and unregister) a tee driver. Make use of them. These care for setting the
driver's bus (so the explicit assignment can be dropped) and the driver
owner (which is an improvement this driver benefits from).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/rtc/rtc-optee.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
index 184c6d142801..f924a729ead0 100644
--- a/drivers/rtc/rtc-optee.c
+++ b/drivers/rtc/rtc-optee.c
@@ -726,25 +726,13 @@ static struct tee_client_driver optee_rtc_driver = {
.id_table = optee_rtc_id_table,
.driver = {
.name = "optee_rtc",
- .bus = &tee_bus_type,
.probe = optee_rtc_probe,
.remove = optee_rtc_remove,
.pm = pm_sleep_ptr(&optee_rtc_pm_ops),
},
};
-static int __init optee_rtc_mod_init(void)
-{
- return driver_register(&optee_rtc_driver.driver);
-}
-
-static void __exit optee_rtc_mod_exit(void)
-{
- driver_unregister(&optee_rtc_driver.driver);
-}
-
-module_init(optee_rtc_mod_init);
-module_exit(optee_rtc_mod_exit);
+module_tee_client_driver(optee_rtc_driver);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Clément Léger <clement.leger@bootlin.com>");
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 07/17] rtc: optee: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (5 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:30 ` Sumit Garg via OP-TEE
2025-12-15 10:42 ` Alexandre Belloni via OP-TEE
2025-12-11 17:15 ` [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
` (9 subsequent siblings)
16 siblings, 2 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Clément Léger, Alexandre Belloni
Cc: Sumit Garg, op-tee, linux-rtc, 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/rtc/rtc-optee.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
index f924a729ead0..eefde789d194 100644
--- a/drivers/rtc/rtc-optee.c
+++ b/drivers/rtc/rtc-optee.c
@@ -547,9 +547,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
return 0;
}
-static int optee_rtc_probe(struct device *dev)
+static int optee_rtc_probe(struct tee_client_device *rtc_device)
{
- struct tee_client_device *rtc_device = to_tee_client_device(dev);
+ struct device *dev = &rtc_device->dev;
struct tee_ioctl_open_session_arg sess2_arg = {0};
struct tee_ioctl_open_session_arg sess_arg = {0};
struct optee_rtc *priv;
@@ -682,8 +682,9 @@ static int optee_rtc_probe(struct device *dev)
return err;
}
-static int optee_rtc_remove(struct device *dev)
+static void optee_rtc_remove(struct tee_client_device *rtc_device)
{
+ struct device *dev = &rtc_device->dev;
struct optee_rtc *priv = dev_get_drvdata(dev);
if (priv->features & TA_RTC_FEATURE_ALARM) {
@@ -696,8 +697,6 @@ static int optee_rtc_remove(struct device *dev)
tee_shm_free(priv->shm);
tee_client_close_session(priv->ctx, priv->session_id);
tee_client_close_context(priv->ctx);
-
- return 0;
}
static int optee_rtc_suspend(struct device *dev)
@@ -724,10 +723,10 @@ MODULE_DEVICE_TABLE(tee, optee_rtc_id_table);
static struct tee_client_driver optee_rtc_driver = {
.id_table = optee_rtc_id_table,
+ .probe = optee_rtc_probe,
+ .remove = optee_rtc_remove,
.driver = {
.name = "optee_rtc",
- .probe = optee_rtc_probe,
- .remove = optee_rtc_remove,
.pm = pm_sleep_ptr(&optee_rtc_pm_ops),
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver()
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (6 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 07/17] rtc: optee: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:55 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
` (8 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Ilias Apalodimas, Jan Kiszka
Cc: op-tee, linux-efi, linux-stm32, 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.
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] 41+ messages in thread
* [PATCH v1 09/17] efi: stmm: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (7 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:55 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
` (7 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue,
Sumit Garg, Ilias Apalodimas, Jan Kiszka
Cc: op-tee, linux-efi, linux-stm32, 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.
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] 41+ messages in thread
* [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver()
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (8 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-12 12:33 ` Sudeep Holla
2025-12-15 7:30 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
` (6 subsequent siblings)
16 siblings, 2 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Sudeep Holla, Christophe JAILLET
Cc: Cristian Marussi, Sumit Garg, op-tee, arm-scmi, 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.
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] 41+ messages in thread
* [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (9 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-12 12:34 ` Sudeep Holla
2025-12-15 7:32 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver() Uwe Kleine-König
` (5 subsequent siblings)
16 siblings, 2 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Sudeep Holla, Christophe JAILLET
Cc: Cristian Marussi, Sumit Garg, op-tee, arm-scmi, 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. Note that the return value of .remove()
was already ignored before, so there is no problem introduced by dropping
the error returns.
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] 41+ messages in thread
* [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver()
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (10 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:33 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods Uwe Kleine-König
` (4 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Michael Chan, Pavan Chebbi,
Rafał Miłecki
Cc: Sumit Garg, op-tee, netdev, linux-mips, 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/broadcom/tee_bnxt_fw.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c b/drivers/firmware/broadcom/tee_bnxt_fw.c
index 40e3183a3d11..fbdf1aa97c82 100644
--- a/drivers/firmware/broadcom/tee_bnxt_fw.c
+++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
@@ -261,25 +261,13 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
.id_table = tee_bnxt_fw_id_table,
.driver = {
.name = KBUILD_MODNAME,
- .bus = &tee_bus_type,
.probe = tee_bnxt_fw_probe,
.remove = tee_bnxt_fw_remove,
.shutdown = tee_bnxt_fw_shutdown,
},
};
-static int __init tee_bnxt_fw_mod_init(void)
-{
- return driver_register(&tee_bnxt_fw_driver.driver);
-}
-
-static void __exit tee_bnxt_fw_mod_exit(void)
-{
- driver_unregister(&tee_bnxt_fw_driver.driver);
-}
-
-module_init(tee_bnxt_fw_mod_init);
-module_exit(tee_bnxt_fw_mod_exit);
+module_tee_client_driver(tee_bnxt_fw_driver);
MODULE_AUTHOR("Vikas Gupta <vikas.gupta@broadcom.com>");
MODULE_DESCRIPTION("Broadcom bnxt firmware manager");
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (11 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:34 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function Uwe Kleine-König
` (3 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Michael Chan, Pavan Chebbi,
Rafał Miłecki
Cc: Sumit Garg, op-tee, netdev, linux-mips, 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/firmware/broadcom/tee_bnxt_fw.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c b/drivers/firmware/broadcom/tee_bnxt_fw.c
index fbdf1aa97c82..a706c84eb2b6 100644
--- a/drivers/firmware/broadcom/tee_bnxt_fw.c
+++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
@@ -181,9 +181,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
return (ver->impl_id == TEE_IMPL_ID_OPTEE);
}
-static int tee_bnxt_fw_probe(struct device *dev)
+static int tee_bnxt_fw_probe(struct tee_client_device *bnxt_device)
{
- struct tee_client_device *bnxt_device = to_tee_client_device(dev);
+ struct device *dev = &bnxt_device->dev;
int ret, err = -ENODEV;
struct tee_ioctl_open_session_arg sess_arg;
struct tee_shm *fw_shm_pool;
@@ -231,17 +231,15 @@ static int tee_bnxt_fw_probe(struct device *dev)
return err;
}
-static int tee_bnxt_fw_remove(struct device *dev)
+static void tee_bnxt_fw_remove(struct tee_client_device *bnxt_device)
{
tee_shm_free(pvt_data.fw_shm_pool);
tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
tee_client_close_context(pvt_data.ctx);
pvt_data.ctx = NULL;
-
- return 0;
}
-static void tee_bnxt_fw_shutdown(struct device *dev)
+static void tee_bnxt_fw_shutdown(struct tee_client_device *bnxt_device)
{
tee_shm_free(pvt_data.fw_shm_pool);
tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
@@ -258,12 +256,12 @@ static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
MODULE_DEVICE_TABLE(tee, tee_bnxt_fw_id_table);
static struct tee_client_driver tee_bnxt_fw_driver = {
+ .probe = tee_bnxt_fw_probe,
+ .remove = tee_bnxt_fw_remove,
+ .shutdown = tee_bnxt_fw_shutdown,
.id_table = tee_bnxt_fw_id_table,
.driver = {
.name = KBUILD_MODNAME,
- .probe = tee_bnxt_fw_probe,
- .remove = tee_bnxt_fw_remove,
- .shutdown = tee_bnxt_fw_shutdown,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (12 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:36 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods Uwe Kleine-König
` (2 subsequent siblings)
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Sumit Garg, James Bottomley, Jarkko Sakkinen,
Mimi Zohar, David Howells, Paul Moore, James Morris,
Serge E. Hallyn
Cc: op-tee, linux-integrity, keyrings, linux-security-module,
linux-kernel
The tee subsystem recently got a set of dedicated functions to register
(and unregister) a tee driver. Make use of them. These care for setting the
driver's bus (so the explicit assignment can be dropped) and the driver
owner (which is an improvement this driver benefits from).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
security/keys/trusted-keys/trusted_tee.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/security/keys/trusted-keys/trusted_tee.c b/security/keys/trusted-keys/trusted_tee.c
index aa3d477de6db..3cea9a377955 100644
--- a/security/keys/trusted-keys/trusted_tee.c
+++ b/security/keys/trusted-keys/trusted_tee.c
@@ -264,7 +264,6 @@ static struct tee_client_driver trusted_key_driver = {
.id_table = trusted_key_id_table,
.driver = {
.name = DRIVER_NAME,
- .bus = &tee_bus_type,
.probe = trusted_key_probe,
.remove = trusted_key_remove,
},
@@ -272,12 +271,12 @@ static struct tee_client_driver trusted_key_driver = {
static int trusted_tee_init(void)
{
- return driver_register(&trusted_key_driver.driver);
+ return tee_client_driver_register(&trusted_key_driver);
}
static void trusted_tee_exit(void)
{
- driver_unregister(&trusted_key_driver.driver);
+ tee_client_driver_unregister(&trusted_key_driver);
}
struct trusted_key_ops trusted_key_tee_ops = {
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (13 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:36 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration Uwe Kleine-König
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Sumit Garg, James Bottomley, Jarkko Sakkinen,
Mimi Zohar, David Howells, Paul Moore, James Morris,
Serge E. Hallyn
Cc: op-tee, linux-integrity, keyrings, linux-security-module,
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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
security/keys/trusted-keys/trusted_tee.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/security/keys/trusted-keys/trusted_tee.c b/security/keys/trusted-keys/trusted_tee.c
index 3cea9a377955..6e465c8bef5e 100644
--- a/security/keys/trusted-keys/trusted_tee.c
+++ b/security/keys/trusted-keys/trusted_tee.c
@@ -202,9 +202,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
return 0;
}
-static int trusted_key_probe(struct device *dev)
+static int trusted_key_probe(struct tee_client_device *rng_device)
{
- struct tee_client_device *rng_device = to_tee_client_device(dev);
+ struct device *dev = &rng_device->dev;
int ret;
struct tee_ioctl_open_session_arg sess_arg;
@@ -244,13 +244,11 @@ static int trusted_key_probe(struct device *dev)
return ret;
}
-static int trusted_key_remove(struct device *dev)
+static void trusted_key_remove(struct tee_client_device *dev)
{
unregister_key_type(&key_type_trusted);
tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
tee_client_close_context(pvt_data.ctx);
-
- return 0;
}
static const struct tee_client_device_id trusted_key_id_table[] = {
@@ -261,11 +259,11 @@ static const struct tee_client_device_id trusted_key_id_table[] = {
MODULE_DEVICE_TABLE(tee, trusted_key_id_table);
static struct tee_client_driver trusted_key_driver = {
+ .probe = trusted_key_probe,
+ .remove = trusted_key_remove,
.id_table = trusted_key_id_table,
.driver = {
.name = DRIVER_NAME,
- .probe = trusted_key_probe,
- .remove = trusted_key_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (14 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-15 7:38 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
16 siblings, 1 reply; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Peter Huewe, Jarkko Sakkinen
Cc: Jason Gunthorpe, Sumit Garg, op-tee, linux-integrity,
linux-kernel
tee_client_driver_register() is typed more strongly and cares about
assigning the driver's bus. Similar for tee_client_driver_unregister().
Make use of these functions.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/char/tpm/tpm_ftpm_tee.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 4e63c30aeaf1..e5fbc70b0eca 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -338,7 +338,6 @@ static struct tee_client_driver ftpm_tee_driver = {
.id_table = optee_ftpm_id_table,
.driver = {
.name = "optee-ftpm",
- .bus = &tee_bus_type,
.probe = ftpm_tee_probe,
.remove = ftpm_tee_remove,
},
@@ -352,7 +351,7 @@ static int __init ftpm_mod_init(void)
if (rc)
return rc;
- rc = driver_register(&ftpm_tee_driver.driver);
+ rc = tee_client_driver_register(&ftpm_tee_driver);
if (rc) {
platform_driver_unregister(&ftpm_tee_plat_driver);
return rc;
@@ -364,7 +363,7 @@ static int __init ftpm_mod_init(void)
static void __exit ftpm_mod_exit(void)
{
platform_driver_unregister(&ftpm_tee_plat_driver);
- driver_unregister(&ftpm_tee_driver.driver);
+ tee_client_driver_unregister(&ftpm_tee_driver);
}
module_init(ftpm_mod_init);
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
` (15 preceding siblings ...)
2025-12-11 17:15 ` [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration Uwe Kleine-König
@ 2025-12-11 17:15 ` Uwe Kleine-König
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
` (2 more replies)
16 siblings, 3 replies; 41+ messages in thread
From: Uwe Kleine-König @ 2025-12-11 17:15 UTC (permalink / raw)
To: Jens Wiklander, Peter Huewe, Jarkko Sakkinen
Cc: Jason Gunthorpe, Sumit Garg, op-tee, linux-integrity,
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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/char/tpm/tpm_ftpm_tee.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index e5fbc70b0eca..20294d1953a3 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -169,7 +169,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data)
* Return:
* On success, 0. On failure, -errno.
*/
-static int ftpm_tee_probe(struct device *dev)
+static int ftpm_tee_probe_generic(struct device *dev)
{
int rc;
struct tpm_chip *chip;
@@ -251,11 +251,18 @@ static int ftpm_tee_probe(struct device *dev)
return rc;
}
+static int ftpm_tee_probe(struct tee_client_device *tcdev)
+{
+ struct device *dev = &tcdev->dev;
+
+ return ftpm_tee_probe_generic(dev);
+}
+
static int ftpm_plat_tee_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- return ftpm_tee_probe(dev);
+ return ftpm_tee_probe_generic(dev);
}
/**
@@ -265,7 +272,7 @@ static int ftpm_plat_tee_probe(struct platform_device *pdev)
* Return:
* 0 always.
*/
-static int ftpm_tee_remove(struct device *dev)
+static void ftpm_tee_remove_generic(struct device *dev)
{
struct ftpm_tee_private *pvt_data = dev_get_drvdata(dev);
@@ -285,15 +292,20 @@ static int ftpm_tee_remove(struct device *dev)
tee_client_close_context(pvt_data->ctx);
/* memory allocated with devm_kzalloc() is freed automatically */
+}
- return 0;
+static void ftpm_tee_remove(struct tee_client_device *tcdev)
+{
+ struct device *dev = &tcdev->dev;
+
+ ftpm_tee_remove_generic(dev);
}
static void ftpm_plat_tee_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- ftpm_tee_remove(dev);
+ ftpm_tee_remove_generic(dev);
}
/**
@@ -335,11 +347,11 @@ static const struct tee_client_device_id optee_ftpm_id_table[] = {
MODULE_DEVICE_TABLE(tee, optee_ftpm_id_table);
static struct tee_client_driver ftpm_tee_driver = {
+ .probe = ftpm_tee_probe,
+ .remove = ftpm_tee_remove,
.id_table = optee_ftpm_id_table,
.driver = {
.name = "optee-ftpm",
- .probe = ftpm_tee_probe,
- .remove = ftpm_tee_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-15 7:40 ` Sumit Garg via OP-TEE
2 siblings, 0 replies; 41+ messages in thread
From: Jarkko Sakkinen via OP-TEE @ 2025-12-11 20:22 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Peter Huewe, Jason Gunthorpe, Sumit Garg, op-tee, linux-integrity,
linux-kernel
On Thu, Dec 11, 2025 at 06:15:11PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/tpm/tpm_ftpm_tee.c | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index e5fbc70b0eca..20294d1953a3 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -169,7 +169,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data)
> * Return:
> * On success, 0. On failure, -errno.
> */
> -static int ftpm_tee_probe(struct device *dev)
> +static int ftpm_tee_probe_generic(struct device *dev)
> {
> int rc;
> struct tpm_chip *chip;
> @@ -251,11 +251,18 @@ static int ftpm_tee_probe(struct device *dev)
> return rc;
> }
>
> +static int ftpm_tee_probe(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + return ftpm_tee_probe_generic(dev);
> +}
> +
> static int ftpm_plat_tee_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - return ftpm_tee_probe(dev);
> + return ftpm_tee_probe_generic(dev);
> }
>
> /**
> @@ -265,7 +272,7 @@ static int ftpm_plat_tee_probe(struct platform_device *pdev)
> * Return:
> * 0 always.
> */
> -static int ftpm_tee_remove(struct device *dev)
> +static void ftpm_tee_remove_generic(struct device *dev)
> {
> struct ftpm_tee_private *pvt_data = dev_get_drvdata(dev);
>
> @@ -285,15 +292,20 @@ static int ftpm_tee_remove(struct device *dev)
> tee_client_close_context(pvt_data->ctx);
>
> /* memory allocated with devm_kzalloc() is freed automatically */
> +}
>
> - return 0;
> +static void ftpm_tee_remove(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + ftpm_tee_remove_generic(dev);
> }
>
> static void ftpm_plat_tee_remove(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - ftpm_tee_remove(dev);
> + ftpm_tee_remove_generic(dev);
> }
>
> /**
> @@ -335,11 +347,11 @@ static const struct tee_client_device_id optee_ftpm_id_table[] = {
> MODULE_DEVICE_TABLE(tee, optee_ftpm_id_table);
>
> static struct tee_client_driver ftpm_tee_driver = {
> + .probe = ftpm_tee_probe,
> + .remove = ftpm_tee_remove,
> .id_table = optee_ftpm_id_table,
> .driver = {
> .name = "optee-ftpm",
> - .probe = ftpm_tee_probe,
> - .remove = ftpm_tee_remove,
> },
> };
>
> --
> 2.47.3
>
I checked trusted key patches and ftpm patches. I don't have anything
against merging them.
So for those four patches:
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
@ 2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-15 7:40 ` Sumit Garg via OP-TEE
2 siblings, 0 replies; 41+ messages in thread
From: Jarkko Sakkinen via OP-TEE @ 2025-12-11 20:22 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Peter Huewe, Jason Gunthorpe, Sumit Garg, op-tee, linux-integrity,
linux-kernel
On Thu, Dec 11, 2025 at 06:15:11PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/tpm/tpm_ftpm_tee.c | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index e5fbc70b0eca..20294d1953a3 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -169,7 +169,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data)
> * Return:
> * On success, 0. On failure, -errno.
> */
> -static int ftpm_tee_probe(struct device *dev)
> +static int ftpm_tee_probe_generic(struct device *dev)
> {
> int rc;
> struct tpm_chip *chip;
> @@ -251,11 +251,18 @@ static int ftpm_tee_probe(struct device *dev)
> return rc;
> }
>
> +static int ftpm_tee_probe(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + return ftpm_tee_probe_generic(dev);
> +}
> +
> static int ftpm_plat_tee_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - return ftpm_tee_probe(dev);
> + return ftpm_tee_probe_generic(dev);
> }
>
> /**
> @@ -265,7 +272,7 @@ static int ftpm_plat_tee_probe(struct platform_device *pdev)
> * Return:
> * 0 always.
> */
> -static int ftpm_tee_remove(struct device *dev)
> +static void ftpm_tee_remove_generic(struct device *dev)
> {
> struct ftpm_tee_private *pvt_data = dev_get_drvdata(dev);
>
> @@ -285,15 +292,20 @@ static int ftpm_tee_remove(struct device *dev)
> tee_client_close_context(pvt_data->ctx);
>
> /* memory allocated with devm_kzalloc() is freed automatically */
> +}
>
> - return 0;
> +static void ftpm_tee_remove(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + ftpm_tee_remove_generic(dev);
> }
>
> static void ftpm_plat_tee_remove(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - ftpm_tee_remove(dev);
> + ftpm_tee_remove_generic(dev);
> }
>
> /**
> @@ -335,11 +347,11 @@ static const struct tee_client_device_id optee_ftpm_id_table[] = {
> MODULE_DEVICE_TABLE(tee, optee_ftpm_id_table);
>
> static struct tee_client_driver ftpm_tee_driver = {
> + .probe = ftpm_tee_probe,
> + .remove = ftpm_tee_remove,
> .id_table = optee_ftpm_id_table,
> .driver = {
> .name = "optee-ftpm",
> - .probe = ftpm_tee_probe,
> - .remove = ftpm_tee_remove,
> },
> };
>
> --
> 2.47.3
>
And also for this:
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver()
2025-12-11 17:15 ` [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-12 12:33 ` Sudeep Holla
2025-12-15 7:30 ` Sumit Garg via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sudeep Holla @ 2025-12-12 12:33 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Christophe JAILLET, Cristian Marussi, Sumit Garg, op-tee,
arm-scmi, linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:04PM +0100, Uwe Kleine-König 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: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-12 12:34 ` Sudeep Holla
2025-12-15 7:32 ` Sumit Garg via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sudeep Holla @ 2025-12-12 12:34 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Christophe JAILLET, Cristian Marussi, Sumit Garg, op-tee,
arm-scmi, linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:05PM +0100, Uwe Kleine-König 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. Note that the return value of .remove()
> was already ignored before, so there is no problem introduced by dropping
> the error returns.
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers
2025-12-11 17:14 ` [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers Uwe Kleine-König
@ 2025-12-15 7:05 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:05 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: op-tee, linux-kernel
On Thu, Dec 11, 2025 at 06:14:55PM +0100, Uwe Kleine-König wrote:
> Similar to platform drivers (and others) create dedicated register and
> unregister functions and a macro to simplify modules that only need to
> handle driver registration in their init and exit handlers.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/tee/tee_core.c | 16 ++++++++++++++++
> include/linux/tee_drv.h | 9 +++++++++
> 2 files changed, 25 insertions(+)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index d65d47cc154e..51379f7fc5d5 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -1405,6 +1405,22 @@ const struct bus_type tee_bus_type = {
> };
> EXPORT_SYMBOL_GPL(tee_bus_type);
>
> +int __tee_client_driver_register(struct tee_client_driver *tee_driver,
> + struct module *owner)
> +{
> + tee_driver->driver.owner = owner;
> + tee_driver->driver.bus = &tee_bus_type;
> +
> + return driver_register(&tee_driver->driver);
> +}
> +EXPORT_SYMBOL_GPL(__tee_client_driver_register);
> +
> +void tee_client_driver_unregister(struct tee_client_driver *tee_driver)
> +{
> + driver_unregister(&tee_driver->driver);
> +}
> +EXPORT_SYMBOL_GPL(tee_client_driver_unregister);
> +
> static int __init tee_init(void)
> {
> int rc;
> diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
> index 88a6f9697c89..850c03b2cdea 100644
> --- a/include/linux/tee_drv.h
> +++ b/include/linux/tee_drv.h
> @@ -322,4 +322,13 @@ struct tee_client_driver {
> #define to_tee_client_driver(d) \
> container_of_const(d, struct tee_client_driver, driver)
>
> +#define tee_client_driver_register(drv) \
> + __tee_client_driver_register(drv, THIS_MODULE)
> +int __tee_client_driver_register(struct tee_client_driver *, struct module *);
> +void tee_client_driver_unregister(struct tee_client_driver *);
> +
> +#define module_tee_client_driver(__tee_client_driver) \
> + module_driver(__tee_client_driver, tee_client_driver_register, \
> + tee_client_driver_unregister)
> +
> #endif /*__TEE_DRV_H*/
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver
2025-12-11 17:14 ` [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver Uwe Kleine-König
@ 2025-12-15 7:23 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:23 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: op-tee, linux-kernel
On Thu, Dec 11, 2025 at 06:14:56PM +0100, Uwe Kleine-König wrote:
> Introduce a bus specific probe, remove and shutdown function. For now
> this only allows to get rid of a cast of the generic device to a
> tee_client device in the drivers and changes the remove prototype to
> return void---a non-zero return value is ignored anyhow.
>
> The objective is to get rid of users of struct device_driver callbacks
> .probe(), .remove() and .shutdown() to eventually remove these. Until
> all tee_client drivers are converted this results in a runtime warning
> about the drivers needing an update because there is a bus probe
> function and a driver probe function.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/tee/tee_core.c | 68 +++++++++++++++++++++++++++++++++++++++++
> include/linux/tee_drv.h | 3 ++
> 2 files changed, 71 insertions(+)
>
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index 51379f7fc5d5..89164d35fc5c 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -1398,19 +1398,87 @@ static int tee_client_device_uevent(const struct device *dev,
> return add_uevent_var(env, "MODALIAS=tee:%pUb", dev_id);
> }
>
> +static int tee_client_device_probe(struct device *dev)
> +{
> + struct tee_client_device *tcdev= to_tee_client_device(dev);
missing space: s/tcdev=/tcdev =/
> + struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
> +
> + if (drv->probe)
> + return drv->probe(tcdev);
> + else
> + return 0;
> +}
> +
> +static void tee_client_device_remove(struct device *dev)
> +{
> + struct tee_client_device *tcdev= to_tee_client_device(dev);
ditto.
> + struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
> +
> + if (drv->remove)
> + drv->remove(tcdev);
> +}
> +
> +static void tee_client_device_shutdown(struct device *dev)
> +{
> + struct tee_client_device *tcdev= to_tee_client_device(dev);
ditto.
> + struct tee_client_driver *drv = to_tee_client_driver(dev->driver);
> +
> + if (dev->driver && drv->remove)
> + drv->remove(tcdev);
don't we need to check and invoke drv->shutdown here?
> +}
> +
> const struct bus_type tee_bus_type = {
> .name = "tee",
> .match = tee_client_device_match,
> .uevent = tee_client_device_uevent,
> + .probe = tee_client_device_probe,
> + .remove = tee_client_device_remove,
> + .shutdown = tee_client_device_shutdown,
> };
> EXPORT_SYMBOL_GPL(tee_bus_type);
>
> +static int tee_client_device_probe_legacy(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> + struct device_driver *driver = dev->driver;
> +
> + return driver->probe(dev);
> +}
> +
> +static void tee_client_device_remove_legacy(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> + struct device_driver *driver = dev->driver;
> +
> + driver->remove(dev);
> +}
> +
> +static void tee_client_device_shutdown_legacy(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> + struct device_driver *driver = dev->driver;
> +
> + driver->shutdown(dev);
> +}
> +
> int __tee_client_driver_register(struct tee_client_driver *tee_driver,
> struct module *owner)
> {
> tee_driver->driver.owner = owner;
> tee_driver->driver.bus = &tee_bus_type;
>
> + /*
> + * Drivers that have callbacks set for tee_driver->driver need updating
> + * to use the callbacks in tee_driver instead. driver_register() warns
> + * about that, so no need to warn here, too.
> + */
> + if (!tee_driver->probe && tee_driver->driver.probe)
> + tee_driver->probe = tee_client_device_probe_legacy;
> + if (!tee_driver->remove && tee_driver->driver.remove)
> + tee_driver->remove= tee_client_device_remove_legacy;
missing space: s/tee_driver->remove=/tee_driver->remove =/
> + if (!tee_driver->shutdown && tee_driver->driver.probe)
you should rather check here for tee_driver->driver.shutdown?
-Sumit
> + tee_driver->shutdown = tee_client_device_shutdown_legacy;
> +
> return driver_register(&tee_driver->driver);
> }
> EXPORT_SYMBOL_GPL(__tee_client_driver_register);
> diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
> index 850c03b2cdea..e561a26f537a 100644
> --- a/include/linux/tee_drv.h
> +++ b/include/linux/tee_drv.h
> @@ -315,6 +315,9 @@ struct tee_client_device {
> * @driver: driver structure
> */
> struct tee_client_driver {
> + int (*probe)(struct tee_client_device *);
> + void (*remove)(struct tee_client_device *);
> + void (*shutdown)(struct tee_client_device *);
> const struct tee_client_device_id *id_table;
> struct device_driver driver;
> };
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 03/17] tee: Adapt documentation to cover recent additions
2025-12-11 17:14 ` [PATCH v1 03/17] tee: Adapt documentation to cover recent additions Uwe Kleine-König
@ 2025-12-15 7:24 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:24 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: op-tee, linux-kernel
On Thu, Dec 11, 2025 at 06:14:57PM +0100, Uwe Kleine-König wrote:
> The previous commits introduced some helpers to reduce boilerplate
> and bus specific callbacks for probe and remove.
>
> Adapt the reference example to make use of these.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Documentation/driver-api/tee.rst | 18 +++---------------
> 1 file changed, 3 insertions(+), 15 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/Documentation/driver-api/tee.rst b/Documentation/driver-api/tee.rst
> index 5eaeb8103988..4d58ac0712c1 100644
> --- a/Documentation/driver-api/tee.rst
> +++ b/Documentation/driver-api/tee.rst
> @@ -43,24 +43,12 @@ snippet would look like::
> MODULE_DEVICE_TABLE(tee, client_id_table);
>
> static struct tee_client_driver client_driver = {
> + .probe = client_probe,
> + .remove = client_remove,
> .id_table = client_id_table,
> .driver = {
> .name = DRIVER_NAME,
> - .bus = &tee_bus_type,
> - .probe = client_probe,
> - .remove = client_remove,
> },
> };
>
> - static int __init client_init(void)
> - {
> - return driver_register(&client_driver.driver);
> - }
> -
> - static void __exit client_exit(void)
> - {
> - driver_unregister(&client_driver.driver);
> - }
> -
> - module_init(client_init);
> - module_exit(client_exit);
> + module_tee_client_driver(client_driver);
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver()
2025-12-11 17:14 ` [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-15 7:26 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:26 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Olivia Mackall, Herbert Xu, op-tee, linux-crypto, linux-kernel
nit for subject: s/hwrng: optee -/hwrng: optee:/
On Thu, Dec 11, 2025 at 06:14:58PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/hw_random/optee-rng.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
> diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
> index 96b5d546d136..6ee748c0cf57 100644
> --- a/drivers/char/hw_random/optee-rng.c
> +++ b/drivers/char/hw_random/optee-rng.c
> @@ -281,24 +281,12 @@ static struct tee_client_driver optee_rng_driver = {
> .id_table = optee_rng_id_table,
> .driver = {
> .name = DRIVER_NAME,
> - .bus = &tee_bus_type,
> .probe = optee_rng_probe,
> .remove = optee_rng_remove,
> },
> };
>
> -static int __init optee_rng_mod_init(void)
> -{
> - return driver_register(&optee_rng_driver.driver);
> -}
> -
> -static void __exit optee_rng_mod_exit(void)
> -{
> - driver_unregister(&optee_rng_driver.driver);
> -}
> -
> -module_init(optee_rng_mod_init);
> -module_exit(optee_rng_mod_exit);
> +module_tee_client_driver(optee_rng_driver);
>
> MODULE_LICENSE("GPL v2");
> MODULE_AUTHOR("Sumit Garg <sumit.garg@linaro.org>");
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods
2025-12-11 17:14 ` [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 7:27 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:27 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Olivia Mackall, Herbert Xu, op-tee, linux-crypto, linux-kernel
nit for subject: s/hwrng: optee -/hwrng: optee:/
On Thu, Dec 11, 2025 at 06:14:59PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/hw_random/optee-rng.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
> index 6ee748c0cf57..5a3fa0b38497 100644
> --- a/drivers/char/hw_random/optee-rng.c
> +++ b/drivers/char/hw_random/optee-rng.c
> @@ -211,9 +211,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
> return 0;
> }
>
> -static int optee_rng_probe(struct device *dev)
> +static int optee_rng_probe(struct tee_client_device *rng_device)
> {
> - struct tee_client_device *rng_device = to_tee_client_device(dev);
> + struct device *dev = &rng_device->dev;
> int ret = 0, err = -ENODEV;
> struct tee_ioctl_open_session_arg sess_arg;
>
> @@ -261,12 +261,10 @@ static int optee_rng_probe(struct device *dev)
> return err;
> }
>
> -static int optee_rng_remove(struct device *dev)
> +static void optee_rng_remove(struct tee_client_device *tee_dev)
> {
> tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
> tee_client_close_context(pvt_data.ctx);
> -
> - return 0;
> }
>
> static const struct tee_client_device_id optee_rng_id_table[] = {
> @@ -278,11 +276,11 @@ static const struct tee_client_device_id optee_rng_id_table[] = {
> MODULE_DEVICE_TABLE(tee, optee_rng_id_table);
>
> static struct tee_client_driver optee_rng_driver = {
> + .probe = optee_rng_probe,
> + .remove = optee_rng_remove,
> .id_table = optee_rng_id_table,
> .driver = {
> .name = DRIVER_NAME,
> - .probe = optee_rng_probe,
> - .remove = optee_rng_remove,
> },
> };
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function
2025-12-11 17:15 ` [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function Uwe Kleine-König
@ 2025-12-15 7:28 ` Sumit Garg via OP-TEE
2025-12-15 10:41 ` Alexandre Belloni via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:28 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Clément Léger, Alexandre Belloni, op-tee, linux-rtc,
linux-kernel
On Thu, Dec 11, 2025 at 06:15:00PM +0100, Uwe Kleine-König wrote:
> The tee subsystem recently got a set of dedicated functions to register
> (and unregister) a tee driver. Make use of them. These care for setting the
> driver's bus (so the explicit assignment can be dropped) and the driver
> owner (which is an improvement this driver benefits from).
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/rtc/rtc-optee.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
> index 184c6d142801..f924a729ead0 100644
> --- a/drivers/rtc/rtc-optee.c
> +++ b/drivers/rtc/rtc-optee.c
> @@ -726,25 +726,13 @@ static struct tee_client_driver optee_rtc_driver = {
> .id_table = optee_rtc_id_table,
> .driver = {
> .name = "optee_rtc",
> - .bus = &tee_bus_type,
> .probe = optee_rtc_probe,
> .remove = optee_rtc_remove,
> .pm = pm_sleep_ptr(&optee_rtc_pm_ops),
> },
> };
>
> -static int __init optee_rtc_mod_init(void)
> -{
> - return driver_register(&optee_rtc_driver.driver);
> -}
> -
> -static void __exit optee_rtc_mod_exit(void)
> -{
> - driver_unregister(&optee_rtc_driver.driver);
> -}
> -
> -module_init(optee_rtc_mod_init);
> -module_exit(optee_rtc_mod_exit);
> +module_tee_client_driver(optee_rtc_driver);
>
> MODULE_LICENSE("GPL v2");
> MODULE_AUTHOR("Clément Léger <clement.leger@bootlin.com>");
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 07/17] rtc: optee: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 07/17] rtc: optee: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 7:30 ` Sumit Garg via OP-TEE
2025-12-15 10:42 ` Alexandre Belloni via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:30 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Clément Léger, Alexandre Belloni, op-tee, linux-rtc,
linux-kernel
On Thu, Dec 11, 2025 at 06:15:01PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/rtc/rtc-optee.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
> index f924a729ead0..eefde789d194 100644
> --- a/drivers/rtc/rtc-optee.c
> +++ b/drivers/rtc/rtc-optee.c
> @@ -547,9 +547,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
> return 0;
> }
>
> -static int optee_rtc_probe(struct device *dev)
> +static int optee_rtc_probe(struct tee_client_device *rtc_device)
> {
> - struct tee_client_device *rtc_device = to_tee_client_device(dev);
> + struct device *dev = &rtc_device->dev;
> struct tee_ioctl_open_session_arg sess2_arg = {0};
> struct tee_ioctl_open_session_arg sess_arg = {0};
> struct optee_rtc *priv;
> @@ -682,8 +682,9 @@ static int optee_rtc_probe(struct device *dev)
> return err;
> }
>
> -static int optee_rtc_remove(struct device *dev)
> +static void optee_rtc_remove(struct tee_client_device *rtc_device)
> {
> + struct device *dev = &rtc_device->dev;
> struct optee_rtc *priv = dev_get_drvdata(dev);
>
> if (priv->features & TA_RTC_FEATURE_ALARM) {
> @@ -696,8 +697,6 @@ static int optee_rtc_remove(struct device *dev)
> tee_shm_free(priv->shm);
> tee_client_close_session(priv->ctx, priv->session_id);
> tee_client_close_context(priv->ctx);
> -
> - return 0;
> }
>
> static int optee_rtc_suspend(struct device *dev)
> @@ -724,10 +723,10 @@ MODULE_DEVICE_TABLE(tee, optee_rtc_id_table);
>
> static struct tee_client_driver optee_rtc_driver = {
> .id_table = optee_rtc_id_table,
> + .probe = optee_rtc_probe,
> + .remove = optee_rtc_remove,
> .driver = {
> .name = "optee_rtc",
> - .probe = optee_rtc_probe,
> - .remove = optee_rtc_remove,
> .pm = pm_sleep_ptr(&optee_rtc_pm_ops),
> },
> };
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver()
2025-12-11 17:15 ` [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-12 12:33 ` Sudeep Holla
@ 2025-12-15 7:30 ` Sumit Garg via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:30 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Sudeep Holla, Christophe JAILLET, Cristian Marussi, op-tee,
arm-scmi, linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:04PM +0100, Uwe Kleine-König 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.
>
> 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(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> 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 [flat|nested] 41+ messages in thread
* Re: [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
2025-12-12 12:34 ` Sudeep Holla
@ 2025-12-15 7:32 ` Sumit Garg via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:32 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Sudeep Holla, Christophe JAILLET, Cristian Marussi, op-tee,
arm-scmi, linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:05PM +0100, Uwe Kleine-König 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. Note that the return value of .remove()
> was already ignored before, so there is no problem introduced by dropping
> the error returns.
>
> 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(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> 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 [flat|nested] 41+ messages in thread
* Re: [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver()
2025-12-11 17:15 ` [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-15 7:33 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:33 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Michael Chan, Pavan Chebbi, Rafał Miłecki, op-tee,
netdev, linux-mips, linux-kernel
On Thu, Dec 11, 2025 at 06:15:06PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/firmware/broadcom/tee_bnxt_fw.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c b/drivers/firmware/broadcom/tee_bnxt_fw.c
> index 40e3183a3d11..fbdf1aa97c82 100644
> --- a/drivers/firmware/broadcom/tee_bnxt_fw.c
> +++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
> @@ -261,25 +261,13 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
> .id_table = tee_bnxt_fw_id_table,
> .driver = {
> .name = KBUILD_MODNAME,
> - .bus = &tee_bus_type,
> .probe = tee_bnxt_fw_probe,
> .remove = tee_bnxt_fw_remove,
> .shutdown = tee_bnxt_fw_shutdown,
> },
> };
>
> -static int __init tee_bnxt_fw_mod_init(void)
> -{
> - return driver_register(&tee_bnxt_fw_driver.driver);
> -}
> -
> -static void __exit tee_bnxt_fw_mod_exit(void)
> -{
> - driver_unregister(&tee_bnxt_fw_driver.driver);
> -}
> -
> -module_init(tee_bnxt_fw_mod_init);
> -module_exit(tee_bnxt_fw_mod_exit);
> +module_tee_client_driver(tee_bnxt_fw_driver);
>
> MODULE_AUTHOR("Vikas Gupta <vikas.gupta@broadcom.com>");
> MODULE_DESCRIPTION("Broadcom bnxt firmware manager");
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 7:34 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:34 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Michael Chan, Pavan Chebbi, Rafał Miłecki, op-tee,
netdev, linux-mips, linux-kernel
On Thu, Dec 11, 2025 at 06:15:07PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/firmware/broadcom/tee_bnxt_fw.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c b/drivers/firmware/broadcom/tee_bnxt_fw.c
> index fbdf1aa97c82..a706c84eb2b6 100644
> --- a/drivers/firmware/broadcom/tee_bnxt_fw.c
> +++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
> @@ -181,9 +181,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
> return (ver->impl_id == TEE_IMPL_ID_OPTEE);
> }
>
> -static int tee_bnxt_fw_probe(struct device *dev)
> +static int tee_bnxt_fw_probe(struct tee_client_device *bnxt_device)
> {
> - struct tee_client_device *bnxt_device = to_tee_client_device(dev);
> + struct device *dev = &bnxt_device->dev;
> int ret, err = -ENODEV;
> struct tee_ioctl_open_session_arg sess_arg;
> struct tee_shm *fw_shm_pool;
> @@ -231,17 +231,15 @@ static int tee_bnxt_fw_probe(struct device *dev)
> return err;
> }
>
> -static int tee_bnxt_fw_remove(struct device *dev)
> +static void tee_bnxt_fw_remove(struct tee_client_device *bnxt_device)
> {
> tee_shm_free(pvt_data.fw_shm_pool);
> tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
> tee_client_close_context(pvt_data.ctx);
> pvt_data.ctx = NULL;
> -
> - return 0;
> }
>
> -static void tee_bnxt_fw_shutdown(struct device *dev)
> +static void tee_bnxt_fw_shutdown(struct tee_client_device *bnxt_device)
> {
> tee_shm_free(pvt_data.fw_shm_pool);
> tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
> @@ -258,12 +256,12 @@ static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
> MODULE_DEVICE_TABLE(tee, tee_bnxt_fw_id_table);
>
> static struct tee_client_driver tee_bnxt_fw_driver = {
> + .probe = tee_bnxt_fw_probe,
> + .remove = tee_bnxt_fw_remove,
> + .shutdown = tee_bnxt_fw_shutdown,
> .id_table = tee_bnxt_fw_id_table,
> .driver = {
> .name = KBUILD_MODNAME,
> - .probe = tee_bnxt_fw_probe,
> - .remove = tee_bnxt_fw_remove,
> - .shutdown = tee_bnxt_fw_shutdown,
> },
> };
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function
2025-12-11 17:15 ` [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function Uwe Kleine-König
@ 2025-12-15 7:36 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:36 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: James Bottomley, Jarkko Sakkinen, Mimi Zohar, David Howells,
Paul Moore, James Morris, Serge E. Hallyn, op-tee,
linux-integrity, keyrings, linux-security-module, linux-kernel
On Thu, Dec 11, 2025 at 06:15:08PM +0100, Uwe Kleine-König wrote:
> The tee subsystem recently got a set of dedicated functions to register
> (and unregister) a tee driver. Make use of them. These care for setting the
> driver's bus (so the explicit assignment can be dropped) and the driver
> owner (which is an improvement this driver benefits from).
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> security/keys/trusted-keys/trusted_tee.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/security/keys/trusted-keys/trusted_tee.c b/security/keys/trusted-keys/trusted_tee.c
> index aa3d477de6db..3cea9a377955 100644
> --- a/security/keys/trusted-keys/trusted_tee.c
> +++ b/security/keys/trusted-keys/trusted_tee.c
> @@ -264,7 +264,6 @@ static struct tee_client_driver trusted_key_driver = {
> .id_table = trusted_key_id_table,
> .driver = {
> .name = DRIVER_NAME,
> - .bus = &tee_bus_type,
> .probe = trusted_key_probe,
> .remove = trusted_key_remove,
> },
> @@ -272,12 +271,12 @@ static struct tee_client_driver trusted_key_driver = {
>
> static int trusted_tee_init(void)
> {
> - return driver_register(&trusted_key_driver.driver);
> + return tee_client_driver_register(&trusted_key_driver);
> }
>
> static void trusted_tee_exit(void)
> {
> - driver_unregister(&trusted_key_driver.driver);
> + tee_client_driver_unregister(&trusted_key_driver);
> }
>
> struct trusted_key_ops trusted_key_tee_ops = {
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 7:36 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:36 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: James Bottomley, Jarkko Sakkinen, Mimi Zohar, David Howells,
Paul Moore, James Morris, Serge E. Hallyn, op-tee,
linux-integrity, keyrings, linux-security-module, linux-kernel
On Thu, Dec 11, 2025 at 06:15:09PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> security/keys/trusted-keys/trusted_tee.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/security/keys/trusted-keys/trusted_tee.c b/security/keys/trusted-keys/trusted_tee.c
> index 3cea9a377955..6e465c8bef5e 100644
> --- a/security/keys/trusted-keys/trusted_tee.c
> +++ b/security/keys/trusted-keys/trusted_tee.c
> @@ -202,9 +202,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
> return 0;
> }
>
> -static int trusted_key_probe(struct device *dev)
> +static int trusted_key_probe(struct tee_client_device *rng_device)
> {
> - struct tee_client_device *rng_device = to_tee_client_device(dev);
> + struct device *dev = &rng_device->dev;
> int ret;
> struct tee_ioctl_open_session_arg sess_arg;
>
> @@ -244,13 +244,11 @@ static int trusted_key_probe(struct device *dev)
> return ret;
> }
>
> -static int trusted_key_remove(struct device *dev)
> +static void trusted_key_remove(struct tee_client_device *dev)
> {
> unregister_key_type(&key_type_trusted);
> tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
> tee_client_close_context(pvt_data.ctx);
> -
> - return 0;
> }
>
> static const struct tee_client_device_id trusted_key_id_table[] = {
> @@ -261,11 +259,11 @@ static const struct tee_client_device_id trusted_key_id_table[] = {
> MODULE_DEVICE_TABLE(tee, trusted_key_id_table);
>
> static struct tee_client_driver trusted_key_driver = {
> + .probe = trusted_key_probe,
> + .remove = trusted_key_remove,
> .id_table = trusted_key_id_table,
> .driver = {
> .name = DRIVER_NAME,
> - .probe = trusted_key_probe,
> - .remove = trusted_key_remove,
> },
> };
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration
2025-12-11 17:15 ` [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration Uwe Kleine-König
@ 2025-12-15 7:38 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:38 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, op-tee,
linux-integrity, linux-kernel
On Thu, Dec 11, 2025 at 06:15:10PM +0100, Uwe Kleine-König wrote:
> tee_client_driver_register() is typed more strongly and cares about
> assigning the driver's bus. Similar for tee_client_driver_unregister().
>
> Make use of these functions.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/tpm/tpm_ftpm_tee.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index 4e63c30aeaf1..e5fbc70b0eca 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -338,7 +338,6 @@ static struct tee_client_driver ftpm_tee_driver = {
> .id_table = optee_ftpm_id_table,
> .driver = {
> .name = "optee-ftpm",
> - .bus = &tee_bus_type,
> .probe = ftpm_tee_probe,
> .remove = ftpm_tee_remove,
> },
> @@ -352,7 +351,7 @@ static int __init ftpm_mod_init(void)
> if (rc)
> return rc;
>
> - rc = driver_register(&ftpm_tee_driver.driver);
> + rc = tee_client_driver_register(&ftpm_tee_driver);
> if (rc) {
> platform_driver_unregister(&ftpm_tee_plat_driver);
> return rc;
> @@ -364,7 +363,7 @@ static int __init ftpm_mod_init(void)
> static void __exit ftpm_mod_exit(void)
> {
> platform_driver_unregister(&ftpm_tee_plat_driver);
> - driver_unregister(&ftpm_tee_driver.driver);
> + tee_client_driver_unregister(&ftpm_tee_driver);
> }
>
> module_init(ftpm_mod_init);
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
@ 2025-12-15 7:40 ` Sumit Garg via OP-TEE
2 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:40 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, op-tee,
linux-integrity, linux-kernel
On Thu, Dec 11, 2025 at 06:15:11PM +0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/char/tpm/tpm_ftpm_tee.c | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index e5fbc70b0eca..20294d1953a3 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -169,7 +169,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data)
> * Return:
> * On success, 0. On failure, -errno.
> */
> -static int ftpm_tee_probe(struct device *dev)
> +static int ftpm_tee_probe_generic(struct device *dev)
> {
> int rc;
> struct tpm_chip *chip;
> @@ -251,11 +251,18 @@ static int ftpm_tee_probe(struct device *dev)
> return rc;
> }
>
> +static int ftpm_tee_probe(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + return ftpm_tee_probe_generic(dev);
> +}
> +
> static int ftpm_plat_tee_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - return ftpm_tee_probe(dev);
> + return ftpm_tee_probe_generic(dev);
> }
>
> /**
> @@ -265,7 +272,7 @@ static int ftpm_plat_tee_probe(struct platform_device *pdev)
> * Return:
> * 0 always.
> */
> -static int ftpm_tee_remove(struct device *dev)
> +static void ftpm_tee_remove_generic(struct device *dev)
> {
> struct ftpm_tee_private *pvt_data = dev_get_drvdata(dev);
>
> @@ -285,15 +292,20 @@ static int ftpm_tee_remove(struct device *dev)
> tee_client_close_context(pvt_data->ctx);
>
> /* memory allocated with devm_kzalloc() is freed automatically */
> +}
>
> - return 0;
> +static void ftpm_tee_remove(struct tee_client_device *tcdev)
> +{
> + struct device *dev = &tcdev->dev;
> +
> + ftpm_tee_remove_generic(dev);
> }
>
> static void ftpm_plat_tee_remove(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
>
> - ftpm_tee_remove(dev);
> + ftpm_tee_remove_generic(dev);
> }
>
> /**
> @@ -335,11 +347,11 @@ static const struct tee_client_device_id optee_ftpm_id_table[] = {
> MODULE_DEVICE_TABLE(tee, optee_ftpm_id_table);
>
> static struct tee_client_driver ftpm_tee_driver = {
> + .probe = ftpm_tee_probe,
> + .remove = ftpm_tee_remove,
> .id_table = optee_ftpm_id_table,
> .driver = {
> .name = "optee-ftpm",
> - .probe = ftpm_tee_probe,
> - .remove = ftpm_tee_remove,
> },
> };
>
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver()
2025-12-11 17:15 ` [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
@ 2025-12-15 7:55 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:55 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue, Sumit Garg,
Ilias Apalodimas, Jan Kiszka, op-tee, linux-efi, linux-stm32,
linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:02PM +0100, Uwe Kleine-König 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.
>
> 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(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> 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] 41+ messages in thread
* Re: [PATCH v1 09/17] efi: stmm: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
@ 2025-12-15 7:55 ` Sumit Garg via OP-TEE
0 siblings, 0 replies; 41+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-12-15 7:55 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue, Sumit Garg,
Ilias Apalodimas, Jan Kiszka, op-tee, linux-efi, linux-stm32,
linux-arm-kernel, linux-kernel
On Thu, Dec 11, 2025 at 06:15:03PM +0100, Uwe Kleine-König 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.
>
> 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(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> 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] 41+ messages in thread
* Re: [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function
2025-12-11 17:15 ` [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function Uwe Kleine-König
2025-12-15 7:28 ` Sumit Garg via OP-TEE
@ 2025-12-15 10:41 ` Alexandre Belloni via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Alexandre Belloni via OP-TEE @ 2025-12-15 10:41 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Clément Léger, Sumit Garg, op-tee, linux-rtc,
linux-kernel
On 11/12/2025 18:15:00+0100, Uwe Kleine-König wrote:
> The tee subsystem recently got a set of dedicated functions to register
> (and unregister) a tee driver. Make use of them. These care for setting the
> driver's bus (so the explicit assignment can be dropped) and the driver
> owner (which is an improvement this driver benefits from).
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-optee.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
> index 184c6d142801..f924a729ead0 100644
> --- a/drivers/rtc/rtc-optee.c
> +++ b/drivers/rtc/rtc-optee.c
> @@ -726,25 +726,13 @@ static struct tee_client_driver optee_rtc_driver = {
> .id_table = optee_rtc_id_table,
> .driver = {
> .name = "optee_rtc",
> - .bus = &tee_bus_type,
> .probe = optee_rtc_probe,
> .remove = optee_rtc_remove,
> .pm = pm_sleep_ptr(&optee_rtc_pm_ops),
> },
> };
>
> -static int __init optee_rtc_mod_init(void)
> -{
> - return driver_register(&optee_rtc_driver.driver);
> -}
> -
> -static void __exit optee_rtc_mod_exit(void)
> -{
> - driver_unregister(&optee_rtc_driver.driver);
> -}
> -
> -module_init(optee_rtc_mod_init);
> -module_exit(optee_rtc_mod_exit);
> +module_tee_client_driver(optee_rtc_driver);
>
> MODULE_LICENSE("GPL v2");
> MODULE_AUTHOR("Clément Léger <clement.leger@bootlin.com>");
> --
> 2.47.3
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH v1 07/17] rtc: optee: Make use of tee bus methods
2025-12-11 17:15 ` [PATCH v1 07/17] rtc: optee: Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:30 ` Sumit Garg via OP-TEE
@ 2025-12-15 10:42 ` Alexandre Belloni via OP-TEE
1 sibling, 0 replies; 41+ messages in thread
From: Alexandre Belloni via OP-TEE @ 2025-12-15 10:42 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Clément Léger, Sumit Garg, op-tee, linux-rtc,
linux-kernel
On 11/12/2025 18:15:01+0100, Uwe Kleine-König 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-optee.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c
> index f924a729ead0..eefde789d194 100644
> --- a/drivers/rtc/rtc-optee.c
> +++ b/drivers/rtc/rtc-optee.c
> @@ -547,9 +547,9 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
> return 0;
> }
>
> -static int optee_rtc_probe(struct device *dev)
> +static int optee_rtc_probe(struct tee_client_device *rtc_device)
> {
> - struct tee_client_device *rtc_device = to_tee_client_device(dev);
> + struct device *dev = &rtc_device->dev;
> struct tee_ioctl_open_session_arg sess2_arg = {0};
> struct tee_ioctl_open_session_arg sess_arg = {0};
> struct optee_rtc *priv;
> @@ -682,8 +682,9 @@ static int optee_rtc_probe(struct device *dev)
> return err;
> }
>
> -static int optee_rtc_remove(struct device *dev)
> +static void optee_rtc_remove(struct tee_client_device *rtc_device)
> {
> + struct device *dev = &rtc_device->dev;
> struct optee_rtc *priv = dev_get_drvdata(dev);
>
> if (priv->features & TA_RTC_FEATURE_ALARM) {
> @@ -696,8 +697,6 @@ static int optee_rtc_remove(struct device *dev)
> tee_shm_free(priv->shm);
> tee_client_close_session(priv->ctx, priv->session_id);
> tee_client_close_context(priv->ctx);
> -
> - return 0;
> }
>
> static int optee_rtc_suspend(struct device *dev)
> @@ -724,10 +723,10 @@ MODULE_DEVICE_TABLE(tee, optee_rtc_id_table);
>
> static struct tee_client_driver optee_rtc_driver = {
> .id_table = optee_rtc_id_table,
> + .probe = optee_rtc_probe,
> + .remove = optee_rtc_remove,
> .driver = {
> .name = "optee_rtc",
> - .probe = optee_rtc_probe,
> - .remove = optee_rtc_remove,
> .pm = pm_sleep_ptr(&optee_rtc_pm_ops),
> },
> };
> --
> 2.47.3
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 41+ messages in thread
end of thread, other threads:[~2025-12-15 13:19 UTC | newest]
Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 17:14 [PATCH v1 00/17] tee: Use bus callbacks instead of driver callbacks Uwe Kleine-König
2025-12-11 17:14 ` [PATCH v1 01/17] tee: Add some helpers to reduce boilerplate for tee client drivers Uwe Kleine-König
2025-12-15 7:05 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 02/17] tee: Add probe, remove and shutdown bus callbacks to tee_client_driver Uwe Kleine-König
2025-12-15 7:23 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 03/17] tee: Adapt documentation to cover recent additions Uwe Kleine-König
2025-12-15 7:24 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 04/17] hwrng: optee - Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-15 7:26 ` Sumit Garg via OP-TEE
2025-12-11 17:14 ` [PATCH v1 05/17] hwrng: optee - Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:27 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 06/17] rtc: optee: Migrate to use tee specific driver registration function Uwe Kleine-König
2025-12-15 7:28 ` Sumit Garg via OP-TEE
2025-12-15 10:41 ` Alexandre Belloni via OP-TEE
2025-12-11 17:15 ` [PATCH v1 07/17] rtc: optee: Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:30 ` Sumit Garg via OP-TEE
2025-12-15 10:42 ` Alexandre Belloni via OP-TEE
2025-12-11 17:15 ` [PATCH v1 08/17] efi: stmm: Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-15 7:55 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 09/17] efi: stmm: Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:55 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 10/17] firmware: arm_scmi: optee: Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-12 12:33 ` Sudeep Holla
2025-12-15 7:30 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 11/17] firmware: arm_scmi: Make use of tee bus methods Uwe Kleine-König
2025-12-12 12:34 ` Sudeep Holla
2025-12-15 7:32 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 12/17] firmware: tee_bnxt: Make use of module_tee_client_driver() Uwe Kleine-König
2025-12-15 7:33 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 13/17] firmware: tee_bnxt: Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:34 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 14/17] KEYS: trusted: Migrate to use tee specific driver registration function Uwe Kleine-König
2025-12-15 7:36 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 15/17] KEYS: trusted: Make use of tee bus methods Uwe Kleine-König
2025-12-15 7:36 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 16/17] tpm/tpm_ftpm_tee: Make use of tee specific driver registration Uwe Kleine-König
2025-12-15 7:38 ` Sumit Garg via OP-TEE
2025-12-11 17:15 ` [PATCH v1 17/17] tpm/tpm_ftpm_tee: Make use of tee bus methods Uwe Kleine-König
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-11 20:22 ` Jarkko Sakkinen via OP-TEE
2025-12-15 7:40 ` Sumit Garg via OP-TEE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox