aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/spi
diff options
context:
space:
mode:
authorElyes HAOUAS <ehaouas@noos.fr>2019-12-03 18:22:06 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-12-20 17:46:37 +0000
commitf97c1c9d86ff56ba9d1de4fc7c9499742224d365 (patch)
treefabc883853e92f997d6e31efddd770e649d0ee35 /src/soc/amd/common/block/spi
parent836b8d2e4509fb041a15df6d1ce3b20e205260bb (diff)
{nb,soc}: Replace min/max() with MIN/MAX()
Use MIN() and MAX() defined in commonlib/helpers.h Change-Id: I02d0a47937bc2d6ab2cd01995a2c6b6db245da15 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37454 Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common/block/spi')
-rw-r--r--src/soc/amd/common/block/spi/fch_spi_flash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/soc/amd/common/block/spi/fch_spi_flash.c b/src/soc/amd/common/block/spi/fch_spi_flash.c
index 72bc5d6ea5..d8eeefc7ed 100644
--- a/src/soc/amd/common/block/spi/fch_spi_flash.c
+++ b/src/soc/amd/common/block/spi/fch_spi_flash.c
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/
+#include <commonlib/helpers.h>
#include <console/console.h>
#include <spi_flash.h>
#include <soc/southbridge.h>
@@ -31,7 +32,7 @@ static void spi_flash_addr(u32 addr, u8 *cmd)
static int crop_chunk(unsigned int cmd_len, unsigned int buf_len)
{
- return min((SPI_FIFO_DEPTH - (cmd_len - 1)), buf_len);
+ return MIN((SPI_FIFO_DEPTH - (cmd_len - 1)), buf_len);
}
int fch_spi_flash_cmd_write(const u8 *cmd, size_t cmd_len, const void *data, size_t data_len)
@@ -192,7 +193,7 @@ static int fch_spi_flash_write(const struct spi_flash *flash, uint32_t offset, s
for (actual = start; actual < len; actual += chunk_len) {
byte_addr = offset % page_size;
- chunk_len = min(len - actual, page_size - byte_addr);
+ chunk_len = MIN(len - actual, page_size - byte_addr);
chunk_len = crop_chunk(sizeof(cmd), chunk_len);
cmd[0] = spi_data_ptr->write_cmd;