diff --git a/utils/flash.c b/utils/flash.c index b6a651508..b402d6319 100644 --- a/utils/flash.c +++ b/utils/flash.c @@ -110,7 +110,7 @@ void flash_release(struct flash_device *fdev) free(fdev); } -int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest) +int flash_read(struct flash_device *fdev, size_t addr, size_t len, void *dest) { if (!fdev) return -1; @@ -118,7 +118,7 @@ int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest) return fdev->driver->read(fdev, addr, len, dest); } -int flash_write(struct flash_device *fdev, size_t addr, size_t len, void* src) +int flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src) { if (!fdev) return -1; diff --git a/utils/flash.h b/utils/flash.h index 74647b839..94925269e 100644 --- a/utils/flash.h +++ b/utils/flash.h @@ -75,22 +75,22 @@ struct flash_device { struct flash_ops { void (*init)(struct flash_device *fdev); int (*sector_erase)(struct flash_device *fdev, size_t addr); - int (*buffered_program)(struct flash_device *fdev, size_t addr, size_t len, void *src); + int (*buffered_program)(struct flash_device *fdev, size_t addr, size_t len, const void *src); }; struct flash_driver { int (*init)(struct flash_device *fdev); void (*release)(struct flash_device *fdev); - int (*read)(struct flash_device *fdev, size_t addr, size_t len, void* dest); - int (*write)(struct flash_device *fdev, size_t addr, size_t len, void* src); + int (*read)(struct flash_device *fdev, size_t addr, size_t len, void *dest); + int (*write)(struct flash_device *fdev, size_t addr, size_t len, const void *src); int (*erase)(struct flash_device *fdev, size_t addr, size_t len); }; struct flash_device *flash_open_spi(int data_width, volatile uint8_t *ctrl_reg); struct flash_device *flash_open_bpi(int data_width, volatile uint8_t *ctrl_reg, volatile uint8_t *addr_reg, volatile uint8_t *data_reg); void flash_release(struct flash_device *fdev); -int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest); -int flash_write(struct flash_device *fdev, size_t addr, size_t len, void* src); +int flash_read(struct flash_device *fdev, size_t addr, size_t len, void *dest); +int flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src); int flash_erase(struct flash_device *fdev, size_t addr, size_t len); #endif /* FLASH_H */ diff --git a/utils/flash_bpi.c b/utils/flash_bpi.c index dadc139d7..8e5227c8f 100644 --- a/utils/flash_bpi.c +++ b/utils/flash_bpi.c @@ -197,9 +197,9 @@ int bpi_flash_intel_sector_erase(struct flash_device *fdev, size_t addr) return 0; } -int bpi_flash_intel_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) +int bpi_flash_intel_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src) { - uint8_t *s = src; + const uint8_t *s = (const uint8_t *)src; bpi_flash_set_addr(fdev, addr); bpi_flash_write_cur(fdev, BPI_INTEL_BUFFERED_PROGRAM_SETUP); @@ -296,9 +296,9 @@ int bpi_flash_amd_sector_erase(struct flash_device *fdev, size_t addr) return 0; } -int bpi_flash_amd_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) +int bpi_flash_amd_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src) { - uint8_t *s = src; + const uint8_t *s = (const uint8_t *)src; bpi_flash_amd_unlock(fdev); bpi_flash_write_word(fdev, addr, BPI_AMD_BUFFERED_PROGRAM_SETUP); @@ -379,9 +379,9 @@ int bpi_flash_micron_sector_erase(struct flash_device *fdev, size_t addr) return 0; } -int bpi_flash_micron_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) +int bpi_flash_micron_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src) { - uint8_t *s = src; + const uint8_t *s = (const uint8_t *)src; bpi_flash_set_addr(fdev, addr); bpi_flash_write_cur(fdev, BPI_MICRON_BUFFERED_PROGRAM_SETUP); @@ -577,9 +577,9 @@ int bpi_flash_read(struct flash_device *fdev, size_t addr, size_t len, void *des return 0; } -int bpi_flash_write(struct flash_device *fdev, size_t addr, size_t len, void *src) +int bpi_flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src) { - char *s = src; + const char *s = src; while (len > 0) { diff --git a/utils/flash_spi.c b/utils/flash_spi.c index bc4a7f46a..c5c890d82 100644 --- a/utils/flash_spi.c +++ b/utils/flash_spi.c @@ -431,9 +431,9 @@ int spi_flash_read(struct flash_device *fdev, size_t addr, size_t len, void *des return 0; } -int spi_flash_write(struct flash_device *fdev, size_t addr, size_t len, void *src) +int spi_flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src) { - char *s = src; + const char *s = src; int protocol = SPI_PROTO_STR; diff --git a/utils/mqnic-fw.c b/utils/mqnic-fw.c index b53f0f3af..7a09bf482 100644 --- a/utils/mqnic-fw.c +++ b/utils/mqnic-fw.c @@ -131,7 +131,7 @@ static void usage(char *name) name); } -int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void* dest) +int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void *dest) { int ret; size_t remain = len; @@ -181,7 +181,7 @@ int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void return 0; } -int flash_write_progress(struct flash_device *fdev, size_t addr, size_t len, void* src) +int flash_write_progress(struct flash_device *fdev, size_t addr, size_t len, const void *src) { int ret; size_t remain = len;