Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 10388edf3 -> b3be6f034
Expose os_dev_loookup() This enables users who want to share a OS device during init to access it using the device name. This should not be called at runtime. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9528e487 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9528e487 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9528e487 Branch: refs/heads/develop Commit: 9528e487960f022e5541cfa4986cc01877ed133c Parents: a42c0c1 Author: Sterling Hughes <sterl...@runtime.io> Authored: Tue Feb 21 16:39:03 2017 -0800 Committer: Sterling Hughes <sterl...@runtime.io> Committed: Tue Feb 21 16:39:03 2017 -0800 ---------------------------------------------------------------------- kernel/os/include/os/os_dev.h | 1 + kernel/os/src/os_dev.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9528e487/kernel/os/include/os/os_dev.h ---------------------------------------------------------------------- diff --git a/kernel/os/include/os/os_dev.h b/kernel/os/include/os/os_dev.h index 5af06b2..ed65a08 100644 --- a/kernel/os/include/os/os_dev.h +++ b/kernel/os/include/os/os_dev.h @@ -108,6 +108,7 @@ os_dev_resume(struct os_dev *dev) int os_dev_create(struct os_dev *dev, char *name, uint8_t stage, uint8_t priority, os_dev_init_func_t od_init, void *arg); +struct os_dev *os_dev_lookup(char *name); int os_dev_initialize_all(uint8_t stage); int os_dev_suspend_all(os_time_t, uint8_t); int os_dev_resume_all(void); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9528e487/kernel/os/src/os_dev.c ---------------------------------------------------------------------- diff --git a/kernel/os/src/os_dev.c b/kernel/os/src/os_dev.c index 139fe13..07b1c54 100644 --- a/kernel/os/src/os_dev.c +++ b/kernel/os/src/os_dev.c @@ -232,13 +232,16 @@ err: } /** - * Lookup a device by name, internal function only. + * Lookup a device by name. + * + * WARNING: This should be called before any locking on the device is done, or + * the device list itself is modified in any context. There is no locking. * * @param name The name of the device to look up. * * @return A pointer to the device corresponding to name, or NULL if not found. */ -static struct os_dev * +struct os_dev * os_dev_lookup(char *name) { struct os_dev *dev;