zephyr/kernel
Daniel Leung dd5e90ec6c device_get_binding() returns NULL if driver_api is not set
This changes the behavior of device_get_binding() so that
it returns NULL if driver_api is not set. This provides
a way for driver to state that it has not been initialized
properly, and prevents app from using it since no reference
to the device struct will be returned.

This implements the idea specified in [1]. The idea is to
reuse an existing resource by piggy-backing onto driver_api,
thus avoiding an extra "device state" variable in the device
struct. This differs from the code specified in the mailing
list by checking driver_api for NULL first. This avoids
the unnecessary strcmp() if driver_api is NULL.

[1] https://lists.zephyrproject.org/archives/list/devel@lists.zephyrproject.org/message/MZB5PYBSRHV3NIEHJYXYQVLTPFIIHPB3/

Change-Id: I978b1a6683cd56c8a72532d6368c47e67515c82d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
..
configs kconfig: use zephyr as the binary name globally 2016-02-05 20:24:22 -05:00
microkernel kernel: Make idle task sleep 2016-04-08 15:08:33 +00:00
nanokernel device_get_binding() returns NULL if driver_api is not set 2016-04-12 19:30:35 +08:00
Kconfig refactor common driver initialization priorities 2016-03-28 15:58:29 -07:00
Makefile Kbuild: adapt Makefile/Kconfig to kernel/common/ removal 2016-02-05 20:14:06 -05:00