drivers/spi/spi_flash: Pass in spi_slave structure as const to probe functions

Pointer to spi_slave structure can be passed in as const to spi flash
probe functions since the probe functions do not need to modify the
slave properties.

BUG=b:38330715

Change-Id: I956ee777c62dbb811fd6ce2aeb6ae090e1892acd
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/19707
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh
2017-05-15 23:28:41 -07:00
committed by Furquan Shaikh
parent 7863395ad1
commit bd9e32efdd
16 changed files with 28 additions and 27 deletions

View File

@ -240,7 +240,7 @@ int spi_flash_cmd_status(const struct spi_flash *flash, u8 *reg)
static struct {
const u8 shift;
const u8 idcode;
int (*probe) (struct spi_slave *spi, u8 *idcode,
int (*probe) (const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
} flashes[] = {
/* Keep it sorted by define name */
@ -282,7 +282,7 @@ static struct {
#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)
int
__attribute__((weak)) spi_flash_programmer_probe(struct spi_slave *spi,
__attribute__((weak)) spi_flash_programmer_probe(const struct spi_slave *spi,
int force,
struct spi_flash *flash)
{
@ -290,7 +290,8 @@ __attribute__((weak)) spi_flash_programmer_probe(struct spi_slave *spi,
return -1;
}
static int __spi_flash_probe(struct spi_slave *spi, struct spi_flash *flash)
static int __spi_flash_probe(const struct spi_slave *spi,
struct spi_flash *flash)
{
int ret, i, shift;
u8 idcode[IDCODE_LEN], *idp;