device: Fix DEVICE_DECLARE macro to be usable inside drivers source code.

Fix an issue where declaring a device in order to use DEVICE_GET macro
resulted in error: 'static declaration follows non-static declaration'.

Change-Id: I3e851e4d34e905601672e60ded50ed888c4d2a3c
Signed-off-by: Michał Kruszewski <mkru@protonmail.com>
This commit is contained in:
Michał Kruszewski 2017-03-14 21:39:04 +01:00 committed by Kumar Gala
commit 5c642e8bdb

View file

@ -268,11 +268,11 @@ extern struct device_pm_ops device_pm_ops_nop;
/** @def DEVICE_DECLARE
*
* @brief Declare a device object
* @brief Declare a static device object
*
* This macro can be used at the top-level to declare a device, such
* that DEVICE_GET() may be used before the full declaration in
* DEVICE_INIT(), or reference the device in another C file.
* DEVICE_INIT().
*
* This is often useful when configuring interrupts statically in a
* device's init or per-instance config function, as the init function
@ -281,7 +281,7 @@ extern struct device_pm_ops device_pm_ops_nop;
*
* @param name Device name
*/
#define DEVICE_DECLARE(name) extern struct device DEVICE_NAME_GET(name)
#define DEVICE_DECLARE(name) static struct device DEVICE_NAME_GET(name)
struct device;