Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][WIP] Make DEVICE init and device_get dt aware #20253

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/linker/ld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
-x assembler-with-cpp
${NOSYSDEF_CFLAG}
-MD -MF ${linker_script_gen}.dep -MT ${base_name}/${linker_script_gen}
-D_LINKER
-D_ASMLANGUAGE
${current_includes}
${current_defines}
${linker_pass_define}
Expand Down
2 changes: 1 addition & 1 deletion drivers/counter/counter_gecko_rtcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static const struct counter_driver_api counter_gecko_driver_api = {

/* RTCC0 */

static struct device DEVICE_NAME_GET(counter_gecko_0);
struct device DEVICE_NAME_GET(counter_gecko_0);

ISR_DIRECT_DECLARE(counter_gecko_isr_0)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/dma_cavs.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static const struct dma_driver_api dw_dma_driver_api = {

/* DMA0 */

static struct device DEVICE_NAME_GET(dw_dma0);
struct device DEVICE_NAME_GET(dw_dma0);

static void dw_dma0_irq_config(void)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/dma_nios2_msgdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static const struct dma_driver_api nios2_msgdma_driver_api = {
};

/* DMA0 */
static struct device DEVICE_NAME_GET(dma0_nios2);
struct device DEVICE_NAME_GET(dma0_nios2);

static int nios2_msgdma0_initialize(struct device *dev)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/dma_sam_xdmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static const struct dma_driver_api sam_xdmac_driver_api = {

/* DMA0 */

static struct device DEVICE_NAME_GET(dma0_sam);
struct device DEVICE_NAME_GET(dma0_sam);

static void dma0_sam_irq_config(void)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_e1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int e1000_probe(struct device *device)
return retval;
}

static struct device DEVICE_NAME_GET(eth_e1000);
struct device DEVICE_NAME_GET(eth_e1000);

static void e1000_init(struct net_if *iface)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ static const struct ethernet_api eth_api = {
#endif
};

static struct device DEVICE_NAME_GET(eth0_sam_gmac);
struct device DEVICE_NAME_GET(eth0_sam_gmac);

static void eth0_irq_config(void)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static void eth_smsc911x_isr(struct device *dev)

/* Bindings to the platform */

static struct device DEVICE_NAME_GET(eth_smsc911x_0);
struct device DEVICE_NAME_GET(eth_smsc911x_0);

int eth_init(struct device *dev)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_stellaris.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static int eth_stellaris_dev_init(struct device *dev)
return 0;
}

static struct device DEVICE_NAME_GET(eth_stellaris);
struct device DEVICE_NAME_GET(eth_stellaris);

static void eth_stellaris_irq_config(struct device *dev)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_stm32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static const struct ethernet_api eth_api = {
.send = eth_tx,
};

static struct device DEVICE_NAME_GET(eth0_stm32_hal);
struct device DEVICE_NAME_GET(eth0_stm32_hal);

static void eth0_irq_config(void)
{
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpio/gpio_cc32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static const struct gpio_cc32xx_config gpio_cc32xx_a0_config = {
.irq_num = DT_GPIO_CC32XX_A0_IRQ+16,
};

static struct device DEVICE_NAME_GET(gpio_cc32xx_a0);
struct device DEVICE_NAME_GET(gpio_cc32xx_a0);
static struct gpio_cc32xx_data gpio_cc32xx_a0_data;

static int gpio_cc32xx_a0_init(struct device *dev)
Expand Down Expand Up @@ -232,7 +232,7 @@ static const struct gpio_cc32xx_config gpio_cc32xx_a1_config = {
.irq_num = DT_GPIO_CC32XX_A1_IRQ+16,
};

static struct device DEVICE_NAME_GET(gpio_cc32xx_a1);
struct device DEVICE_NAME_GET(gpio_cc32xx_a1);
static struct gpio_cc32xx_data gpio_cc32xx_a1_data;

static int gpio_cc32xx_a1_init(struct device *dev)
Expand Down Expand Up @@ -262,7 +262,7 @@ static const struct gpio_cc32xx_config gpio_cc32xx_a2_config = {
.irq_num = DT_GPIO_CC32XX_A2_IRQ+16,
};

static struct device DEVICE_NAME_GET(gpio_cc32xx_a2);
struct device DEVICE_NAME_GET(gpio_cc32xx_a2);
static struct gpio_cc32xx_data gpio_cc32xx_a2_data;

static int gpio_cc32xx_a2_init(struct device *dev)
Expand Down Expand Up @@ -292,7 +292,7 @@ static const struct gpio_cc32xx_config gpio_cc32xx_a3_config = {
.irq_num = DT_GPIO_CC32XX_A3_IRQ+16,
};

static struct device DEVICE_NAME_GET(gpio_cc32xx_a3);
struct device DEVICE_NAME_GET(gpio_cc32xx_a3);
static struct gpio_cc32xx_data gpio_cc32xx_a3_data;

static int gpio_cc32xx_a3_init(struct device *dev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/i2c_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static struct i2c_gecko_config i2c_gecko_config_0 = {

static struct i2c_gecko_data i2c_gecko_data_0;

DEVICE_AND_API_INIT(i2c_gecko_0, DT_INST_0_SILABS_GECKO_I2C_LABEL,
DEVICE_AND_API_INIT_DT(SILABS_GECKO_I2C, 0,
&i2c_gecko_init, &i2c_gecko_data_0, &i2c_gecko_config_0,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&i2c_gecko_driver_api);
Expand Down Expand Up @@ -245,7 +245,7 @@ static struct i2c_gecko_config i2c_gecko_config_1 = {

static struct i2c_gecko_data i2c_gecko_data_1;

DEVICE_AND_API_INIT(i2c_gecko_1, DT_INST_1_SILABS_GECKO_I2C_LABEL,
DEVICE_AND_API_INIT_DT(SILABS_GECKO_I2C, 1,
&i2c_gecko_init, &i2c_gecko_data_1, &i2c_gecko_config_1,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&i2c_gecko_driver_api);
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/i2c_sam_twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = {
/* I2C0 */

#ifdef CONFIG_I2C_0
static struct device DEVICE_NAME_GET(i2c0_sam);
struct device DEVICE_NAME_GET(i2c0_sam);

static void i2c0_sam_irq_config(void)
{
Expand Down Expand Up @@ -369,7 +369,7 @@ DEVICE_AND_API_INIT(i2c0_sam, DT_I2C_0_NAME, &i2c_sam_twi_initialize,
/* I2C1 */

#ifdef CONFIG_I2C_1
static struct device DEVICE_NAME_GET(i2c1_sam);
struct device DEVICE_NAME_GET(i2c1_sam);

static void i2c1_sam_irq_config(void)
{
Expand Down
6 changes: 3 additions & 3 deletions drivers/i2c/i2c_sam_twihs.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = {
/* I2C0 */

#ifdef CONFIG_I2C_0
static struct device DEVICE_NAME_GET(i2c0_sam);
struct device DEVICE_NAME_GET(i2c0_sam);

static void i2c0_sam_irq_config(void)
{
Expand Down Expand Up @@ -356,7 +356,7 @@ DEVICE_AND_API_INIT(i2c0_sam, DT_I2C_0_NAME, &i2c_sam_twihs_initialize,
/* I2C1 */

#ifdef CONFIG_I2C_1
static struct device DEVICE_NAME_GET(i2c1_sam);
struct device DEVICE_NAME_GET(i2c1_sam);

static void i2c1_sam_irq_config(void)
{
Expand Down Expand Up @@ -386,7 +386,7 @@ DEVICE_AND_API_INIT(i2c1_sam, DT_I2C_1_NAME, &i2c_sam_twihs_initialize,
/* I2C2 */

#ifdef CONFIG_I2C_2
static struct device DEVICE_NAME_GET(i2c2_sam);
struct device DEVICE_NAME_GET(i2c2_sam);

static void i2c2_sam_irq_config(void)
{
Expand Down
10 changes: 5 additions & 5 deletions drivers/i2s/i2s_ll_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ static struct device *get_dev_from_tx_dma_channel(u32_t dma_channel)
}

#ifdef CONFIG_I2S_1
static struct device DEVICE_NAME_GET(i2s_stm32_1);
struct device DEVICE_NAME_GET(i2s_stm32_1);

static void i2s_stm32_irq_config_func_1(struct device *dev);

Expand Down Expand Up @@ -889,7 +889,7 @@ static void i2s_stm32_irq_config_func_1(struct device *dev)
#endif /* CONFIG_I2S_1 */

#ifdef CONFIG_I2S_2
static struct device DEVICE_NAME_GET(i2s_stm32_2);
struct device DEVICE_NAME_GET(i2s_stm32_2);

static void i2s_stm32_irq_config_func_2(struct device *dev);

Expand Down Expand Up @@ -959,7 +959,7 @@ static void i2s_stm32_irq_config_func_2(struct device *dev)
#endif /* CONFIG_I2S_2 */

#ifdef CONFIG_I2S_3
static struct device DEVICE_NAME_GET(i2s_stm32_3);
struct device DEVICE_NAME_GET(i2s_stm32_3);

static void i2s_stm32_irq_config_func_3(struct device *dev);

Expand Down Expand Up @@ -1029,7 +1029,7 @@ static void i2s_stm32_irq_config_func_3(struct device *dev)
#endif /* CONFIG_I2S_3 */

#ifdef CONFIG_I2S_4
static struct device DEVICE_NAME_GET(i2s_stm32_4);
struct device DEVICE_NAME_GET(i2s_stm32_4);

static void i2s_stm32_irq_config_func_4(struct device *dev);

Expand Down Expand Up @@ -1099,7 +1099,7 @@ static void i2s_stm32_irq_config_func_4(struct device *dev)
#endif /* CONFIG_I2S_4 */

#ifdef CONFIG_I2S_5
static struct device DEVICE_NAME_GET(i2s_stm32_5);
struct device DEVICE_NAME_GET(i2s_stm32_5);

static void i2s_stm32_irq_config_func_5(struct device *dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2s/i2s_sam_ssc.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ static const struct i2s_driver_api i2s_sam_driver_api = {

/* I2S0 */

static struct device DEVICE_NAME_GET(i2s0_sam);
struct device DEVICE_NAME_GET(i2s0_sam);

static struct device *get_dev_from_dma_channel(u32_t dma_channel)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/neural_net/intel_gna.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void intel_gna_config_desc_dump(struct device *dev);

#define GNA_MODEL_VIRT_BASE_DEFAULT 0

static struct device DEVICE_NAME_GET(gna);
struct device DEVICE_NAME_GET(gna);
static struct intel_gna_config_desc __aligned(GNA_PG_SIZE_IN_BYTES)
gna_config_desc;
static struct intel_gna_page_table __aligned(GNA_PG_SIZE_IN_BYTES)
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_cc32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct uart_cc32xx_dev_data_t {
#define PRIME_CHAR '\r'

/* Forward decls: */
static struct device DEVICE_NAME_GET(uart_cc32xx_0);
struct device DEVICE_NAME_GET(uart_cc32xx_0);

#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void uart_cc32xx_isr(void *arg);
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_msp432p4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct uart_msp432p4xx_dev_data_t {
#define DEV_DATA(dev) \
((struct uart_msp432p4xx_dev_data_t * const)(dev)->driver_data)

static struct device DEVICE_NAME_GET(uart_msp432p4xx_0);
struct device DEVICE_NAME_GET(uart_msp432p4xx_0);

#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void uart_msp432p4xx_isr(void *arg);
Expand Down
2 changes: 1 addition & 1 deletion drivers/watchdog/wdt_sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct wdt_sam_dev_cfg {
Wdt *regs;
};

static struct device DEVICE_NAME_GET(wdt_sam);
struct device DEVICE_NAME_GET(wdt_sam);

struct wdt_sam_dev_data {
wdt_callback_t cb;
Expand Down
2 changes: 1 addition & 1 deletion drivers/watchdog/wdt_sam0.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct wdt_sam0_dev_data {
bool timeout_valid;
};

static struct device DEVICE_NAME_GET(wdt_sam0);
struct device DEVICE_NAME_GET(wdt_sam0);

static struct wdt_sam0_dev_data wdt_sam0_data = { 0 };

Expand Down
3 changes: 0 additions & 3 deletions include/arch/arc/v2/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
* @brief Common parts of the linker scripts for the ARCv2/EM targets.
*/

#define _LINKER
#define _ASMLANGUAGE

#include <linker/sections.h>

#if defined(CONFIG_UART_NSIM)
Expand Down
3 changes: 0 additions & 3 deletions include/arch/arm/cortex_m/scripts/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
* Linker script for the Cortex-M platforms.
*/

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <linker/sections.h>
#include <generated_dts_board.h>
Expand Down
3 changes: 0 additions & 3 deletions include/arch/arm/cortex_r/scripts/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
* Linker script for the Cortex-R platforms.
*/

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <linker/sections.h>
#include <generated_dts_board.h>
Expand Down
3 changes: 0 additions & 3 deletions include/arch/nios2/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
* Linker script for the Nios II platform
*/

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <linker/sections.h>

Expand Down
3 changes: 0 additions & 3 deletions include/arch/posix/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
* Linker script for the POSIX (native) platform
*/

#define _LINKER
#define _ASMLANGUAGE

#include <autoconf.h>
#include <linker/sections.h>

Expand Down
3 changes: 0 additions & 3 deletions include/arch/riscv/common/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
* Generic Linker script for the riscv platform
*/

#define _LINKER
#define _ASMLANGUAGE

#include <soc.h>

#include <autoconf.h>
Expand Down
3 changes: 0 additions & 3 deletions include/arch/x86/ia32/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
* order when programming the MMU.
*/

#define _LINKER

#define _ASMLANGUAGE
#include <linker/linker-defs.h>
#include <offsets.h>
#include <sys/util.h>
Expand Down
3 changes: 0 additions & 3 deletions include/arch/x86/intel64/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

#define _LINKER
#define _ASMLANGUAGE

#include <linker/linker-defs.h>
#include <linker/linker-tool.h>

Expand Down
Loading