Skip to content

Commit

Permalink
drivers: eeprom: at2x: make spi_buf_set constant in eeprom_at25_rdsr
Browse files Browse the repository at this point in the history
To place `spi_buf_set tx` inside the `eeprom_at25_rdsr` function in
`.rodata`, the `static` qualifier should be used together with `const`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
  • Loading branch information
ndrs-pst committed Oct 31, 2024
1 parent 0d40b2a commit 4c68fd3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/eeprom/eeprom_at2x.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,14 @@ static bool eeprom_at25_bus_is_ready(const struct device *dev)
static int eeprom_at25_rdsr(const struct device *dev, uint8_t *status)
{
const struct eeprom_at2x_config *config = dev->config;
uint8_t rdsr[2] = { EEPROM_AT25_RDSR, 0 };
static const uint8_t rdsr[2] = { EEPROM_AT25_RDSR, 0 };
uint8_t sr[2];

Check notice on line 363 in drivers/eeprom/eeprom_at2x.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/eeprom/eeprom_at2x.c:363 - static const uint8_t rdsr[2] = { EEPROM_AT25_RDSR, 0 }; + static const uint8_t rdsr[2] = {EEPROM_AT25_RDSR, 0};

Check notice on line 363 in drivers/eeprom/eeprom_at2x.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/eeprom/eeprom_at2x.c:363 - static const uint8_t rdsr[2] = { EEPROM_AT25_RDSR, 0 }; + static const uint8_t rdsr[2] = {EEPROM_AT25_RDSR, 0};
int err;
const struct spi_buf tx_buf = {
.buf = rdsr,
static const struct spi_buf tx_buf = {
.buf = (void *)rdsr,
.len = sizeof(rdsr),
};
const struct spi_buf_set tx = {
static const struct spi_buf_set tx = {
.buffers = &tx_buf,
.count = 1,
};
Expand Down

0 comments on commit 4c68fd3

Please sign in to comment.