linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] fsi: Convert to bus probe mechanism
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2025-11-29 16:57 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

Hello,

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.

Best regards
Uwe

Uwe Kleine-König (12):
  fsi: Make use of module_fsi_driver()
  fsi: Assign driver's bus in fsi_driver_register()
  fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices
  i2c: fsi: Drop assigning fsi bus
  spi: fsi: Drop assigning fsi bus
  fsi: Make fsi_bus_type a private variable to the core
  fsi: Create bus specific probe and remove functions
  fsi: master: Convert to fsi bus probe mechanism
  fsi: sbefifo: Convert to fsi bus probe mechanism
  fsi: scom: Convert to fsi bus probe mechanism
  i2c: fsi: Convert to fsi bus probe mechanism
  spi: fsi: Convert to fsi bus probe mechanism

 drivers/fsi/fsi-core.c       | 107 ++++++++++++++++++++++++++---------
 drivers/fsi/fsi-master-hub.c |  17 +++---
 drivers/fsi/fsi-sbefifo.c    |  31 +++-------
 drivers/fsi/fsi-scom.c       |  30 +++-------
 drivers/fsi/i2cr-scom.c      |   1 -
 drivers/i2c/busses/i2c-fsi.c |  16 +++---
 drivers/spi/spi-fsi.c        |   7 +--
 include/linux/fsi.h          |  13 ++++-
 8 files changed, 125 insertions(+), 97 deletions(-)


base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.47.3


^ permalink raw reply	[flat|nested] 7+ 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
@ 2025-11-29 16:57 ` Uwe Kleine-König
  2025-12-03 17:07   ` Andi Shyti
  2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: Convert to fsi bus probe mechanism Uwe Kleine-König
  2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König
  2 siblings, 1 reply; 7+ 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] 7+ 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
  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-03 17:12   ` Andi Shyti
  2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König
  2 siblings, 1 reply; 7+ 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] 7+ 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; 7+ 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] 7+ 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: Convert to fsi bus probe mechanism Uwe Kleine-König
@ 2025-12-03 17:12   ` Andi Shyti
  0 siblings, 0 replies; 7+ 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] 7+ 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; 7+ 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] 7+ 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
  2025-11-29 16:57 ` [PATCH 04/12] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
  2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: Convert to fsi bus probe mechanism Uwe Kleine-König
@ 2025-12-05 15:30 ` Uwe Kleine-König
  2 siblings, 0 replies; 7+ 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] 7+ messages in thread

end of thread, other threads:[~2025-12-05 15:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
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
2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: Convert to fsi bus probe mechanism Uwe Kleine-König
2025-12-03 17:12   ` Andi Shyti
2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).