LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks
@ 2025-12-02 14:09 Uwe Kleine-König
  2025-12-02 14:09 ` [PATCH 1/2] bus: fsl-mc: Drop error message in probe function Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-02 14:09 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linuxppc-dev, linux-kernel, Greg Kroah-Hartman

Hello,

with the eventual objective to drop .probe, .remove and .shutdown from
struct device_driver convert the fsl-mc bus to use proper bus functions.

There is no intended change of behaviour.

Best regards
Uwe

Uwe Kleine-König (2):
  bus: fsl-mc: Drop error message in probe function
  bus: fsl-mc: Convert to bus callbacks

 drivers/bus/fsl-mc/fsl-mc-bus.c | 77 ++++++++++++++-------------------
 1 file changed, 32 insertions(+), 45 deletions(-)


base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
-- 
2.47.3



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] bus: fsl-mc: Drop error message in probe function
  2025-12-02 14:09 [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
@ 2025-12-02 14:09 ` Uwe Kleine-König
  2025-12-02 14:09 ` [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-02 14:09 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linuxppc-dev, linux-kernel, Greg Kroah-Hartman

The driver core already emits an error message when probe fails, see
call_driver_probe() in drivers/base/dd.c. So drop the duplicated error
message.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 25845c04e562..0f0a5067f109 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -442,14 +442,7 @@ static int fsl_mc_driver_probe(struct device *dev)
 
 	mc_drv = to_fsl_mc_driver(dev->driver);
 
-	error = mc_drv->probe(mc_dev);
-	if (error < 0) {
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "%s failed: %d\n", __func__, error);
-		return error;
-	}
-
-	return 0;
+	return mc_drv->probe(mc_dev);
 }
 
 static int fsl_mc_driver_remove(struct device *dev)
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:09 [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
  2025-12-02 14:09 ` [PATCH 1/2] bus: fsl-mc: Drop error message in probe function Uwe Kleine-König
@ 2025-12-02 14:09 ` Uwe Kleine-König
  2025-12-02 14:48   ` Greg Kroah-Hartman
  2025-12-05 17:39   ` Uwe Kleine-König
  2025-12-02 15:14 ` [PATCH 0/2] " Ioana Ciornei
  2025-12-02 17:53 ` Christophe Leroy (CS GROUP)
  3 siblings, 2 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-02 14:09 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linuxppc-dev, linux-kernel, Greg Kroah-Hartman

With the eventual goal to drop .probe(), .remove() and .shutdown() from
struct device_driver, convert the fsl bus to use bus methods.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 70 +++++++++++++++------------------
 1 file changed, 32 insertions(+), 38 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 0f0a5067f109..6bc163d2ca49 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -137,6 +137,35 @@ static int fsl_mc_bus_uevent(const struct device *dev, struct kobj_uevent_env *e
 	return 0;
 }
 
+static int fsl_mc_probe(struct device *dev)
+{
+	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
+	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+
+	if (mc_drv->probe)
+		return mc_drv->probe(mc_dev);
+
+	return 0;
+}
+
+static void fsl_mc_remove(struct device *dev)
+{
+	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
+	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+
+	if (mc_drv->remove)
+		mc_drv->remove(mc_dev);
+}
+
+static void fsl_mc_shutdown(struct device *dev)
+{
+	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
+	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+
+	if (mc_drv->shutdown)
+		mc_drv->shutdown(mc_dev);
+}
+
 static int fsl_mc_dma_configure(struct device *dev)
 {
 	const struct device_driver *drv = READ_ONCE(dev->driver);
@@ -314,6 +343,9 @@ const struct bus_type fsl_mc_bus_type = {
 	.name = "fsl-mc",
 	.match = fsl_mc_bus_match,
 	.uevent = fsl_mc_bus_uevent,
+	.probe = fsl_mc_probe,
+	.remove = fsl_mc_remove,
+	.shutdown = fsl_mc_shutdown,
 	.dma_configure  = fsl_mc_dma_configure,
 	.dma_cleanup = fsl_mc_dma_cleanup,
 	.dev_groups = fsl_mc_dev_groups,
@@ -434,35 +466,6 @@ static const struct device_type *fsl_mc_get_device_type(const char *type)
 	return NULL;
 }
 
-static int fsl_mc_driver_probe(struct device *dev)
-{
-	struct fsl_mc_driver *mc_drv;
-	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
-	int error;
-
-	mc_drv = to_fsl_mc_driver(dev->driver);
-
-	return mc_drv->probe(mc_dev);
-}
-
-static int fsl_mc_driver_remove(struct device *dev)
-{
-	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
-	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
-
-	mc_drv->remove(mc_dev);
-
-	return 0;
-}
-
-static void fsl_mc_driver_shutdown(struct device *dev)
-{
-	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
-	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
-
-	mc_drv->shutdown(mc_dev);
-}
-
 /*
  * __fsl_mc_driver_register - registers a child device driver with the
  * MC bus
@@ -479,15 +482,6 @@ int __fsl_mc_driver_register(struct fsl_mc_driver *mc_driver,
 	mc_driver->driver.owner = owner;
 	mc_driver->driver.bus = &fsl_mc_bus_type;
 
-	if (mc_driver->probe)
-		mc_driver->driver.probe = fsl_mc_driver_probe;
-
-	if (mc_driver->remove)
-		mc_driver->driver.remove = fsl_mc_driver_remove;
-
-	if (mc_driver->shutdown)
-		mc_driver->driver.shutdown = fsl_mc_driver_shutdown;
-
 	error = driver_register(&mc_driver->driver);
 	if (error < 0) {
 		pr_err("driver_register() failed for %s: %d\n",
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:09 ` [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
@ 2025-12-02 14:48   ` Greg Kroah-Hartman
  2025-12-02 16:07     ` Uwe Kleine-König
  2025-12-05 17:39   ` Uwe Kleine-König
  1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2025-12-02 14:48 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Ioana Ciornei, linuxppc-dev, linux-kernel

On Tue, Dec 02, 2025 at 03:09:20PM +0100, Uwe Kleine-König wrote:
> With the eventual goal to drop .probe(), .remove() and .shutdown() from
> struct device_driver, convert the fsl bus to use bus methods.

We can drop those functions?  Ok, that would be nice, didn't realize it
would be possible!

So, looks good to me:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:09 [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
  2025-12-02 14:09 ` [PATCH 1/2] bus: fsl-mc: Drop error message in probe function Uwe Kleine-König
  2025-12-02 14:09 ` [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
@ 2025-12-02 15:14 ` Ioana Ciornei
  2025-12-02 17:53 ` Christophe Leroy (CS GROUP)
  3 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2025-12-02 15:14 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linuxppc-dev, linux-kernel, Greg Kroah-Hartman

On Tue, Dec 02, 2025 at 03:09:18PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> with the eventual objective to drop .probe, .remove and .shutdown from
> struct device_driver convert the fsl-mc bus to use proper bus functions.
> 
> There is no intended change of behaviour.
> 

Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:48   ` Greg Kroah-Hartman
@ 2025-12-02 16:07     ` Uwe Kleine-König
  2025-12-02 17:47       ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-02 16:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ioana Ciornei, linuxppc-dev, linux-kernel, Christophe Leroy

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

Hello Greg,

On Tue, Dec 02, 2025 at 03:48:05PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 02, 2025 at 03:09:20PM +0100, Uwe Kleine-König wrote:
> > With the eventual goal to drop .probe(), .remove() and .shutdown() from
> > struct device_driver, convert the fsl bus to use bus methods.
> 
> We can drop those functions?  Ok, that would be nice, didn't realize it
> would be possible!

I think we discussed that some time ago when I tackled making the
remove callbacks return void. When I said I want to make
device_driver->remove also return void I think it was you who said
to better convert the users to bus functions. So that's me doing what
you said :-)

I wonder what the merge plan for this series is. The last changes to
drivers/fsl-mc were merged by Christophe Leroy (added to Cc:)

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 16:07     ` Uwe Kleine-König
@ 2025-12-02 17:47       ` Christophe Leroy (CS GROUP)
  2025-12-02 22:34         ` Uwe Kleine-König
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2025-12-02 17:47 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman
  Cc: Ioana Ciornei, linuxppc-dev, linux-kernel



Le 02/12/2025 à 17:07, Uwe Kleine-König a écrit :
> Hello Greg,
> 
> On Tue, Dec 02, 2025 at 03:48:05PM +0100, Greg Kroah-Hartman wrote:
>> On Tue, Dec 02, 2025 at 03:09:20PM +0100, Uwe Kleine-König wrote:
>>> With the eventual goal to drop .probe(), .remove() and .shutdown() from
>>> struct device_driver, convert the fsl bus to use bus methods.
>>
>> We can drop those functions?  Ok, that would be nice, didn't realize it
>> would be possible!
> 
> I think we discussed that some time ago when I tackled making the
> remove callbacks return void. When I said I want to make
> device_driver->remove also return void I think it was you who said
> to better convert the users to bus functions. So that's me doing what
> you said :-)
> 
> I wonder what the merge plan for this series is. The last changes to
> drivers/fsl-mc were merged by Christophe Leroy (added to Cc:)

As per 
https://lore.kernel.org/all/2xzljdzktgpsyag5jhfwbxc2sroaacljecsq36hlxefu6jnz6g@zlorxu7niqnq/

Also see commit 586739b1e8b1 ("MAINTAINERS: add the linuppc-dev list to 
the fsl-mc bus entry")

It is a bit late for v6.19 though, will go in v6.20 ?

Christophe


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:09 [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2025-12-02 15:14 ` [PATCH 0/2] " Ioana Ciornei
@ 2025-12-02 17:53 ` Christophe Leroy (CS GROUP)
  3 siblings, 0 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2025-12-02 17:53 UTC (permalink / raw)
  To: Ioana Ciornei, Uwe Kleine-König
  Cc: Christophe Leroy, linuxppc-dev, linux-kernel, Greg Kroah-Hartman


On Tue, 02 Dec 2025 15:09:18 +0100, Uwe Kleine-König wrote:
> with the eventual objective to drop .probe, .remove and .shutdown from
> struct device_driver convert the fsl-mc bus to use proper bus functions.
> 
> There is no intended change of behaviour.
> 
> Best regards
> Uwe
> 
> [...]

Applied, thanks!

[1/2] bus: fsl-mc: Drop error message in probe function
      commit: 9b0856f4aaa484dcb1228e050ce05b26eded713a
[2/2] bus: fsl-mc: Convert to bus callbacks
      commit: ef980bda574d3a2ebaa297def62f03d2222e6ef3

Best regards,
-- 
Christophe Leroy (CS GROUP) <chleroy@kernel.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 17:47       ` Christophe Leroy (CS GROUP)
@ 2025-12-02 22:34         ` Uwe Kleine-König
  2025-12-03  6:43           ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-02 22:34 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Greg Kroah-Hartman, Ioana Ciornei, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

Hello Christophe,

On Tue, Dec 02, 2025 at 06:47:52PM +0100, Christophe Leroy (CS GROUP) wrote:
> Le 02/12/2025 à 17:07, Uwe Kleine-König a écrit :
> > I wonder what the merge plan for this series is. The last changes to
> > drivers/fsl-mc were merged by Christophe Leroy (added to Cc:)
> 
> As per https://lore.kernel.org/all/2xzljdzktgpsyag5jhfwbxc2sroaacljecsq36hlxefu6jnz6g@zlorxu7niqnq/
> 
> Also see commit 586739b1e8b1 ("MAINTAINERS: add the linuppc-dev list to the
> fsl-mc bus entry")

Ok, the fact that was unexpected by me is, that you, as the one who
picks up patches, are not listed in MAINTAINERS. But it seems to work
fine.

> It is a bit late for v6.19 though, will go in v6.20 ?

I'm in no hurry, getting it into 6.20 is completely fine for me. Thanks
for picking my patches up.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 22:34         ` Uwe Kleine-König
@ 2025-12-03  6:43           ` Christophe Leroy (CS GROUP)
  0 siblings, 0 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2025-12-03  6:43 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Ioana Ciornei, linuxppc-dev, linux-kernel



Le 02/12/2025 à 23:34, Uwe Kleine-König a écrit :
> Hello Christophe,
> 
> On Tue, Dec 02, 2025 at 06:47:52PM +0100, Christophe Leroy (CS GROUP) wrote:
>> Le 02/12/2025 à 17:07, Uwe Kleine-König a écrit :
>>> I wonder what the merge plan for this series is. The last changes to
>>> drivers/fsl-mc were merged by Christophe Leroy (added to Cc:)
>>
>> As per https://lore.kernel.org/all/2xzljdzktgpsyag5jhfwbxc2sroaacljecsq36hlxefu6jnz6g@zlorxu7niqnq/
>>
>> Also see commit 586739b1e8b1 ("MAINTAINERS: add the linuppc-dev list to the
>> fsl-mc bus entry")
> 
> Ok, the fact that was unexpected by me is, that you, as the one who
> picks up patches, are not listed in MAINTAINERS. But it seems to work
> fine.

Yup, the maintainer is Ioana but she has no git tree. I usually take the 
patches once she has reviewed or acked them.

> 
>> It is a bit late for v6.19 though, will go in v6.20 ?
> 
> I'm in no hurry, getting it into 6.20 is completely fine for me. Thanks
> for picking my patches up.
> 
> Best regards
> Uwe



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks
  2025-12-02 14:09 ` [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
  2025-12-02 14:48   ` Greg Kroah-Hartman
@ 2025-12-05 17:39   ` Uwe Kleine-König
  1 sibling, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2025-12-05 17:39 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linuxppc-dev, linux-kernel, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

Hello,

On Tue, Dec 02, 2025 at 03:09:20PM +0100, Uwe Kleine-König wrote:
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 0f0a5067f109..6bc163d2ca49 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> [...]
> +static void fsl_mc_shutdown(struct device *dev)
> +{
> +	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
> +	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
> +
> +	if (mc_drv->shutdown)
> +		mc_drv->shutdown(mc_dev);
> +}

As the bus callback for shutdown is also called for unbound devices, the
condition has to be

	if (dev->driver && mc_drv->shutdown)
 		
Can you please squash this in, or should I resend?

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 14:09 [PATCH 0/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
2025-12-02 14:09 ` [PATCH 1/2] bus: fsl-mc: Drop error message in probe function Uwe Kleine-König
2025-12-02 14:09 ` [PATCH 2/2] bus: fsl-mc: Convert to bus callbacks Uwe Kleine-König
2025-12-02 14:48   ` Greg Kroah-Hartman
2025-12-02 16:07     ` Uwe Kleine-König
2025-12-02 17:47       ` Christophe Leroy (CS GROUP)
2025-12-02 22:34         ` Uwe Kleine-König
2025-12-03  6:43           ` Christophe Leroy (CS GROUP)
2025-12-05 17:39   ` Uwe Kleine-König
2025-12-02 15:14 ` [PATCH 0/2] " Ioana Ciornei
2025-12-02 17:53 ` Christophe Leroy (CS GROUP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox