@@ -176,6 +176,11 @@ static int sdw_delete_slave(struct device *dev, void *data)
void sdw_bus_master_delete(struct sdw_bus *bus)
{
device_for_each_child(bus->dev, NULL, sdw_delete_slave);
+
+ /* Children have been removed so it is now safe for the bus to stop */
+ if (bus->ops->remove)
+ bus->ops->remove(bus);
+
sdw_master_device_del(bus);
sdw_bus_debugfs_exit(bus);
@@ -839,6 +839,7 @@ struct sdw_defer {
* @set_bus_conf: Set the bus configuration
* @pre_bank_switch: Callback for pre bank switch
* @post_bank_switch: Callback for post bank switch
+ * @remove: Called when it is safe to stop the bus controller.
*/
struct sdw_master_ops {
int (*read_prop)(struct sdw_bus *bus);
@@ -855,7 +856,7 @@ struct sdw_master_ops {
struct sdw_bus_params *params);
int (*pre_bank_switch)(struct sdw_bus *bus);
int (*post_bank_switch)(struct sdw_bus *bus);
-
+ void (*remove)(struct sdw_bus *bus);
};
/**
During removal of a bus driver the bus must stay operational while child drivers are being removed, since (a) they might have been busy when the bus driver removal started and (b) the might need to access the bus to run their shutdown procedures. Only after that can the bus driver disable the bus. Add a new remove callback to struct sdw_master_ops that the bus driver can implement to disable the bus after children are removed. This is modeled on the ASoC component_remove, which indicates that the driver is no longer required. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> --- drivers/soundwire/bus.c | 5 +++++ include/linux/soundwire/sdw.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-)