Hello Daniel Gröber,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/42122
to review the following change.
Change subject: spi/winbond: Add 'params' as get_bpbits arg ......................................................................
spi/winbond: Add 'params' as get_bpbits arg
This lets us avoid repeted checks for flash->part being NULL.
Change-Id: I385fd0a73733ce23b3cc22557037f4a9aa3b331d Signed-off-by: Daniel Gröber dxld@darkboxed.org --- M src/drivers/spi/winbond.c 1 file changed, 4 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/42122/1
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index b834585..d127287 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -209,6 +209,7 @@ };
static int winbond_get_bpbits(const struct spi_flash *flash, + const struct spi_flash_part_id *params, struct spi_flash_bpbits *bpbits); static int winbond_set_bpbits(const struct spi_flash *flash, const struct spi_flash_part_id *params, @@ -267,7 +268,7 @@ if (!params) return -1;
- ret = winbond_get_bpbits(flash, &bpbits); + ret = winbond_get_bpbits(flash, params, &bpbits); if (ret) return ret;
@@ -286,16 +287,13 @@ }
static int winbond_get_bpbits(const struct spi_flash *flash, + const struct spi_flash_part_id *params, struct spi_flash_bpbits *bpbits) { union status_reg1 reg1 = { .u = 0 }; union status_reg2 reg2 = { .u = 0 }; int ret;
- const struct spi_flash_part_id *params = flash->part; - if (!params) - return -1; - ret = spi_flash_cmd(&flash->spi, flash->status_cmd, ®1.u, sizeof(reg1.u)); if (ret) @@ -585,7 +583,7 @@ if (!params) return -1;
- ret = winbond_get_bpbits(flash, &bpbits); + ret = winbond_get_bpbits(flash, params, &bpbits); if (!ret) return ret;