@@ -428,12 +428,26 @@ int fsi_master_register(struct fsi_master *master)
}
EXPORT_SYMBOL_GPL(fsi_master_register);
+static int fsi_slave_device_remove(struct device *dev, void *data)
+{
+ put_device(dev);
+ return 0;
+}
+
+static int fsi_master_slave_remove(struct device *dev, void *data)
+{
+ device_for_each_child(dev, NULL, fsi_slave_device_remove);
+ device_unregister(dev);
+ return 0;
+}
+
void fsi_master_unregister(struct fsi_master *master)
{
if (!master || !master->dev)
return;
ida_simple_remove(&master_ida, master->idx);
+ device_for_each_child(master->dev, NULL, fsi_master_slave_remove);
put_device(master->dev);
}
EXPORT_SYMBOL_GPL(fsi_master_unregister);