* [PATCH 01/12] fsi: Make use of module_fsi_driver()
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 02/12] fsi: Assign driver's bus in fsi_driver_register() Uwe Kleine-König
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
All other fsi drivers already use this helper to reduce boilerplate.
Catch up for the last two remaining ones.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/fsi/fsi-sbefifo.c | 13 +------------
drivers/fsi/fsi-scom.c | 13 +------------
2 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 0a98517f3959..5a08423d0c7e 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -1139,18 +1139,7 @@ static struct fsi_driver sbefifo_drv = {
}
};
-static int sbefifo_init(void)
-{
- return fsi_driver_register(&sbefifo_drv);
-}
-
-static void sbefifo_exit(void)
-{
- fsi_driver_unregister(&sbefifo_drv);
-}
-
-module_init(sbefifo_init);
-module_exit(sbefifo_exit);
+module_fsi_driver(sbefifo_drv);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Brad Bishop <bradleyb@fuzziesquirrel.com>");
MODULE_AUTHOR("Eddie James <eajames@linux.vnet.ibm.com>");
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 411ddc018cd8..f533106085ac 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -613,17 +613,6 @@ static struct fsi_driver scom_drv = {
}
};
-static int scom_init(void)
-{
- return fsi_driver_register(&scom_drv);
-}
-
-static void scom_exit(void)
-{
- fsi_driver_unregister(&scom_drv);
-}
-
-module_init(scom_init);
-module_exit(scom_exit);
+module_fsi_driver(scom_drv);
MODULE_DESCRIPTION("SCOM FSI Client device driver");
MODULE_LICENSE("GPL");
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 02/12] fsi: Assign driver's bus in fsi_driver_register()
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 01/12] fsi: Make use of module_fsi_driver() Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 03/12] fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices Uwe Kleine-König
` (10 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
Instead of letting each driver assign the bus, do it once in the fsi
driver register function.
Simplify the fsi drivers that are living in drivers/fsi accordingly.
Once all fsi drivers dropped assigning the bus, fsi_bus_type can be made
a static variable.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/fsi/fsi-core.c | 2 ++
drivers/fsi/fsi-master-hub.c | 1 -
drivers/fsi/fsi-sbefifo.c | 1 -
drivers/fsi/fsi-scom.c | 1 -
drivers/fsi/i2cr-scom.c | 1 -
5 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index c6c115993ebc..e1ea1124282e 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1394,6 +1394,8 @@ int fsi_driver_register(struct fsi_driver *fsi_drv)
if (!fsi_drv->id_table)
return -EINVAL;
+ fsi_drv->drv.bus = &fsi_bus_type;
+
return driver_register(&fsi_drv->drv);
}
EXPORT_SYMBOL_GPL(fsi_driver_register);
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 6568fed7db3c..d389856d18ac 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -288,7 +288,6 @@ static struct fsi_driver hub_master_driver = {
.id_table = hub_master_ids,
.drv = {
.name = "fsi-master-hub",
- .bus = &fsi_bus_type,
.probe = hub_master_probe,
.remove = hub_master_remove,
}
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 5a08423d0c7e..fde1c34743a0 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -1133,7 +1133,6 @@ static struct fsi_driver sbefifo_drv = {
.id_table = sbefifo_ids,
.drv = {
.name = DEVICE_NAME,
- .bus = &fsi_bus_type,
.probe = sbefifo_probe,
.remove = sbefifo_remove,
}
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index f533106085ac..2eda44451cc1 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -606,7 +606,6 @@ static struct fsi_driver scom_drv = {
.id_table = scom_ids,
.drv = {
.name = "scom",
- .bus = &fsi_bus_type,
.of_match_table = scom_of_ids,
.probe = scom_probe,
.remove = scom_remove,
diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c
index cb7e02213032..dfdb16afd205 100644
--- a/drivers/fsi/i2cr-scom.c
+++ b/drivers/fsi/i2cr-scom.c
@@ -140,7 +140,6 @@ static struct fsi_driver i2cr_scom_driver = {
.id_table = i2cr_scom_ids,
.drv = {
.name = "i2cr_scom",
- .bus = &fsi_bus_type,
.of_match_table = i2cr_scom_of_ids,
.probe = i2cr_scom_probe,
.remove = i2cr_scom_remove,
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 03/12] fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 01/12] fsi: Make use of module_fsi_driver() Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 02/12] fsi: Assign driver's bus in fsi_driver_register() Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 04/12] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
` (9 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
Similar to wrappers for other subsystems provide inline functions for
fsi devices to store driver data.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
include/linux/fsi.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index adea1b432f2d..05be75869a69 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -19,6 +19,16 @@ struct fsi_device {
uint32_t size;
};
+static inline void *fsi_get_drvdata(struct fsi_device *fsi_dev)
+{
+ return dev_get_drvdata(&fsi_dev->dev);
+}
+
+static inline void fsi_set_drvdata(struct fsi_device *fsi_dev, void *data)
+{
+ dev_set_drvdata(&fsi_dev->dev, data);
+}
+
extern int fsi_device_read(struct fsi_device *dev, uint32_t addr,
void *val, size_t size);
extern int fsi_device_write(struct fsi_device *dev, uint32_t addr,
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 04/12] i2c: fsi: Drop assigning fsi bus
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (2 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 03/12] fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-12-03 17:07 ` Andi Shyti
2025-11-29 16:57 ` [PATCH 05/12] spi: " Uwe Kleine-König
` (8 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James, Andi Shyti
Cc: Ninad Palsule, linux-i2c, openbmc, linux-kernel,
Greg Kroah-Hartman
Since commit FIXME ("fsi: Assign driver's bus in fsi_driver_register()")
module_fsi_driver() cares about assigning the driver's bus member. Drop the
explicit driver specific assignment.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/i2c/busses/i2c-fsi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index ae016a9431da..e98dd5dcac0f 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -763,7 +763,6 @@ static struct fsi_driver fsi_i2c_driver = {
.id_table = fsi_i2c_ids,
.drv = {
.name = "i2c-fsi",
- .bus = &fsi_bus_type,
.probe = fsi_i2c_probe,
.remove = fsi_i2c_remove,
},
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 04/12] i2c: fsi: Drop assigning fsi bus
2025-11-29 16:57 ` [PATCH 04/12] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
@ 2025-12-03 17:07 ` Andi Shyti
2025-12-04 11:18 ` Uwe Kleine-König
0 siblings, 1 reply; 19+ messages in thread
From: Andi Shyti @ 2025-12-03 17:07 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Eddie James, Ninad Palsule, linux-i2c, openbmc, linux-kernel,
Greg Kroah-Hartman
Hi Uwe,
On Sat, Nov 29, 2025 at 05:57:40PM +0100, Uwe Kleine-König wrote:
> Since commit FIXME ("fsi: Assign driver's bus in fsi_driver_register()")
whoever is going to apply the series needs to remember to replace
this FIXME.
> module_fsi_driver() cares about assigning the driver's bus member. Drop the
> explicit driver specific assignment.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thanks,
Andi
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 04/12] i2c: fsi: Drop assigning fsi bus
2025-12-03 17:07 ` Andi Shyti
@ 2025-12-04 11:18 ` Uwe Kleine-König
0 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-12-04 11:18 UTC (permalink / raw)
To: Andi Shyti
Cc: Eddie James, Ninad Palsule, linux-i2c, openbmc, linux-kernel,
Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
Hello Andi,
On Wed, Dec 03, 2025 at 06:07:11PM +0100, Andi Shyti wrote:
> On Sat, Nov 29, 2025 at 05:57:40PM +0100, Uwe Kleine-König wrote:
> > Since commit FIXME ("fsi: Assign driver's bus in fsi_driver_register()")
>
> whoever is going to apply the series needs to remember to replace
> this FIXME.
Ah right, when I wrote the commit log I made a mental note to point that
out in the cover letter, but then I forgot. Thanks for the reminder.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 05/12] spi: fsi: Drop assigning fsi bus
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (3 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 04/12] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-12-02 17:46 ` Mark Brown
2025-11-29 16:57 ` [PATCH 06/12] fsi: Make fsi_bus_type a private variable to the core Uwe Kleine-König
` (7 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James, Mark Brown
Cc: Ninad Palsule, linux-spi, linux-kernel, Greg Kroah-Hartman
Since commit FIXME ("fsi: Assign driver's bus in fsi_driver_register()")
module_fsi_driver() cares about assigning the driver's bus member. Drop the
explicit driver specific assignment.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/spi/spi-fsi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c
index e01c63d23b64..f9c15b99dba5 100644
--- a/drivers/spi/spi-fsi.c
+++ b/drivers/spi/spi-fsi.c
@@ -595,7 +595,6 @@ static struct fsi_driver fsi_spi_driver = {
.id_table = fsi_spi_ids,
.drv = {
.name = "spi-fsi",
- .bus = &fsi_bus_type,
.probe = fsi_spi_probe,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 05/12] spi: fsi: Drop assigning fsi bus
2025-11-29 16:57 ` [PATCH 05/12] spi: " Uwe Kleine-König
@ 2025-12-02 17:46 ` Mark Brown
0 siblings, 0 replies; 19+ messages in thread
From: Mark Brown @ 2025-12-02 17:46 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Eddie James, Ninad Palsule, linux-spi, linux-kernel,
Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
On Sat, Nov 29, 2025 at 05:57:41PM +0100, Uwe Kleine-König wrote:
> Since commit FIXME ("fsi: Assign driver's bus in fsi_driver_register()")
> module_fsi_driver() cares about assigning the driver's bus member. Drop the
> explicit driver specific assignment.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 06/12] fsi: Make fsi_bus_type a private variable to the core
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (4 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 05/12] spi: " Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 07/12] fsi: Create bus specific probe and remove functions Uwe Kleine-König
` (6 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
There are no users of fsi_bus_type outside of fsi-core.c, so make that
variable static, don't export it and drop the declaration from the public
header file.
As there is a usage of fsi_bus_type in fsi_create_device() the definition
of that variable must happen further up in the file to not have to add a
local declaration.
---
drivers/fsi/fsi-core.c | 67 +++++++++++++++++++++---------------------
include/linux/fsi.h | 1 -
2 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index e1ea1124282e..4e60d4b17c11 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -100,6 +100,39 @@ static int fsi_master_write(struct fsi_master *master, int link,
uint8_t slave_id, uint32_t addr, const void *val, size_t size);
static int fsi_master_break(struct fsi_master *master, int link);
+/* FSI core & Linux bus type definitions */
+
+static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
+{
+ struct fsi_device *fsi_dev = to_fsi_dev(dev);
+ const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
+ const struct fsi_device_id *id;
+
+ if (!fsi_drv->id_table)
+ return 0;
+
+ for (id = fsi_drv->id_table; id->engine_type; id++) {
+ if (id->engine_type != fsi_dev->engine_type)
+ continue;
+ if (id->version == FSI_VERSION_ANY ||
+ id->version == fsi_dev->version) {
+ if (drv->of_match_table) {
+ if (of_driver_match_device(dev, drv))
+ return 1;
+ } else {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static const struct bus_type fsi_bus_type = {
+ .name = "fsi",
+ .match = fsi_bus_match,
+};
+
/*
* fsi_device_read() / fsi_device_write() / fsi_device_peek()
*
@@ -1359,34 +1392,6 @@ void fsi_master_unregister(struct fsi_master *master)
}
EXPORT_SYMBOL_GPL(fsi_master_unregister);
-/* FSI core & Linux bus type definitions */
-
-static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
-{
- struct fsi_device *fsi_dev = to_fsi_dev(dev);
- const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
- const struct fsi_device_id *id;
-
- if (!fsi_drv->id_table)
- return 0;
-
- for (id = fsi_drv->id_table; id->engine_type; id++) {
- if (id->engine_type != fsi_dev->engine_type)
- continue;
- if (id->version == FSI_VERSION_ANY ||
- id->version == fsi_dev->version) {
- if (drv->of_match_table) {
- if (of_driver_match_device(dev, drv))
- return 1;
- } else {
- return 1;
- }
- }
- }
-
- return 0;
-}
-
int fsi_driver_register(struct fsi_driver *fsi_drv)
{
if (!fsi_drv)
@@ -1406,12 +1411,6 @@ void fsi_driver_unregister(struct fsi_driver *fsi_drv)
}
EXPORT_SYMBOL_GPL(fsi_driver_unregister);
-const struct bus_type fsi_bus_type = {
- .name = "fsi",
- .match = fsi_bus_match,
-};
-EXPORT_SYMBOL_GPL(fsi_bus_type);
-
static int __init fsi_init(void)
{
int rc;
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 05be75869a69..3e3a8f3adac3 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -78,7 +78,6 @@ extern int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
const void *val, size_t size);
-extern const struct bus_type fsi_bus_type;
extern const struct device_type fsi_cdev_type;
enum fsi_dev_type {
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 07/12] fsi: Create bus specific probe and remove functions
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (5 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 06/12] fsi: Make fsi_bus_type a private variable to the core Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 08/12] fsi: master: Convert to fsi bus probe mechanism Uwe Kleine-König
` (5 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
Introduce a bus specific probe and remove function. For now this only
allows to get rid of a cast of the generic device to an fsi 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 callbacks
.probe(), .remove() and .shutdown() to eventually remove these.
Until all fsi 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/fsi/fsi-core.c | 50 ++++++++++++++++++++++++++++++++++++++++++
include/linux/fsi.h | 2 ++
2 files changed, 52 insertions(+)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 4e60d4b17c11..83599a1c548b 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -128,9 +128,31 @@ static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
return 0;
}
+static int fsi_probe(struct device *dev)
+{
+ struct fsi_device *fsidev = to_fsi_dev(dev);
+ struct fsi_driver *fsidrv = to_fsi_drv(dev->driver);
+
+ if (fsidrv->probe)
+ return fsidrv->probe(fsidev);
+ else
+ return 0;
+}
+
+static void fsi_remove(struct device *dev)
+{
+ struct fsi_device *fsidev = to_fsi_dev(dev);
+ struct fsi_driver *fsidrv = to_fsi_drv(dev->driver);
+
+ if (fsidrv->remove)
+ fsidrv->remove(fsidev);
+}
+
static const struct bus_type fsi_bus_type = {
.name = "fsi",
.match = fsi_bus_match,
+ .probe = fsi_probe,
+ .remove = fsi_remove,
};
/*
@@ -1392,6 +1414,25 @@ void fsi_master_unregister(struct fsi_master *master)
}
EXPORT_SYMBOL_GPL(fsi_master_unregister);
+static int fsi_legacy_probe(struct fsi_device *fsidev)
+{
+ struct device *dev = &fsidev->dev;
+ struct device_driver *driver = dev->driver;
+
+ return driver->probe(dev);
+}
+
+static void fsi_legacy_remove(struct fsi_device *fsidev)
+{
+ struct device *dev = &fsidev->dev;
+ struct device_driver *driver = dev->driver;
+ int ret;
+
+ ret = driver->remove(dev);
+ if (unlikely(ret))
+ dev_warn(dev, "Ignoring return value of remove callback (%pe)\n", ERR_PTR(ret));
+}
+
int fsi_driver_register(struct fsi_driver *fsi_drv)
{
if (!fsi_drv)
@@ -1401,6 +1442,15 @@ int fsi_driver_register(struct fsi_driver *fsi_drv)
fsi_drv->drv.bus = &fsi_bus_type;
+ /*
+ * This driver needs updating. Note that driver_register() warns about
+ * this, so we're not adding another warning here.
+ */
+ if (!fsi_drv->probe && fsi_drv->drv.probe)
+ fsi_drv->probe = fsi_legacy_probe;
+ if (!fsi_drv->remove && fsi_drv->drv.remove)
+ fsi_drv->remove = fsi_legacy_remove;
+
return driver_register(&fsi_drv->drv);
}
EXPORT_SYMBOL_GPL(fsi_driver_register);
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 3e3a8f3adac3..9c67c43f9e6c 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -49,6 +49,8 @@ struct fsi_device_id {
.engine_type = (t), .version = (v),
struct fsi_driver {
+ int (*probe)(struct fsi_device *fsidev);
+ void (*remove)(struct fsi_device *fsidev);
struct device_driver drv;
const struct fsi_device_id *id_table;
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 08/12] fsi: master: Convert to fsi bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (6 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 07/12] fsi: Create bus specific probe and remove functions Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 09/12] fsi: sbefifo: " Uwe Kleine-König
` (4 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/fsi/fsi-master-hub.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index d389856d18ac..a84955bb23b1 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -192,9 +192,9 @@ static int hub_master_init(struct fsi_master_hub *hub)
return fsi_device_write(dev, FSI_MRESB0, ®, sizeof(reg));
}
-static int hub_master_probe(struct device *dev)
+static int hub_master_probe(struct fsi_device *fsi_dev)
{
- struct fsi_device *fsi_dev = to_fsi_dev(dev);
+ struct device *dev = &fsi_dev->dev;
struct fsi_master_hub *hub;
uint32_t reg, links;
__be32 __reg;
@@ -235,7 +235,7 @@ static int hub_master_probe(struct device *dev)
hub->master.send_break = hub_master_break;
hub->master.link_enable = hub_master_link_enable;
- dev_set_drvdata(dev, hub);
+ fsi_set_drvdata(fsi_dev, hub);
hub_master_init(hub);
@@ -259,9 +259,9 @@ static int hub_master_probe(struct device *dev)
return rc;
}
-static int hub_master_remove(struct device *dev)
+static void hub_master_remove(struct fsi_device *fsi_dev)
{
- struct fsi_master_hub *hub = dev_get_drvdata(dev);
+ struct fsi_master_hub *hub = fsi_get_drvdata(fsi_dev);
fsi_master_unregister(&hub->master);
fsi_slave_release_range(hub->upstream->slave, hub->addr, hub->size);
@@ -272,8 +272,6 @@ static int hub_master_remove(struct device *dev)
* the hub
*/
put_device(&hub->master.dev);
-
- return 0;
}
static const struct fsi_device_id hub_master_ids[] = {
@@ -286,10 +284,10 @@ static const struct fsi_device_id hub_master_ids[] = {
static struct fsi_driver hub_master_driver = {
.id_table = hub_master_ids,
+ .probe = hub_master_probe,
+ .remove = hub_master_remove,
.drv = {
.name = "fsi-master-hub",
- .probe = hub_master_probe,
- .remove = hub_master_remove,
}
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 09/12] fsi: sbefifo: Convert to fsi bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (7 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 08/12] fsi: master: Convert to fsi bus probe mechanism Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 10/12] fsi: scom: " Uwe Kleine-König
` (3 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/fsi/fsi-sbefifo.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index fde1c34743a0..6ca5817910cd 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -1022,9 +1022,9 @@ static void sbefifo_free(struct device *dev)
* Probe/remove
*/
-static int sbefifo_probe(struct device *dev)
+static int sbefifo_probe(struct fsi_device *fsi_dev)
{
- struct fsi_device *fsi_dev = to_fsi_dev(dev);
+ struct device *dev = &fsi_dev->dev;
struct sbefifo *sbefifo;
struct device_node *np;
struct platform_device *child;
@@ -1045,7 +1045,7 @@ static int sbefifo_probe(struct device *dev)
sbefifo->magic = SBEFIFO_MAGIC;
sbefifo->fsi_dev = fsi_dev;
- dev_set_drvdata(dev, sbefifo);
+ fsi_set_drvdata(fsi_dev, sbefifo);
mutex_init(&sbefifo->lock);
sbefifo->timeout_in_cmd_ms = SBEFIFO_TIMEOUT_IN_CMD;
sbefifo->timeout_start_rsp_ms = SBEFIFO_TIMEOUT_START_RSP;
@@ -1101,9 +1101,10 @@ static int sbefifo_unregister_child(struct device *dev, void *data)
return 0;
}
-static int sbefifo_remove(struct device *dev)
+static void sbefifo_remove(struct fsi_device *fsi_dev)
{
- struct sbefifo *sbefifo = dev_get_drvdata(dev);
+ struct device *dev = &fsi_dev->dev;
+ struct sbefifo *sbefifo = fsi_get_drvdata(fsi_dev);
dev_dbg(dev, "Removing sbefifo device...\n");
@@ -1117,8 +1118,6 @@ static int sbefifo_remove(struct device *dev)
fsi_free_minor(sbefifo->dev.devt);
device_for_each_child(dev, NULL, sbefifo_unregister_child);
put_device(&sbefifo->dev);
-
- return 0;
}
static const struct fsi_device_id sbefifo_ids[] = {
@@ -1131,10 +1130,10 @@ static const struct fsi_device_id sbefifo_ids[] = {
static struct fsi_driver sbefifo_drv = {
.id_table = sbefifo_ids,
+ .probe = sbefifo_probe,
+ .remove = sbefifo_remove,
.drv = {
.name = DEVICE_NAME,
- .probe = sbefifo_probe,
- .remove = sbefifo_remove,
}
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 10/12] fsi: scom: Convert to fsi bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (8 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 09/12] fsi: sbefifo: " Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: " Uwe Kleine-König
` (2 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James; +Cc: Ninad Palsule, linux-fsi, linux-kernel, Greg Kroah-Hartman
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/fsi/fsi-scom.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 2eda44451cc1..67cd45605fe4 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -527,16 +527,16 @@ static void scom_free(struct device *dev)
kfree(scom);
}
-static int scom_probe(struct device *dev)
+static int scom_probe(struct fsi_device *fsi_dev)
{
- struct fsi_device *fsi_dev = to_fsi_dev(dev);
+ struct device *dev = &fsi_dev->dev;
struct scom_device *scom;
int rc, didx;
scom = kzalloc(sizeof(*scom), GFP_KERNEL);
if (!scom)
return -ENOMEM;
- dev_set_drvdata(dev, scom);
+ fsi_set_drvdata(fsi_dev, scom);
mutex_init(&scom->lock);
/* Grab a reference to the device (parent of our cdev), we'll drop it later */
@@ -574,9 +574,9 @@ static int scom_probe(struct device *dev)
return rc;
}
-static int scom_remove(struct device *dev)
+static void scom_remove(struct fsi_device *fsi_dev)
{
- struct scom_device *scom = dev_get_drvdata(dev);
+ struct scom_device *scom = fsi_get_drvdata(fsi_dev);
mutex_lock(&scom->lock);
scom->dead = true;
@@ -584,8 +584,6 @@ static int scom_remove(struct device *dev)
cdev_device_del(&scom->cdev, &scom->dev);
fsi_free_minor(scom->dev.devt);
put_device(&scom->dev);
-
- return 0;
}
static const struct of_device_id scom_of_ids[] = {
@@ -604,11 +602,11 @@ static const struct fsi_device_id scom_ids[] = {
static struct fsi_driver scom_drv = {
.id_table = scom_ids,
+ .probe = scom_probe,
+ .remove = scom_remove,
.drv = {
.name = "scom",
.of_match_table = scom_of_ids,
- .probe = scom_probe,
- .remove = scom_remove,
}
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 11/12] i2c: fsi: Convert to fsi bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (9 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 10/12] fsi: scom: " Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-12-03 17:12 ` Andi Shyti
2025-11-29 16:57 ` [PATCH 12/12] spi: " Uwe Kleine-König
2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König
12 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James, Andi Shyti
Cc: Ninad Palsule, linux-i2c, openbmc, linux-kernel,
Greg Kroah-Hartman
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/i2c/busses/i2c-fsi.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index e98dd5dcac0f..3a7e577e6eac 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -674,8 +674,9 @@ static struct device_node *fsi_i2c_find_port_of_node(struct device_node *fsi,
return NULL;
}
-static int fsi_i2c_probe(struct device *dev)
+static int fsi_i2c_probe(struct fsi_device *fsi_dev)
{
+ struct device *dev = &fsi_dev->dev;
struct fsi_i2c_ctrl *i2c;
struct fsi_i2c_port *port;
struct device_node *np;
@@ -735,14 +736,14 @@ static int fsi_i2c_probe(struct device *dev)
list_add(&port->list, &i2c->ports);
}
- dev_set_drvdata(dev, i2c);
+ fsi_set_drvdata(fsi_dev, i2c);
return 0;
}
-static int fsi_i2c_remove(struct device *dev)
+static void fsi_i2c_remove(struct fsi_device *fsi_dev)
{
- struct fsi_i2c_ctrl *i2c = dev_get_drvdata(dev);
+ struct fsi_i2c_ctrl *i2c = fsi_get_drvdata(fsi_dev);
struct fsi_i2c_port *port, *tmp;
list_for_each_entry_safe(port, tmp, &i2c->ports, list) {
@@ -750,8 +751,6 @@ static int fsi_i2c_remove(struct device *dev)
i2c_del_adapter(&port->adapter);
kfree(port);
}
-
- return 0;
}
static const struct fsi_device_id fsi_i2c_ids[] = {
@@ -761,10 +760,10 @@ static const struct fsi_device_id fsi_i2c_ids[] = {
static struct fsi_driver fsi_i2c_driver = {
.id_table = fsi_i2c_ids,
+ .probe = fsi_i2c_probe,
+ .remove = fsi_i2c_remove,
.drv = {
.name = "i2c-fsi",
- .probe = fsi_i2c_probe,
- .remove = fsi_i2c_remove,
},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 11/12] i2c: fsi: Convert to fsi bus probe mechanism
2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: " Uwe Kleine-König
@ 2025-12-03 17:12 ` Andi Shyti
0 siblings, 0 replies; 19+ messages in thread
From: Andi Shyti @ 2025-12-03 17:12 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Eddie James, Ninad Palsule, linux-i2c, openbmc, linux-kernel,
Greg Kroah-Hartman
Hi Uwe,
On Sat, Nov 29, 2025 at 05:57:47PM +0100, Uwe Kleine-König wrote:
> The fsi bus got a dedicated probe function. Make use of that. This fixes
> a runtime warning about the driver needing to be converted to the bus
> probe method.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
looks all right:
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Andi
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 12/12] spi: fsi: Convert to fsi bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (10 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: " Uwe Kleine-König
@ 2025-11-29 16:57 ` Uwe Kleine-König
2025-12-02 17:46 ` Mark Brown
2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König
12 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 UTC (permalink / raw)
To: Eddie James, Mark Brown
Cc: Ninad Palsule, linux-spi, linux-kernel, Greg Kroah-Hartman
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/spi/spi-fsi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c
index f9c15b99dba5..07dc3d24f2c9 100644
--- a/drivers/spi/spi-fsi.c
+++ b/drivers/spi/spi-fsi.c
@@ -528,13 +528,13 @@ static size_t fsi_spi_max_transfer_size(struct spi_device *spi)
return SPI_FSI_MAX_RX_SIZE;
}
-static int fsi_spi_probe(struct device *dev)
+static int fsi_spi_probe(struct fsi_device *fsi)
{
int rc;
struct device_node *np;
int num_controllers_registered = 0;
struct fsi2spi *bridge;
- struct fsi_device *fsi = to_fsi_dev(dev);
+ struct device *dev = &fsi->dev;
rc = fsi_spi_check_mux(fsi, dev);
if (rc)
@@ -593,9 +593,9 @@ MODULE_DEVICE_TABLE(fsi, fsi_spi_ids);
static struct fsi_driver fsi_spi_driver = {
.id_table = fsi_spi_ids,
+ .probe = fsi_spi_probe,
.drv = {
.name = "spi-fsi",
- .probe = fsi_spi_probe,
},
};
module_fsi_driver(fsi_spi_driver);
--
2.47.3
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 12/12] spi: fsi: Convert to fsi bus probe mechanism
2025-11-29 16:57 ` [PATCH 12/12] spi: " Uwe Kleine-König
@ 2025-12-02 17:46 ` Mark Brown
0 siblings, 0 replies; 19+ messages in thread
From: Mark Brown @ 2025-12-02 17:46 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Eddie James, Ninad Palsule, linux-spi, linux-kernel,
Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 278 bytes --]
On Sat, Nov 29, 2025 at 05:57:48PM +0100, Uwe Kleine-König wrote:
> The fsi bus got a dedicated probe function. Make use of that. This fixes
> a runtime warning about the driver needing to be converted to the bus
> probe method.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/12] fsi: Convert to bus probe mechanism
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
` (11 preceding siblings ...)
2025-11-29 16:57 ` [PATCH 12/12] spi: " Uwe Kleine-König
@ 2025-12-05 15:30 ` Uwe Kleine-König
12 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2025-12-05 15:30 UTC (permalink / raw)
To: Eddie James, Andi Shyti, Mark Brown
Cc: Ninad Palsule, linux-fsi, linux-kernel, linux-i2c, openbmc,
linux-spi, Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]
Hello,
On Sat, Nov 29, 2025 at 05:57:36PM +0100, Uwe Kleine-König wrote:
> for the quest to drop .probe(), .remove() and .shutdown() from struct
> device_driver, convert the fsi subsystem to make use of the respective
> bus methods. Some cleanups are also included, I noticed those while
> working on the conversion.
>
> Regarding how to merge this series: There are two drivers touched that
> are not in drivers/fsi, namely drivers/i2c/busses/i2c-fsi.c and
> drivers/spi/spi-fsi.c. The easiest would be to merge this series through
> a single tree because the i2c and spi driver changes depend on some fsi
> core patches and fsi_bus_type can only made private when these are
> applied. I tried to quickly resort the series to only need three steps
> when merged separately, but this wasn't trivially possible, so I hope
> Andi and Mark give their acks to merge their driver changes together
> with the fsi core changes in one go.
>
> Note this series is only compile tested as I don't have a machine using
> the fsi subsystem.
>
> All the calls to get_device() I found in these drivers look a bit
> suspicious and I think there are some issues with lifetime tracking. But
> I didn't try to address these, so I'm just mentioning that here.
While working on more such patches (for other subsystems) I found a
problem in this patch set. Please don't apply it yet, I will prepare a
v2 (and then also explain the things that need to be done).
Thanks
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread