spi25: Normalize parameters of spi_nbyte_read()

Most other reading functions have the destination buffer
as second parameter.

Change-Id: Id3f91f3d23132b0706b3b33bbf156356c9bf5ebc
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/74864
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/at45db.c b/at45db.c
index 985d3ca..58c6d10 100644
--- a/at45db.c
+++ b/at45db.c
@@ -245,7 +245,7 @@
 	const unsigned int max_chunk = (max_data_read > 0) ? max_data_read : page_size;
 	while (len > 0) {
 		unsigned int chunk = min(max_chunk, len);
-		int ret = spi_nbyte_read(flash, at45db_convert_addr(addr, page_size), buf, chunk);
+		int ret = spi_nbyte_read(flash, buf, at45db_convert_addr(addr, page_size), chunk);
 		if (ret) {
 			msg_cerr("%s: error sending read command!\n", __func__);
 			return ret;
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index 8e22c1d..c8c61ca 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -55,7 +55,7 @@
 erasefunc_t *spi25_get_erasefn_from_opcode(uint8_t opcode);
 const uint8_t *spi_get_opcode_from_erasefn(erasefunc_t *func, bool *native_4ba);
 int spi_chip_write_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
-int spi_nbyte_read(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
+int spi_nbyte_read(struct flashctx *flash, uint8_t *dst, unsigned int addr, unsigned int len);
 int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize);
 int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize);
 int spi_enter_4ba(struct flashctx *flash);
diff --git a/spi25.c b/spi25.c
index 5f427ca..0597cea 100644
--- a/spi25.c
+++ b/spi25.c
@@ -640,8 +640,7 @@
 	return spi_write_cmd(flash, op, native_4ba, addr, bytes, len, 10);
 }
 
-int spi_nbyte_read(struct flashctx *flash, unsigned int address, uint8_t *bytes,
-		   unsigned int len)
+int spi_nbyte_read(struct flashctx *flash, uint8_t *dst, unsigned int address, unsigned int len)
 {
 	const bool native_4ba = flash->chip->feature_bits & FEATURE_4BA_READ && spi_master_4ba(flash);
 	uint8_t cmd[1 + JEDEC_MAX_ADDR_LEN] = { native_4ba ? JEDEC_READ_4BA : JEDEC_READ, };
@@ -651,7 +650,7 @@
 		return 1;
 
 	/* Send Read */
-	return spi_send_command(flash, 1 + addr_len, len, cmd, bytes);
+	return spi_send_command(flash, 1 + addr_len, len, cmd, dst);
 }
 
 /*
@@ -665,7 +664,7 @@
 	size_t to_read;
 	for (; len; len -= to_read, buf += to_read, start += to_read) {
 		to_read = min(chunksize, len);
-		ret = spi_nbyte_read(flash, start, buf, to_read);
+		ret = spi_nbyte_read(flash, buf, start, to_read);
 		if (ret)
 			return ret;
 		flashprog_progress_add(flash, to_read);