drivers: flash: Place API into iterable section

Add wrapper DEVICE_API macro to all flash_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-11-28 21:10:42 +01:00 committed by Fabio Baltieri
commit 9dd07da0a1
49 changed files with 58 additions and 57 deletions

View file

@ -211,7 +211,7 @@ static void flash_ambiq_pages_layout(const struct device *dev,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_ambiq_driver_api = { static DEVICE_API(flash, flash_ambiq_driver_api) = {
.read = flash_ambiq_read, .read = flash_ambiq_read,
.write = flash_ambiq_write, .write = flash_ambiq_write,
.erase = flash_ambiq_erase, .erase = flash_ambiq_erase,

View file

@ -880,7 +880,7 @@ flash_andes_qspi_get_parameters(const struct device *dev)
return &config->parameters; return &config->parameters;
} }
static const struct flash_driver_api flash_andes_qspi_api = { static DEVICE_API(flash, flash_andes_qspi_api) = {
.read = flash_andes_qspi_read, .read = flash_andes_qspi_read,
.write = flash_andes_qspi_write, .write = flash_andes_qspi_write,
.erase = flash_andes_qspi_erase, .erase = flash_andes_qspi_erase,

View file

@ -143,7 +143,7 @@ static const struct flash_parameters *flash_cdns_get_parameters(const struct dev
return &flash_cdns_parameters; return &flash_cdns_parameters;
} }
static const struct flash_driver_api flash_cdns_nand_api = { static DEVICE_API(flash, flash_cdns_nand_api) = {
.erase = flash_cdns_nand_erase, .erase = flash_cdns_nand_erase,
.write = flash_cdns_nand_write, .write = flash_cdns_nand_write,
.read = flash_cdns_nand_read, .read = flash_cdns_nand_read,

View file

@ -109,7 +109,7 @@ flash_cad_get_parameters(const struct device *dev)
return &flash_cad_parameters; return &flash_cad_parameters;
} }
static const struct flash_driver_api flash_cad_api = { static DEVICE_API(flash, flash_cad_api) = {
.erase = flash_cad_erase, .erase = flash_cad_erase,
.write = flash_cad_write, .write = flash_cad_write,
.read = flash_cad_read, .read = flash_cad_read,

View file

@ -161,7 +161,7 @@ static int flash_esp32_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_esp32_driver_api = { static DEVICE_API(flash, flash_esp32_driver_api) = {
.read = flash_esp32_read, .read = flash_esp32_read,
.write = flash_esp32_write, .write = flash_esp32_write,
.erase = flash_esp32_erase, .erase = flash_esp32_erase,

View file

@ -98,7 +98,7 @@ flash_gd32_get_parameters(const struct device *dev)
return &flash_gd32_parameters; return &flash_gd32_parameters;
} }
static const struct flash_driver_api flash_gd32_driver_api = { static DEVICE_API(flash, flash_gd32_driver_api) = {
.read = flash_gd32_read, .read = flash_gd32_read,
.write = flash_gd32_write, .write = flash_gd32_write,
.erase = flash_gd32_erase, .erase = flash_gd32_erase,

View file

@ -216,7 +216,7 @@ static int flash_gecko_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_gecko_driver_api = { static DEVICE_API(flash, flash_gecko_driver_api) = {
.read = flash_gecko_read, .read = flash_gecko_read,
.write = flash_gecko_write, .write = flash_gecko_write,
.erase = flash_gecko_erase, .erase = flash_gecko_erase,

View file

@ -51,7 +51,7 @@ void flash_ra_page_layout(const struct device *dev, const struct flash_pages_lay
static int flash_ra_ex_op(const struct device *dev, uint16_t code, const uintptr_t in, void *out); static int flash_ra_ex_op(const struct device *dev, uint16_t code, const uintptr_t in, void *out);
#endif #endif
static const struct flash_driver_api flash_ra_api = { static DEVICE_API(flash, flash_ra_api) = {
.erase = flash_ra_erase, .erase = flash_ra_erase,
.write = flash_ra_write, .write = flash_ra_write,
.read = flash_ra_read, .read = flash_ra_read,

View file

@ -184,7 +184,7 @@ static int ifx_cat1_flash_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api ifx_cat1_flash_driver_api = { static DEVICE_API(flash, ifx_cat1_flash_driver_api) = {
.read = ifx_cat1_flash_read, .read = ifx_cat1_flash_read,
.write = ifx_cat1_flash_write, .write = ifx_cat1_flash_write,
.erase = ifx_cat1_flash_erase, .erase = ifx_cat1_flash_erase,

View file

@ -326,7 +326,7 @@ static int ifx_cat1_flash_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api ifx_cat1_flash_driver_api = { static DEVICE_API(flash, ifx_cat1_flash_driver_api) = {
.read = ifx_cat1_flash_read, .read = ifx_cat1_flash_read,
.write = ifx_cat1_flash_write, .write = ifx_cat1_flash_write,
.erase = ifx_cat1_flash_erase, .erase = ifx_cat1_flash_erase,

View file

@ -499,7 +499,7 @@ static void flash_it8xxx2_pages_layout(const struct device *dev,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_it8xxx2_api = { static DEVICE_API(flash, flash_it8xxx2_api) = {
.erase = flash_it8xxx2_erase, .erase = flash_it8xxx2_erase,
.write = flash_it8xxx2_write, .write = flash_it8xxx2_write,
.read = flash_it8xxx2_read, .read = flash_it8xxx2_read,

View file

@ -132,7 +132,7 @@ static int flash_max32_init(const struct device *dev)
return ret != 0 ? -EIO : 0; return ret != 0 ? -EIO : 0;
} }
static const struct flash_driver_api flash_max32_driver_api = { static DEVICE_API(flash, flash_max32_driver_api) = {
.read = api_read, .read = api_read,
.write = api_write, .write = api_write,
.erase = api_erase, .erase = api_erase,

View file

@ -633,7 +633,7 @@ static int flash_flexspi_hyperflash_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_flexspi_hyperflash_api = { static DEVICE_API(flash, flash_flexspi_hyperflash_api) = {
.read = flash_flexspi_hyperflash_read, .read = flash_flexspi_hyperflash_read,
.write = flash_flexspi_hyperflash_write, .write = flash_flexspi_hyperflash_write,
.erase = flash_flexspi_hyperflash_erase, .erase = flash_flexspi_hyperflash_erase,

View file

@ -557,7 +557,7 @@ static int flash_flexspi_nor_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_flexspi_nor_api = { static DEVICE_API(flash, flash_flexspi_nor_api) = {
.erase = flash_flexspi_nor_erase, .erase = flash_flexspi_nor_erase,
.write = flash_flexspi_nor_write, .write = flash_flexspi_nor_write,
.read = flash_flexspi_nor_read, .read = flash_flexspi_nor_read,

View file

@ -1264,7 +1264,7 @@ static int flash_flexspi_nor_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_flexspi_nor_api = { static DEVICE_API(flash, flash_flexspi_nor_api) = {
.erase = flash_flexspi_nor_erase, .erase = flash_flexspi_nor_erase,
.write = flash_flexspi_nor_write, .write = flash_flexspi_nor_write,
.read = flash_flexspi_nor_read, .read = flash_flexspi_nor_read,

View file

@ -774,7 +774,7 @@ static int flash_mspi_atxp032_pm_action(const struct device *flash, enum pm_devi
} }
#endif /** IS_ENABLED(CONFIG_PM_DEVICE) */ #endif /** IS_ENABLED(CONFIG_PM_DEVICE) */
static const struct flash_driver_api flash_mspi_atxp032_api = { static DEVICE_API(flash, flash_mspi_atxp032_api) = {
.erase = flash_mspi_atxp032_erase, .erase = flash_mspi_atxp032_erase,
.write = flash_mspi_atxp032_write, .write = flash_mspi_atxp032_write,
.read = flash_mspi_atxp032_read, .read = flash_mspi_atxp032_read,

View file

@ -339,7 +339,7 @@ static void flash_mspi_emul_pages_layout(const struct device *flash,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_mspi_emul_device_api = { static DEVICE_API(flash, flash_mspi_emul_device_api) = {
.erase = flash_mspi_emul_erase, .erase = flash_mspi_emul_erase,
.write = flash_mspi_emul_write, .write = flash_mspi_emul_write,
.read = flash_mspi_emul_read, .read = flash_mspi_emul_read,

View file

@ -509,7 +509,7 @@ static int flash_npcx_nor_ex_op(const struct device *dev, uint16_t code,
} }
#endif #endif
static const struct flash_driver_api flash_npcx_nor_driver_api = { static DEVICE_API(flash, flash_npcx_nor_driver_api) = {
.read = flash_npcx_nor_read, .read = flash_npcx_nor_read,
.write = flash_npcx_nor_write, .write = flash_npcx_nor_write,
.erase = flash_npcx_nor_erase, .erase = flash_npcx_nor_erase,

View file

@ -935,7 +935,7 @@ static int nxp_s32_qspi_init(const struct device *dev)
return ret; return ret;
} }
static const struct flash_driver_api nxp_s32_qspi_api = { static DEVICE_API(flash, nxp_s32_qspi_api) = {
.erase = nxp_s32_qspi_erase, .erase = nxp_s32_qspi_erase,
.write = nxp_s32_qspi_write, .write = nxp_s32_qspi_write,
.read = nxp_s32_qspi_read, .read = nxp_s32_qspi_read,

View file

@ -306,7 +306,7 @@ void flash_rpi_page_layout(const struct device *dev, const struct flash_pages_la
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_rpi_driver_api = { static DEVICE_API(flash, flash_rpi_driver_api) = {
.read = flash_rpi_read, .read = flash_rpi_read,
.write = flash_rpi_write, .write = flash_rpi_write,
.erase = flash_rpi_erase, .erase = flash_rpi_erase,

View file

@ -464,7 +464,7 @@ static void sam_flash_api_pages_layout(const struct device *dev,
*layout_size = config->pages_layouts_size; *layout_size = config->pages_layouts_size;
} }
static struct flash_driver_api sam_flash_api = { static DEVICE_API(flash, sam_flash_api) = {
.read = sam_flash_read, .read = sam_flash_read,
.write = sam_flash_write, .write = sam_flash_write,
.erase = sam_flash_erase, .erase = sam_flash_erase,

View file

@ -487,7 +487,7 @@ static int flash_sam0_init(const struct device *dev)
return flash_sam0_write_protection(dev, false); return flash_sam0_write_protection(dev, false);
} }
static const struct flash_driver_api flash_sam0_api = { static DEVICE_API(flash, flash_sam0_api) = {
.erase = flash_sam0_erase, .erase = flash_sam0_erase,
.write = flash_sam0_write, .write = flash_sam0_write,
.read = flash_sam0_read, .read = flash_sam0_read,

View file

@ -197,7 +197,7 @@ static int flash_si32_init(const struct device *dev)
return 0; return 0;
} }
static const struct flash_driver_api flash_si32_driver_api = { static DEVICE_API(flash, flash_si32_driver_api) = {
.read = flash_si32_read, .read = flash_si32_read,
.write = flash_si32_write, .write = flash_si32_write,
.erase = flash_si32_erase, .erase = flash_si32_erase,

View file

@ -158,7 +158,7 @@ static uint8_t mock_flash[FLASH_SIMULATOR_FLASH_SIZE];
#endif #endif
#endif /* CONFIG_ARCH_POSIX */ #endif /* CONFIG_ARCH_POSIX */
static const struct flash_driver_api flash_sim_api; static DEVICE_API(flash, flash_sim_api);
static const struct flash_parameters flash_sim_parameters = { static const struct flash_parameters flash_sim_parameters = {
.write_block_size = FLASH_SIMULATOR_PROG_UNIT, .write_block_size = FLASH_SIMULATOR_PROG_UNIT,
@ -380,7 +380,7 @@ flash_sim_get_parameters(const struct device *dev)
return &flash_sim_parameters; return &flash_sim_parameters;
} }
static const struct flash_driver_api flash_sim_api = { static DEVICE_API(flash, flash_sim_api) = {
.read = flash_sim_read, .read = flash_sim_read,
.write = flash_sim_write, .write = flash_sim_write,
.erase = flash_sim_erase, .erase = flash_sim_erase,

View file

@ -270,7 +270,7 @@ void flash_smartbond_page_layout(const struct device *dev,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_smartbond_driver_api = { static DEVICE_API(flash, flash_smartbond_driver_api) = {
.read = flash_smartbond_read, .read = flash_smartbond_read,
.write = flash_smartbond_write, .write = flash_smartbond_write,
.erase = flash_smartbond_erase, .erase = flash_smartbond_erase,

View file

@ -507,7 +507,7 @@ static struct flash_stm32_priv flash_data = {
#endif #endif
}; };
static const struct flash_driver_api flash_stm32_api = { static DEVICE_API(flash, flash_stm32_api) = {
.erase = flash_stm32_erase, .erase = flash_stm32_erase,
.write = flash_stm32_write, .write = flash_stm32_write,
.read = flash_stm32_read, .read = flash_stm32_read,

View file

@ -1702,7 +1702,7 @@ static void flash_stm32_ospi_pages_layout(const struct device *dev,
} }
#endif #endif
static const struct flash_driver_api flash_stm32_ospi_driver_api = { static DEVICE_API(flash, flash_stm32_ospi_driver_api) = {
.read = flash_stm32_ospi_read, .read = flash_stm32_ospi_read,
.write = flash_stm32_ospi_write, .write = flash_stm32_ospi_write,
.erase = flash_stm32_ospi_erase, .erase = flash_stm32_ospi_erase,

View file

@ -885,7 +885,7 @@ static void flash_stm32_qspi_pages_layout(const struct device *dev,
} }
#endif #endif
static const struct flash_driver_api flash_stm32_qspi_driver_api = { static DEVICE_API(flash, flash_stm32_qspi_driver_api) = {
.read = flash_stm32_qspi_read, .read = flash_stm32_qspi_read,
.write = flash_stm32_qspi_write, .write = flash_stm32_qspi_write,
.erase = flash_stm32_qspi_erase, .erase = flash_stm32_qspi_erase,

View file

@ -1539,7 +1539,7 @@ static void flash_stm32_xspi_pages_layout(const struct device *dev,
} }
#endif #endif
static const struct flash_driver_api flash_stm32_xspi_driver_api = { static DEVICE_API(flash, flash_stm32_xspi_driver_api) = {
.read = flash_stm32_xspi_read, .read = flash_stm32_xspi_read,
.write = flash_stm32_xspi_write, .write = flash_stm32_xspi_write,
.erase = flash_stm32_xspi_erase, .erase = flash_stm32_xspi_erase,

View file

@ -668,7 +668,7 @@ static struct flash_stm32_priv flash_data = {
#endif #endif
}; };
static const struct flash_driver_api flash_stm32h7_api = { static DEVICE_API(flash, flash_stm32h7_api) = {
.erase = flash_stm32h7_erase, .erase = flash_stm32h7_erase,
.write = flash_stm32h7_write, .write = flash_stm32h7_write,
.read = flash_stm32h7_read, .read = flash_stm32h7_read,

View file

@ -427,7 +427,7 @@ void flash_wb0x_pages_layout(const struct device *dev,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_wb0x_api = { static DEVICE_API(flash, flash_wb0x_api) = {
.erase = flash_wb0x_erase, .erase = flash_wb0x_erase,
.write = flash_wb0x_write, .write = flash_wb0x_write,
.read = flash_wb0x_read, .read = flash_wb0x_read,

View file

@ -198,7 +198,7 @@ void flash_stm32wba_page_layout(const struct device *dev,
*layout_size = 1; *layout_size = 1;
} }
static const struct flash_driver_api flash_stm32_api = { static DEVICE_API(flash, flash_stm32_api) = {
.erase = flash_stm32_erase, .erase = flash_stm32_erase,
.write = flash_stm32_write, .write = flash_stm32_write,
.read = flash_stm32_read, .read = flash_stm32_read,

View file

@ -1185,7 +1185,7 @@ int qspi_nor_get_size(const struct device *dev, uint64_t *size)
return 0; return 0;
} }
static const struct flash_driver_api qspi_nor_api = { static DEVICE_API(flash, qspi_nor_api) = {
.read = qspi_nor_read, .read = qspi_nor_read,
.write = qspi_nor_write, .write = qspi_nor_write,
.erase = qspi_nor_erase, .erase = qspi_nor_erase,

View file

@ -220,7 +220,7 @@ static void flash_b91_pages_layout(const struct device *dev,
static struct flash_b91_data flash_data; static struct flash_b91_data flash_data;
static const struct flash_driver_api flash_b91_api = { static DEVICE_API(flash, flash_b91_api) = {
.erase = flash_b91_erase, .erase = flash_b91_erase,
.write = flash_b91_write, .write = flash_b91_write,
.read = flash_b91_read, .read = flash_b91_read,

View file

@ -288,7 +288,7 @@ static void flash_cc13xx_cc26xx_layout(const struct device *dev,
} }
#endif /* CONFIG_FLASH_PAGE_LAYOUT */ #endif /* CONFIG_FLASH_PAGE_LAYOUT */
static const struct flash_driver_api flash_cc13xx_cc26xx_api = { static DEVICE_API(flash, flash_cc13xx_cc26xx_api) = {
.erase = flash_cc13xx_cc26xx_erase, .erase = flash_cc13xx_cc26xx_erase,
.write = flash_cc13xx_cc26xx_write, .write = flash_cc13xx_cc26xx_write,
.read = flash_cc13xx_cc26xx_read, .read = flash_cc13xx_cc26xx_read,

View file

@ -145,7 +145,7 @@ flash_lpc_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_lpc_api = { static DEVICE_API(flash, flash_lpc_api) = {
.erase = flash_lpc_erase, .erase = flash_lpc_erase,
.write = flash_lpc_write, .write = flash_lpc_write,
.read = flash_lpc_read, .read = flash_lpc_read,

View file

@ -346,7 +346,7 @@ flash_mcux_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_mcux_api = { static DEVICE_API(flash, flash_mcux_api) = {
.erase = flash_mcux_erase, .erase = flash_mcux_erase,
.write = flash_mcux_write, .write = flash_mcux_write,
.read = flash_mcux_read, .read = flash_mcux_read,

View file

@ -490,7 +490,7 @@ flash_nios2_qspi_get_parameters(const struct device *dev)
return &flash_nios2_qspi_parameters; return &flash_nios2_qspi_parameters;
} }
static const struct flash_driver_api flash_nios2_qspi_api = { static DEVICE_API(flash, flash_nios2_qspi_api) = {
.erase = flash_nios2_qspi_erase, .erase = flash_nios2_qspi_erase,
.write = flash_nios2_qspi_write, .write = flash_nios2_qspi_write,
.read = flash_nios2_qspi_read, .read = flash_nios2_qspi_read,

View file

@ -290,7 +290,7 @@ flash_nrf_get_parameters(const struct device *dev)
return &flash_nrf_parameters; return &flash_nrf_parameters;
} }
static const struct flash_driver_api flash_nrf_api = { static DEVICE_API(flash, flash_nrf_api) = {
.read = flash_nrf_read, .read = flash_nrf_read,
.write = flash_nrf_write, .write = flash_nrf_write,
.erase = flash_nrf_erase, .erase = flash_nrf_erase,

View file

@ -175,7 +175,7 @@ static void nrf_mram_page_layout(const struct device *dev, const struct flash_pa
} }
#endif #endif
static const struct flash_driver_api nrf_mram_api = { static DEVICE_API(flash, nrf_mram_api) = {
.read = nrf_mram_read, .read = nrf_mram_read,
.write = nrf_mram_write, .write = nrf_mram_write,
.erase = nrf_mram_erase, .erase = nrf_mram_erase,

View file

@ -342,7 +342,7 @@ static void nrf_rram_page_layout(const struct device *dev, const struct flash_pa
} }
#endif #endif
static const struct flash_driver_api nrf_rram_api = { static DEVICE_API(flash, nrf_rram_api) = {
.read = nrf_rram_read, .read = nrf_rram_read,
.write = nrf_rram_write, .write = nrf_rram_write,
.erase = nrf_rram_erase, .erase = nrf_rram_erase,

View file

@ -252,7 +252,7 @@ static const struct flash_parameters *flash_numaker_get_parameters(const struct
static struct flash_numaker_data flash_data; static struct flash_numaker_data flash_data;
static const struct flash_driver_api flash_numaker_api = { static DEVICE_API(flash, flash_numaker_api) = {
.erase = flash_numaker_erase, .erase = flash_numaker_erase,
.write = flash_numaker_write, .write = flash_numaker_write,
.read = flash_numaker_read, .read = flash_numaker_read,

View file

@ -246,7 +246,7 @@ static const struct flash_parameters *flash_numaker_get_parameters(const struct
static struct flash_numaker_data flash_data; static struct flash_numaker_data flash_data;
static const struct flash_driver_api flash_numaker_api = { static DEVICE_API(flash, flash_numaker_api) = {
.erase = flash_numaker_erase, .erase = flash_numaker_erase,
.write = flash_numaker_write, .write = flash_numaker_write,
.read = flash_numaker_read, .read = flash_numaker_read,

View file

@ -132,7 +132,7 @@ flash_mcux_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_mcux_api = { static DEVICE_API(flash, flash_mcux_api) = {
.erase = flash_mcux_erase, .erase = flash_mcux_erase,
.write = flash_mcux_write, .write = flash_mcux_write,
.read = flash_mcux_read, .read = flash_mcux_read,

View file

@ -180,14 +180,15 @@ static const struct flash_parameters *flash_xmc4xxx_get_parameters(const struct
return &dev_config->parameters; return &dev_config->parameters;
} }
static const struct flash_driver_api flash_xmc4xxx_api = {.erase = flash_xmc4xxx_erase, static DEVICE_API(flash, flash_xmc4xxx_api) = {
.write = flash_xmc4xxx_write, .erase = flash_xmc4xxx_erase,
.read = flash_xmc4xxx_read, .write = flash_xmc4xxx_write,
.read = flash_xmc4xxx_read,
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
.page_layout = flash_xmc4xxx_page_layout, .page_layout = flash_xmc4xxx_page_layout,
#endif #endif
.get_parameters = .get_parameters = flash_xmc4xxx_get_parameters,
flash_xmc4xxx_get_parameters}; };
static struct flash_xmc4xxx_data flash_xmc4xxx_data_0; static struct flash_xmc4xxx_data flash_xmc4xxx_data_0;
static struct flash_xmc4xxx_config flash_xmc4xxx_cfg_0 = { static struct flash_xmc4xxx_config flash_xmc4xxx_cfg_0 = {

View file

@ -655,7 +655,7 @@ static int spi_flash_at45_get_size(const struct device *dev, uint64_t *size)
return 0; return 0;
} }
static const struct flash_driver_api spi_flash_at45_api = { static DEVICE_API(flash, spi_flash_at45_api) = {
.read = spi_flash_at45_read, .read = spi_flash_at45_read,
.write = spi_flash_at45_write, .write = spi_flash_at45_write,
.erase = spi_flash_at45_erase, .erase = spi_flash_at45_erase,

View file

@ -1683,7 +1683,7 @@ static int flash_nor_get_size(const struct device *dev, uint64_t *size)
return 0; return 0;
} }
static const struct flash_driver_api spi_nor_api = { static DEVICE_API(flash, spi_nor_api) = {
.read = spi_nor_read, .read = spi_nor_read,
.write = spi_nor_write, .write = spi_nor_write,
.erase = spi_nor_erase, .erase = spi_nor_erase,

View file

@ -50,7 +50,7 @@ static struct device_state some_dev_state = {
}; };
/* Device with get_size */ /* Device with get_size */
const static struct flash_driver_api size_fun_api = { static DEVICE_API(flash, size_fun_api) = {
.get_size = some_get_size, .get_size = some_get_size,
}; };
const static struct device size_fun_dev = { const static struct device size_fun_dev = {
@ -61,7 +61,7 @@ const static struct device size_fun_dev = {
}; };
/* No functions device */ /* No functions device */
const static struct flash_driver_api no_fun_api = {0}; static DEVICE_API(flash, no_fun_api) = {0};
const static struct device no_fun_dev = { const static struct device no_fun_dev = {
"no_fun", "no_fun",
NULL, NULL,
@ -70,7 +70,7 @@ const static struct device no_fun_dev = {
}; };
/* Device with get_size implemented but returning -ENOTSUP */ /* Device with get_size implemented but returning -ENOTSUP */
static struct flash_driver_api enotsup_fun_api = { static DEVICE_API(flash, enotsup_fun_api) = {
.get_size = enotsup_get_size, .get_size = enotsup_get_size,
}; };
static struct device enotsup_fun_dev = { static struct device enotsup_fun_dev = {

View file

@ -77,7 +77,7 @@ static void test_flash_ram_pages_layout(const struct device *dev,
*layout_size = ARRAY_SIZE(dev_layout); *layout_size = ARRAY_SIZE(dev_layout);
} }
static const struct flash_driver_api flash_ram_api = { static DEVICE_API(flash, flash_ram_api) = {
.erase = test_flash_ram_erase, .erase = test_flash_ram_erase,
.write = test_flash_ram_write, .write = test_flash_ram_write,
.read = test_flash_ram_read, .read = test_flash_ram_read,