[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <868e5b37fd817b65e6953ed7279f5063e5fc06c5.1582069402.git.vitor.soares@synopsys.com>
Date: Wed, 19 Feb 2020 01:20:41 +0100
From: Vitor Soares <Vitor.Soares@...opsys.com>
To: linux-kernel@...r.kernel.org, linux-i3c@...ts.infradead.org
Cc: Joao.Pinto@...opsys.com, Jose.Abreu@...opsys.com,
bbrezillon@...nel.org, gregkh@...uxfoundation.org,
wsa@...-dreams.de, arnd@...db.de, broonie@...nel.org,
corbet@....net, Vitor Soares <Vitor.Soares@...opsys.com>
Subject: [PATCH v3 3/5] i3c: master: add i3c_for_each_dev helper
Introduce i3c_for_each_dev(), an i3c device iterator for use by i3cdev.
Signed-off-by: Vitor Soares <vitor.soares@...opsys.com>
---
drivers/i3c/internals.h | 1 +
drivers/i3c/master.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h
index bc062e8..a6deedf 100644
--- a/drivers/i3c/internals.h
+++ b/drivers/i3c/internals.h
@@ -24,4 +24,5 @@ int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev);
int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev,
const struct i3c_ibi_setup *req);
void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
+int i3c_for_each_dev(void *data, int (*fn)(struct device *, void *));
#endif /* I3C_INTERNAL_H */
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 21c4372..8e22da2 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2640,6 +2640,18 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
dev->ibi = NULL;
}
+int i3c_for_each_dev(void *data, int (*fn)(struct device *, void *))
+{
+ int res;
+
+ mutex_lock(&i3c_core_lock);
+ res = bus_for_each_dev(&i3c_bus_type, NULL, data, fn);
+ mutex_unlock(&i3c_core_lock);
+
+ return res;
+}
+EXPORT_SYMBOL_GPL(i3c_for_each_dev);
+
static int __init i3c_init(void)
{
return bus_register(&i3c_bus_type);
--
2.7.4
Powered by blists - more mailing lists