mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] mcb: better use of buses when registering mcb devices
@ 2023-10-20 12:44 Rodríguez Barbarin, José Javier
  2023-10-20 12:44 ` [PATCH 1/1] mcb: Use the actual bus passed to init and release functions Rodríguez Barbarin, José Javier
  0 siblings, 1 reply; 2+ messages in thread
From: Rodríguez Barbarin, José Javier @ 2023-10-20 12:44 UTC (permalink / raw)
  To: morbidrsa, gregkh
  Cc: linux-kernel, jth, Sanjuán García, Jorge,
	Rodríguez Barbarin, José Javier

As Greg suggested in:
https://lore.kernel.org/all/2023100557-mournful-veto-64a2@gregkh/

There was an odd usage of bus_for_each_dev() where the bus used was
being assumed and the input parameter of mcb_bus_add_devices() was
ignored.

Jose Javier Rodriguez Barbarin (1):
  mcb: Use the actual bus passed to init and release functions

 drivers/mcb/mcb-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.34.1

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

* [PATCH 1/1] mcb: Use the actual bus passed to init and release functions
  2023-10-20 12:44 [PATCH 0/1] mcb: better use of buses when registering mcb devices Rodríguez Barbarin, José Javier
@ 2023-10-20 12:44 ` Rodríguez Barbarin, José Javier
  0 siblings, 0 replies; 2+ messages in thread
From: Rodríguez Barbarin, José Javier @ 2023-10-20 12:44 UTC (permalink / raw)
  To: morbidrsa, gregkh
  Cc: linux-kernel, jth, Sanjuán García, Jorge,
	Rodríguez Barbarin, José Javier,
	Sanjuán García, Jorge

The functions mcb_bus_add_devices() and mcb_devices_unregister()
take a mcb_bus as argument that is never being used. This implies
that there is only one bus.

Do not ignore mcb_bus parameter and get the actual bus_type from
the device related to this mcb_bus.

Co-developed-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com>
Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com>
Signed-off-by: Jose Javier Rodriguez Barbarin <JoseJavier.Rodriguez@duagon.com>
---
 drivers/mcb/mcb-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
index 5c6157b0db75..2a4a5e71ad4e 100644
--- a/drivers/mcb/mcb-core.c
+++ b/drivers/mcb/mcb-core.c
@@ -311,7 +311,7 @@ static int __mcb_devices_unregister(struct device *dev, void *data)
 
 static void mcb_devices_unregister(struct mcb_bus *bus)
 {
-	bus_for_each_dev(&mcb_bus_type, NULL, NULL, __mcb_devices_unregister);
+	bus_for_each_dev(bus->dev.bus, NULL, NULL, __mcb_devices_unregister);
 }
 /**
  * mcb_release_bus() - Free a @mcb_bus
@@ -406,7 +406,7 @@ static int __mcb_bus_add_devices(struct device *dev, void *data)
  */
 void mcb_bus_add_devices(const struct mcb_bus *bus)
 {
-	bus_for_each_dev(&mcb_bus_type, NULL, NULL, __mcb_bus_add_devices);
+	bus_for_each_dev(bus->dev.bus, NULL, NULL, __mcb_bus_add_devices);
 }
 EXPORT_SYMBOL_NS_GPL(mcb_bus_add_devices, MCB);
 
-- 
2.34.1

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

end of thread, other threads:[~2023-10-20 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 12:44 [PATCH 0/1] mcb: better use of buses when registering mcb devices Rodríguez Barbarin, José Javier
2023-10-20 12:44 ` [PATCH 1/1] mcb: Use the actual bus passed to init and release functions Rodríguez Barbarin, José Javier

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

all inboxes | Powered by JetHome®