Skip to content

Commit 1582fdd

Browse files
committed
drivers/at25xxx: s/PAGE_SIZE/AT25_PAGE_SIZE/
On musl, PAGE_SIZE has a different meaning. So add an AT25_ prefix to avoid a name clash.
1 parent be387a2 commit 1582fdd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/at25xxx/at25xxx.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define min(a, b) ((a) > (b) ? (b) : (a))
3838
#endif
3939

40-
#define PAGE_SIZE (dev->params.page_size)
40+
#define AT25_PAGE_SIZE (dev->params.page_size)
4141
#define ADDR_LEN (AT25XXX_PARAM_ADDR_LEN)
4242
#define ADDR_MSK ((1UL << ADDR_LEN) - 1)
4343

@@ -85,12 +85,12 @@ static inline int _wait_until_eeprom_ready(const at25xxx_t *dev)
8585

8686
static int _at25xxx_write_page(const at25xxx_t *dev, uint32_t page, uint32_t offset, const void *data, size_t len)
8787
{
88-
assert(offset < PAGE_SIZE);
88+
assert(offset < AT25_PAGE_SIZE);
8989

9090
/* write no more than to the end of the current page to prevent wrap-around */
91-
size_t remaining = PAGE_SIZE - offset;
91+
size_t remaining = AT25_PAGE_SIZE - offset;
9292
len = min(len, remaining);
93-
uint32_t pos = _pos(CMD_WRITE, page * PAGE_SIZE + offset);
93+
uint32_t pos = _pos(CMD_WRITE, page * AT25_PAGE_SIZE + offset);
9494

9595
/* wait for previous write to finish - may take up to 5 ms */
9696
int res = _wait_until_eeprom_ready(dev);
@@ -136,8 +136,8 @@ int at25xxx_write(const at25xxx_t *dev, uint32_t pos, const void *data, size_t l
136136
}
137137

138138
/* page size is always a power of two */
139-
const uint32_t page_shift = bitarithm_msb(PAGE_SIZE);
140-
const uint32_t page_mask = PAGE_SIZE - 1;
139+
const uint32_t page_shift = bitarithm_msb(AT25_PAGE_SIZE);
140+
const uint32_t page_mask = AT25_PAGE_SIZE - 1;
141141

142142
uint32_t page = pos >> page_shift;
143143
uint32_t offset = pos & page_mask;
@@ -214,8 +214,8 @@ int at25xxx_set(const at25xxx_t *dev, uint32_t pos, uint8_t val, size_t len)
214214
memset(data, val, sizeof(data));
215215

216216
/* page size is always a power of two */
217-
const uint32_t page_shift = bitarithm_msb(PAGE_SIZE);
218-
const uint32_t page_mask = PAGE_SIZE - 1;
217+
const uint32_t page_shift = bitarithm_msb(AT25_PAGE_SIZE);
218+
const uint32_t page_mask = AT25_PAGE_SIZE - 1;
219219

220220
uint32_t page = pos >> page_shift;
221221
uint32_t offset = pos & page_mask;

0 commit comments

Comments
 (0)