Edward O'Callaghan has uploaded this change for review.

View Change

include/flash.h: Turn defines into a flashrom error enum type

Change-Id: I6d0e6626b15ce54672a560741a1f1b3d3c2a3ab1
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M include/flash.h
1 file changed, 23 insertions(+), 11 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/78/68778/1
diff --git a/include/flash.h b/include/flash.h
index 8ee603d..d7fa3b4 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -436,18 +436,20 @@
void finalize_flash_access(struct flashctx *);
int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status);

-/* Something happened that shouldn't happen, but we can go on. */
-#define ERROR_FLASHROM_NONFATAL 0x100
+typedef enum {
+ /* Something happened that shouldn't happen, but we can go on. */
+ ERROR_FLASHROM_NONFATAL = 0x100,
+ /* Something happened that shouldn't happen, we'll abort. */
+ ERROR_FLASHROM_FATAL = -0xee,

-/* Something happened that shouldn't happen, we'll abort. */
-#define ERROR_FLASHROM_FATAL -0xee
-#define ERROR_FLASHROM_BUG -200
-/* We reached one of the hardcoded limits of flashrom. This can be fixed by
- * increasing the limit of a compile-time allocation or by switching to dynamic
- * allocation.
- * Note: If this warning is triggered, check first for runaway registrations.
- */
-#define ERROR_FLASHROM_LIMIT -201
+ ERROR_FLASHROM_BUG = -200,
+ /* We reached one of the hardcoded limits of flashrom. This can be fixed by
+ * increasing the limit of a compile-time allocation or by switching to dynamic
+ * allocation.
+ * Note: If this warning is triggered, check first for runaway registrations.
+ */
+ ERROR_FLASHROM_LIMIT = -201,
+} flashrom_error_t;

/* cli_common.c */
void print_chip_support_status(const struct flashchip *chip);

To view, visit change 68778. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6d0e6626b15ce54672a560741a1f1b3d3c2a3ab1
Gerrit-Change-Number: 68778
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange