Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571740 > unrolled thread

[PATCH v3 14/18] drivers/fsi: Remove all scanned devices during master unregister

Started byChristopher Bostic <cbostic@linux.vnet.ibm.com>
First post2017-02-01 18:00 +0100
Last post2017-02-01 18:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 14/18] drivers/fsi: Remove all scanned devices during master unregister Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100

#1571740 — [PATCH v3 14/18] drivers/fsi: Remove all scanned devices during master unregister

FromChristopher Bostic <cbostic@linux.vnet.ibm.com>
Date2017-02-01 18:00 +0100
Subject[PATCH v3 14/18] drivers/fsi: Remove all scanned devices during master unregister
Message-ID<t66qe-8ov-17@gated-at.bofh.it>
From: Chris Bostic <cbostic@us.ibm.com>

Master will remove all previously scanned devices during an
unregister operation. This will be necessary should any master
attempt to register more than once.

Signed-off-by: Chris Bostic <cbostic@us.ibm.com>
---
 drivers/fsi/fsi-core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index af7965f..28b82d1 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -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);
-- 
1.8.2.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web