Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/47842 )
Change subject: Rename do_exit_flag to exit_requested ......................................................................
Rename do_exit_flag to exit_requested
... and change the type to sig_atomic_t. Also, make it globally available again (because it is indeed useful in other parts of the code)
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: Ifd6f0d9145c689ecce0609a2d04b2221f8533181 Reviewed-on: https://review.coreboot.org/c/em100/+/47842 Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M em100.c M em100.h 2 files changed, 5 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/em100.c b/em100.c index 350b8db..1af0f03 100644 --- a/em100.c +++ b/em100.c @@ -15,7 +15,6 @@ #include <stdlib.h> #include <string.h> #include <strings.h> -#include <signal.h> #include <getopt.h> #include <unistd.h> #include <dirent.h> @@ -31,12 +30,12 @@ char *database_version; int debug = 0;
-static volatile int do_exit_flag = 0; +volatile sig_atomic_t exit_requested = 0; static struct em100 em100_state;
static void exit_handler(int sig __unused) { - do_exit_flag = 1; + exit_requested = 1; }
struct em100_hold_pin_states { @@ -1216,7 +1215,7 @@
printf(". Press CTL-C to exit.\n\n");
- while (!do_exit_flag && usb_errors < MAX_USB_ERRORS) { + while (!exit_requested && usb_errors < MAX_USB_ERRORS) { if (trace) { if (!read_spi_trace(em100, terminal, address_offset)) diff --git a/em100.h b/em100.h index b003bd6..d49339b 100644 --- a/em100.h +++ b/em100.h @@ -15,6 +15,7 @@ #define __EM100_H__
#include <libusb.h> +#include <signal.h>
#define __unused __attribute__((unused)) #define __packed __attribute__((packed)) @@ -196,6 +197,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) char *get_em100_file(const char *name); extern int debug; +extern volatile sig_atomic_t exit_requested;
/* Chips */ int parse_dcfg(chipdesc *chip, TFILE *dcfg);