1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/at25xxx: return read/written bytes to match MTD API

The MTD API expects read() to return the number of read bytes and
write() to return the number of written bytes.

So change the driver API to match that.
This commit is contained in:
Benjamin Valentin 2020-04-17 11:32:06 +02:00
parent 94e08b9307
commit 8a2a936726
2 changed files with 4 additions and 4 deletions

View File

@ -113,7 +113,7 @@ static ssize_t _write_page(const at25xxx_t *dev, uint32_t pos, const void *data,
int at25xxx_write(const at25xxx_t *dev, uint32_t pos, const void *data, size_t len)
{
int res = 0;
int res = len;
const uint8_t *d = data;
if (pos + len > dev->params.size) {
@ -164,7 +164,7 @@ int at25xxx_read(const at25xxx_t *dev, uint32_t pos, void *data, size_t len)
spi_release(dev->params.spi);
return 0;
return len;
}
uint8_t at25xxx_read_byte(const at25xxx_t *dev, uint32_t pos)

View File

@ -82,7 +82,7 @@ uint8_t at25xxx_read_byte(const at25xxx_t *dev, uint32_t pos);
* @param[out] data read buffer
* @param[in] len requested length to be read
*
* @return 0 on success
* @return Number of bytes read
* @return -ERANGE if pos + len > EEPROM size
*/
int at25xxx_read(const at25xxx_t *dev, uint32_t pos, void *data, size_t len);
@ -104,7 +104,7 @@ void at25xxx_write_byte(const at25xxx_t *dev, uint32_t pos, uint8_t data);
* @param[in] data write buffer
* @param[in] len requested length to be written
*
* @return 0 on success
* @return Number of bytes written
* @return -ERANGE if pos + len > EEPROM size
*/
int at25xxx_write(const at25xxx_t *dev, uint32_t pos, const void *data, size_t len);