From dcfd4e96f4602067de726bc1c8a7f6025423f6d4 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Thu, 28 Jan 2016 14:53:28 -0500 Subject: [PATCH] device: remove obsolete DEVICE_DEFINE/INIT_CONFIG_DEFINE() They have been replaced by DEVICE_INIT(). Change-Id: I06551f37593a3debb7eb221badd267bb5c7040c0 Signed-off-by: Benjamin Walsh --- include/device.h | 89 +++----------------------------------- kernel/nanokernel/device.c | 4 +- 2 files changed, 8 insertions(+), 85 deletions(-) diff --git a/include/device.h b/include/device.h index 7b3f5f4ab35..37a4fd540ba 100644 --- a/include/device.h +++ b/include/device.h @@ -88,97 +88,20 @@ extern "C" { .driver_data = data \ } -/** @def DEVICE_DEFINE - * - * @brief Define device object - * - * @details This macro defines a device object that is automatically - * configured by the kernel during system initialization. - * - * @param name Device name. - * - * @param data Pointer to the device's configuration data. - * @sa DEVICE_INIT_CONFIG_DEFINE() - * - * @param level The initialization level at which configuration occurs. - * Must be one of the following symbols, which are listed in the order - * they are performed by the kernel: - * - * PRIMARY: Used for devices that have no dependencies, such as those - * that rely solely on hardware present in the processor/SOC. These devices - * cannot use any kernel services during configuration, since they are not - * yet available. - * - * SECONDARY: Used for devices that rely on the initialization of devices - * initialized as part of the PRIMARY level. These devices cannot use any - * kernel services during configuration, since they are not yet available. - * - * NANOKERNEL: Used for devices that require nanokernel services during - * configuration. - * - * MICROKERNEL: Used for devices that require microkernel services during - * configuration. - * - * APPLICATION: Used for application components (i.e. non-kernel components) - * that need automatic configuration. These devices can use all services - * provided by the kernel during configuration. - * - * @param priority The initialization priority of the device, relative to - * other devices of the same initialization level. Specified as an integer - * value in the range 0 to 99; lower values indicate earlier initialization. - * Must be a decimal integer literal without leading zeroes or sign (e.g. 32), - * or an equivalent symbolic name (e.g. #define MY_INIT_PRIO 32); symbolic - * expressions are *not* permitted - * (e.g. CONFIG_KERNEL_INIT_PRIORITY_DEFAULT + 5). - */ - -#define DEVICE_DEFINE(name, data, level, priority) \ - static struct device (__initconfig_##name) __used \ - __attribute__((__section__(".init_" #level STRINGIFY(priority)))) = { \ - .config = &(config_##name),\ - .driver_data = data} - -/** @def DEVICE_INIT_CONFIG_DEFINE - * - * @brief Define an config object - * - * @details This macro declares an config object to be placed in the - * image by the linker in the ROM region. - * - * @param cfg_name Name of the config object to be created. This name - * must be used in the *_init() macro(s) defined in init.h so the - * linker can associate the config object with the correct init - * object. - * - * @param drv_name The name this instance of the driver exposes to - * the system. - * @param init_fn Address to the init function of the driver. - * @param config The address to the structure containing the - * configuration information for this instance of the driver. - * - * @sa __define_initconfig() - */ -#define DEVICE_INIT_CONFIG_DEFINE(cfg_name, drv_name, init_fn, config) \ - static struct device_config config_##cfg_name __used \ - __attribute__((__section__(".devconfig.init"))) = { \ - .name = drv_name, .init = (init_fn), \ - .config_info = (config) \ - } - /** * @def DEVICE_NAME_GET * * @brief Expands to the full name of a global device object * * @details Return the full name of a device object symbol created by - * DEVICE_DEFINE(), using the @name provided to DEVICE_DEFINE(). + * DEVICE_INIT(), using the @dev_name provided to DEVICE_INIT(). * * It is meant to be used for declaring extern symbols pointing on device * objects before using the DEVICE_GET macro to get the device object. * - * @param name The same name provided to DEVICE_DEFINE() + * @param name The same as dev_name provided to DEVICE_INIT() * - * @return The exanded name of the device object created by DEVICE_DEFINE() + * @return The exanded name of the device object created by DEVICE_INIT() */ #define DEVICE_NAME_GET(name) (_CONCAT(__initconfig_, name)) @@ -188,11 +111,11 @@ extern "C" { * @brief Obtain a pointer to a device object by name * * @details Return the address of a device object created by - * DEVICE_DEFINE(), using the @name provided to DEVICE_DEFINE(). + * DEVICE_INIT(), using the @dev_name provided to DEVICE_INIT(). * - * @param name The same name provided to DEVICE_DEFINE() + * @param name The same as dev_name provided to DEVICE_INIT() * - * @return A pointer to the device object created by DEVICE_DEFINE() + * @return A pointer to the device object created by DEVICE_INIT() */ #define DEVICE_GET(name) (&DEVICE_NAME_GET(name)) diff --git a/kernel/nanokernel/device.c b/kernel/nanokernel/device.c index fc3be13fc2a..f86f95f4164 100644 --- a/kernel/nanokernel/device.c +++ b/kernel/nanokernel/device.c @@ -23,7 +23,7 @@ static struct device *config_levels[] = { * @brief Execute all the device initialization functions at a given level * * @details Invokes the initialization routine for each device object - * created by the DEVICE_DEFINE() macro using the specified level. + * created by the DEVICE_INIT() macro using the specified level. * The linker script places the device objects in memory in the order * they need to be invoked, with symbols indicating where one level leaves * off and the next one begins. @@ -44,7 +44,7 @@ void _sys_device_do_config_level(int level) /** * @brief Retrieve the device structure for a driver by name * - * @details Device objects are created via the DEVICE_DEFINE() macro and + * @details Device objects are created via the DEVICE_INIT() macro and * placed in memory by the linker. If a driver needs to bind to another driver * it can use this function to retrieve the device structure of the lower level * driver by the name the driver exposes to the system.