zephyr/kernel/nanokernel
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
..
include kernel: Combine nano_timers and nano_timeouts 2016-03-26 09:20:10 +00:00
compiler_stack_protect.c remove redundant checking for CONFIG_STACK_CANARIES 2016-02-11 18:48:45 +00:00
device.c device_get_binding() returns NULL if driver_api is not set 2016-04-12 19:30:35 +08:00
event_logger.c nano_sema: Simplify nano_xxx_sem_take() API family 2016-02-05 20:25:14 -05:00
idle.c kernel: Combine nano_timers and nano_timeouts 2016-03-26 09:20:10 +00:00
int_latency_bench.c x86: streamline irq_lock()/irq_unlock() 2016-02-05 20:25:13 -05:00
Kconfig kernel: fix boot banner option 2016-03-14 16:50:50 -04:00
kernel_event_logger.c init: use SYS_INIT() where it makes sense 2016-02-05 20:25:25 -05:00
Makefile power_mgmt: Make names consistent with new RFC 2016-03-26 14:35:11 -04:00
nano_context.c arm: Enable support for sys_thread_busy_wait() 2016-02-11 14:13:05 +00:00
nano_fiber.c nanokernel: Change fiber_start() return type 2016-02-23 10:48:54 -05:00
nano_fifo.c nano_fifo: Fix problem with nano_fifo and timeouts 2016-04-12 01:22:42 +00:00
nano_init.c kernel: Combine nano_timers and nano_timeouts 2016-03-26 09:20:10 +00:00
nano_lifo.c debug: kernel's object tracing api 2016-03-11 12:00:07 +00:00
nano_sema.c debug: kernel's object tracing api 2016-03-11 12:00:07 +00:00
nano_sleep.c microkernel: Add support for *_sleep() during initialization 2016-03-26 10:17:15 +00:00
nano_stack.c debug: adds object tracing capability to nano stack 2016-03-11 22:12:26 +00:00
nano_sys_clock.c kernel: Combine nano_timers and nano_timeouts 2016-03-26 09:20:10 +00:00
nano_timer.c kernel: Combine nano_timers and nano_timeouts 2016-03-26 09:20:10 +00:00
ring_buffer.c checkpatch: error - spacing 2016-02-05 20:24:31 -05:00
version.c Change BSD-3 licenses to Apache 2 2016-02-05 20:24:29 -05:00