summaryrefslogtreecommitdiff
path: root/drivers/soundwire
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>2025-12-15 18:49:26 +0100
committerVinod Koul <vkoul@kernel.org>2025-12-23 12:12:49 +0530
commit866160a51f5586d53e17ceab36029c8805ffea28 (patch)
tree5f810147cd5290e518dbaef187f7e30b333e0948 /drivers/soundwire
parent478f3890709a092a97a0218f61af19ac9b725573 (diff)
downloadlwn-866160a51f5586d53e17ceab36029c8805ffea28.tar.gz
lwn-866160a51f5586d53e17ceab36029c8805ffea28.zip
soundwire: Use bus methods for .probe(), .remove() and .shutdown()
These are nearly identical to the respective driver callbacks. The only differences are that .remove() returns void instead of int and .shutdown() has to cope for unbound devices. The objective is to get rid of users of struct device_driver callbacks .probe(), .remove() and .shutdown() to eventually remove these. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20251215174925.1327021-6-u.kleine-koenig@baylibre.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/bus_type.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
index c40de98f1485..80ed3468e860 100644
--- a/drivers/soundwire/bus_type.c
+++ b/drivers/soundwire/bus_type.c
@@ -72,13 +72,7 @@ int sdw_slave_uevent(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}
-const struct bus_type sdw_bus_type = {
- .name = "soundwire",
- .match = sdw_bus_match,
-};
-EXPORT_SYMBOL_GPL(sdw_bus_type);
-
-static int sdw_drv_probe(struct device *dev)
+static int sdw_bus_probe(struct device *dev)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
@@ -164,7 +158,7 @@ static int sdw_drv_probe(struct device *dev)
return 0;
}
-static int sdw_drv_remove(struct device *dev)
+static void sdw_bus_remove(struct device *dev)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
@@ -179,19 +173,26 @@ static int sdw_drv_remove(struct device *dev)
drv->remove(slave);
ida_free(&slave->bus->slave_ida, slave->index);
-
- return 0;
}
-static void sdw_drv_shutdown(struct device *dev)
+static void sdw_bus_shutdown(struct device *dev)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
- if (drv->shutdown)
+ if (dev->driver && drv->shutdown)
drv->shutdown(slave);
}
+const struct bus_type sdw_bus_type = {
+ .name = "soundwire",
+ .match = sdw_bus_match,
+ .probe = sdw_bus_probe,
+ .remove = sdw_bus_remove,
+ .shutdown = sdw_bus_shutdown,
+};
+EXPORT_SYMBOL_GPL(sdw_bus_type);
+
/**
* __sdw_register_driver() - register a SoundWire Slave driver
* @drv: driver to register
@@ -210,9 +211,6 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)
}
drv->driver.owner = owner;
- drv->driver.probe = sdw_drv_probe;
- drv->driver.remove = sdw_drv_remove;
- drv->driver.shutdown = sdw_drv_shutdown;
drv->driver.dev_groups = sdw_attr_groups;
return driver_register(&drv->driver);