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

@ -50,7 +50,7 @@ static struct device_state some_dev_state = {
};
/* 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,
};
const static struct device size_fun_dev = {
@ -61,7 +61,7 @@ const static struct device size_fun_dev = {
};
/* 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 = {
"no_fun",
NULL,
@ -70,7 +70,7 @@ const static struct device no_fun_dev = {
};
/* 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,
};
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);
}
static const struct flash_driver_api flash_ram_api = {
static DEVICE_API(flash, flash_ram_api) = {
.erase = test_flash_ram_erase,
.write = test_flash_ram_write,
.read = test_flash_ram_read,