Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved
lspcon_i2c_spi.c: Rename PAGE_SIZE macro

This fixes building with musl libc on alpine:i386-v3.7.

Change-Id: Ibd478f3fcd6b6803098035dbdc47f72f6ab3fa6b
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52469
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M lspcon_i2c_spi.c
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c0..7599db6 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -27,7 +27,7 @@

#define REGISTER_ADDRESS (0x94 >> 1)
#define PAGE_ADDRESS (0x9e >> 1)
-#define PAGE_SIZE 256
+#define LSPCON_PAGE_SIZE 256
#define MAX_SPI_WAIT_RETRIES 1000

#define CLT2_SPI 0x82
@@ -330,7 +330,7 @@
static int lspcon_i2c_spi_map_page(int fd, unsigned int offset)
{
int ret = 0;
- /* Page number byte, need to / PAGE_SIZE. */
+ /* Page number byte, need to / LSPCON_PAGE_SIZE. */
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE1, (offset >> 8) & 0xff);
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE2, (offset >> 16));

@@ -349,9 +349,9 @@
if (fd < 0)
return SPI_GENERIC_ERROR;

- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}

return ret;
@@ -363,8 +363,8 @@
* Using static buffer with maximum possible size,
* extra byte is needed for prefixing zero at index 0.
*/
- uint8_t write_buffer[PAGE_SIZE + 1] = { 0 };
- if (len > PAGE_SIZE)
+ uint8_t write_buffer[LSPCON_PAGE_SIZE + 1] = { 0 };
+ if (len > LSPCON_PAGE_SIZE)
return SPI_GENERIC_ERROR;

/* First byte represents the writing offset and should always be zero. */
@@ -389,9 +389,9 @@
ret |= lspcon_i2c_spi_enable_hw_write(fd);
ret |= lspcon_i2c_clt2_spi_reset(fd);

- for (unsigned int i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned int i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}

ret |= lspcon_i2c_spi_enable_write_protection(fd);

To view, visit change 52469. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibd478f3fcd6b6803098035dbdc47f72f6ab3fa6b
Gerrit-Change-Number: 52469
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged