Change in coreboot[master]: spi/winbond: Merge redundant if wrapper into switch

Hello Daniel Gröber, I'd like you to do a code review. Please visit https://review.coreboot.org/c/coreboot/+/42118 to review the following change. Change subject: spi/winbond: Merge redundant if wrapper into switch ...................................................................... spi/winbond: Merge redundant if wrapper into switch Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Signed-off-by: Daniel Gröber <dxld@darkboxed.org> --- M src/drivers/spi/winbond.c 1 file changed, 22 insertions(+), 22 deletions(-) git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/42118/1 diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index d7a750b..49d3c5b 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -553,33 +553,33 @@ return -1; } - if (mode != SPI_WRITE_PROTECTION_PRESERVE) { - switch (mode) { - case SPI_WRITE_PROTECTION_NONE: - bits->winbond.srp1 = 0; - bits->winbond.srp0 = 0; + switch (mode) { + case SPI_WRITE_PROTECTION_PRESERVE: break; - case SPI_WRITE_PROTECTION_PIN: - bits->winbond.srp1 = 0; - bits->winbond.srp0 = 1; + case SPI_WRITE_PROTECTION_NONE: + bits->winbond.srp1 = 0; + bits->winbond.srp0 = 0; break; - case SPI_WRITE_PROTECTION_REBOOT: + case SPI_WRITE_PROTECTION_PIN: + bits->winbond.srp1 = 0; + bits->winbond.srp0 = 1; + break; + case SPI_WRITE_PROTECTION_REBOOT: + bits->winbond.srp1 = 1; + bits->winbond.srp0 = 0; + break; + case SPI_WRITE_PROTECTION_PERMANENT: + if (params->bp_bits == 3) { bits->winbond.srp1 = 1; - bits->winbond.srp0 = 0; - break; - case SPI_WRITE_PROTECTION_PERMANENT: - if (params->bp_bits == 3) { - bits->winbond.srp1 = 1; - bits->winbond.srp0 = 1; - } else { - /* FIXME: special permanent protect write - * sequence not implemented. */ - return -1; - } - break; - default: + bits->winbond.srp0 = 1; + } else { + /* FIXME: special permanent protect write sequence + * not implemented. */ return -1; } + break; + default: + return -1; } return 0; -- To view, visit https://review.coreboot.org/c/coreboot/+/42118 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Gerrit-Change-Number: 42118 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Gröber (dxld) Gerrit-Reviewer: Daniel Gröber <dxld@darkboxed.org> Gerrit-MessageType: newchange

Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42118 ) Change subject: spi/winbond: Merge redundant if wrapper into switch ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://review.coreboot.org/c/coreboot/+/42118 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Gerrit-Change-Number: 42118 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Gröber (dxld) Gerrit-Reviewer: Daniel Gröber <dxld@darkboxed.org> Gerrit-Reviewer: Julius Werner <jwerner@chromium.org> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Thu, 18 Jun 2020 03:04:09 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment

Daniel Gröber (dxld) has removed Daniel Gröber from this change. ( https://review.coreboot.org/c/coreboot/+/42118 ) Change subject: spi/winbond: Merge redundant if wrapper into switch ...................................................................... Removed cc Daniel Gröber <dxld@darkboxed.org>. -- To view, visit https://review.coreboot.org/c/coreboot/+/42118 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Gerrit-Change-Number: 42118 Gerrit-PatchSet: 28 Gerrit-Owner: Daniel Gröber (dxld) <coreboot@dxld.at> Gerrit-Reviewer: Julius Werner <jwerner@chromium.org> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org> Gerrit-MessageType: deleteReviewer

Daniel Gröber has removed Daniel Gröber from this change. ( https://review.coreboot.org/c/coreboot/+/42118 ) Change subject: spi/winbond: Merge redundant if wrapper into switch ...................................................................... Removed reviewer Daniel Gröber <dxld@darkboxed.org>. -- To view, visit https://review.coreboot.org/c/coreboot/+/42118 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Gerrit-Change-Number: 42118 Gerrit-PatchSet: 29 Gerrit-Owner: Daniel Gröber <coreboot@dxld.at> Gerrit-Reviewer: Julius Werner <jwerner@chromium.org> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org> Gerrit-MessageType: deleteReviewer
participants (3)
-
Daniel Gröber (Code Review)
-
Daniel Gröber (dxld) (Code Review)
-
Julius Werner (Code Review)