lkml.org 
[lkml]   [2020]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC v2 3/4] i3c: master: add i3c_for_each_dev helper
    Date
    Introduce i3c_for_each_dev(), an i3c device iterator for use by i3cdev.

    Signed-off-by: Vitor Soares <vitor.soares@synopsys.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
    \
     
     \ /
      Last update: 2020-01-29 13:18    [W:12.976 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site