Commit 3ffcd754 authored by Pisit Sawangvonganan's avatar Pisit Sawangvonganan Committed by Carles Cufi
Browse files

drivers: spi: set 'spi_driver_api' as 'static const'



This change marks each instance of the 'spi_driver_api' as 'static const'.
The rationale is that 'spi_driver_api' is used for declaring internal
module interfaces and is not intended to be modified at runtime.
By using 'static const', we ensure immutability, leading to usage of only
.rodata and a reduction in the .data area.

Signed-off-by: default avatarPisit Sawangvonganan <pisit@ndrsolution.com>
parent 80e1482d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int mspi_ambiq_release(const struct device *dev, const struct spi_config
	return 0;
}

static struct spi_driver_api mspi_ambiq_driver_api = {
static const struct spi_driver_api mspi_ambiq_driver_api = {
	.transceive = mspi_ambiq_transceive,
	.release = mspi_ambiq_release,
};
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ static int spi_ambiq_release(const struct device *dev, const struct spi_config *
	return 0;
}

static struct spi_driver_api spi_ambiq_driver_api = {
static const struct spi_driver_api spi_ambiq_driver_api = {
	.transceive = spi_ambiq_transceive,
	.release = spi_ambiq_release,
};
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ int spi_atcspi200_init(const struct device *dev)
	return 0;
}

static struct spi_driver_api spi_atcspi200_api = {
static const struct spi_driver_api spi_atcspi200_api = {
	.transceive = spi_atcspi200_transceive,
#ifdef CONFIG_SPI_ASYNC
	.transceive_async = spi_atcspi200_transceive_async,
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ static int spi_b91_release(const struct device *dev,
}

/* SPI driver APIs structure */
static struct spi_driver_api spi_b91_api = {
static const struct spi_driver_api spi_b91_api = {
	.transceive = spi_b91_transceive,
	.release = spi_b91_release,
#ifdef CONFIG_SPI_ASYNC
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ int spi_bitbang_release(const struct device *dev,
	return 0;
}

static struct spi_driver_api spi_bitbang_api = {
static const struct spi_driver_api spi_bitbang_api = {
	.transceive = spi_bitbang_transceive,
	.release = spi_bitbang_release,
#ifdef CONFIG_SPI_ASYNC
Loading