src/lib: Fix brace positions

Fix the following errors detected by checkpatch.pl:

ERROR: open brace '{' following function declarations go on the next
line
ERROR: that open brace { should be on the previous line
ERROR: open brace '{' following struct go on the same line
ERROR: else should follow close brace '}'

TEST=Build and run on Galileo Gen2

Change-Id: I971ada9ba9ba7ce5d8029323710fee1a6166570b
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18759
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
diff --git a/src/lib/edid.c b/src/lib/edid.c
index 2f8277b..95ff92f 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -1452,8 +1452,8 @@
 	for (i = 0; i < 4; i++) {
 		c.has_valid_detailed_blocks &= detailed_block(
 				out, edid + 0x36 + i * 18, 0, &c);
-		if (i == 0 && c.has_preferred_timing && !c.did_detailed_timing)
-		{
+		if (i == 0 && c.has_preferred_timing
+			&& !c.did_detailed_timing) {
 			/* not really accurate... */
 			c.has_preferred_timing = 0;
 		}
diff --git a/src/lib/gcov-io.h b/src/lib/gcov-io.h
index f5f3a33..e2c0e0d 100644
--- a/src/lib/gcov-io.h
+++ b/src/lib/gcov-io.h
@@ -406,8 +406,7 @@
 /* Structured records.  */
 
 /* Cumulative counter data.  */
-struct gcov_ctr_summary
-{
+struct gcov_ctr_summary {
 	gcov_unsigned_t num;		/* number of counters.  */
 	gcov_unsigned_t runs;		/* number of program runs */
 	gcov_type sum_all;		/* sum of all counters accumulated.  */
@@ -416,8 +415,7 @@
 };
 
 /* Object & program summary record.  */
-struct gcov_summary
-{
+struct gcov_summary {
 	gcov_unsigned_t checksum;	/* checksum of program */
 	struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
 };
@@ -427,8 +425,7 @@
 
 #if IN_LIBGCOV
 /* Information about counters for a single function.  */
-struct gcov_ctr_info
-{
+struct gcov_ctr_info {
 	gcov_unsigned_t num;		/* number of counters.  */
 	gcov_type *values;		/* their values.  */
 };
@@ -439,8 +436,7 @@
    comdat functions was selected -- it points to the gcov_info object
    of the object file containing the selected comdat function.  */
 
-struct gcov_fn_info
-{
+struct gcov_fn_info {
 	const struct gcov_info *key;		/* comdat key */
 	gcov_unsigned_t ident;		/* unique ident of function */
 	gcov_unsigned_t lineno_checksum;	/* function lineo_checksum */
@@ -452,8 +448,7 @@
 typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
 
 /* Information about a single object file.  */
-struct gcov_info
-{
+struct gcov_info {
 	gcov_unsigned_t version;	/* expected version number */
 	struct gcov_info *next;	/* link to next, used by libgcov */
 
diff --git a/src/lib/halt.c b/src/lib/halt.c
index 40232c0..67ae2ee 100644
--- a/src/lib/halt.c
+++ b/src/lib/halt.c
@@ -17,7 +17,8 @@
 #include <arch/hlt.h>
 #include <halt.h>
 
-void halt(void) {
+void halt(void)
+{
 	while (1)
 		hlt();
 }
diff --git a/src/lib/libgcov.c b/src/lib/libgcov.c
index 22a83c1..2cfda0a 100644
--- a/src/lib/libgcov.c
+++ b/src/lib/libgcov.c
@@ -109,8 +109,7 @@
 #ifdef L_gcov
 #include "gcov-io.c"
 
-struct gcov_fn_buffer
-{
+struct gcov_fn_buffer {
 	struct gcov_fn_buffer *next;
 	unsigned int fn_ix;
 	struct gcov_fn_info info;
diff --git a/src/lib/mocked_tlcl.c b/src/lib/mocked_tlcl.c
index 6a8043d..2eec78d 100644
--- a/src/lib/mocked_tlcl.c
+++ b/src/lib/mocked_tlcl.c
@@ -23,17 +23,20 @@
 #define VBDEBUG(format, args...) printk(BIOS_DEBUG, format, ## args)
 #endif
 
-uint32_t tlcl_lib_init(void) {
+uint32_t tlcl_lib_init(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_startup(void) {
+uint32_t tlcl_startup(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_resume(void) {
+uint32_t tlcl_resume(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
@@ -69,32 +72,38 @@
 }
 
 
-uint32_t tlcl_assert_physical_presence(void) {
+uint32_t tlcl_assert_physical_presence(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_physical_presence_cmd_enable(void) {
+uint32_t tlcl_physical_presence_cmd_enable(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_finalize_physical_presence(void) {
+uint32_t tlcl_finalize_physical_presence(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_set_nv_locked(void) {
+uint32_t tlcl_set_nv_locked(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_force_clear(void) {
+uint32_t tlcl_force_clear(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
 
-uint32_t tlcl_set_enable(void) {
+uint32_t tlcl_set_enable(void)
+{
 	VBDEBUG("MOCK_TPM: %s\n", __func__);
 	return TPM_E_NO_DEVICE;
 }
diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c
index a7bd7cc..e3b453d 100644
--- a/src/lib/reg_script.c
+++ b/src/lib/reg_script.c
@@ -192,8 +192,7 @@
 		};
 		reg_script_set_step(ctx, &io_step);
 		val = reg_script_read_io(ctx);
-	}
-	else if (res->flags & IORESOURCE_MEM) {
+	} else if (res->flags & IORESOURCE_MEM) {
 		const struct reg_script mmio_step = {
 			.size = step->size,
 			.reg = res->base + step->reg,
@@ -223,8 +222,7 @@
 		};
 		reg_script_set_step(ctx, &io_step);
 		reg_script_write_io(ctx);
-	}
-	else if (res->flags & IORESOURCE_MEM) {
+	} else if (res->flags & IORESOURCE_MEM) {
 		const struct reg_script mmio_step = {
 			.size = step->size,
 			.reg = res->base + step->reg,
diff --git a/src/lib/tlcl.c b/src/lib/tlcl.c
index fc989de..34da816 100644
--- a/src/lib/tlcl.c
+++ b/src/lib/tlcl.c
@@ -47,27 +47,31 @@
 }
 
 /* Sets the size field of a TPM command. */
-static inline void set_tpm_command_size(uint8_t *buffer, uint32_t size) {
+static inline void set_tpm_command_size(uint8_t *buffer, uint32_t size)
+{
 	to_tpm_uint32(buffer + sizeof(uint16_t), size);
 }
 
 /* Gets the size field of a TPM command. */
 __attribute__((unused))
-static inline int tpm_command_size(const uint8_t *buffer) {
+static inline int tpm_command_size(const uint8_t *buffer)
+{
 	uint32_t size;
 	from_tpm_uint32(buffer + sizeof(uint16_t), &size);
 	return (int) size;
 }
 
 /* Gets the code field of a TPM command. */
-static inline int tpm_command_code(const uint8_t *buffer) {
+static inline int tpm_command_code(const uint8_t *buffer)
+{
 	uint32_t code;
 	from_tpm_uint32(buffer + sizeof(uint16_t) + sizeof(uint32_t), &code);
 	return code;
 }
 
 /* Gets the return code field of a TPM result. */
-static inline int tpm_return_code(const uint8_t *buffer) {
+static inline int tpm_return_code(const uint8_t *buffer)
+{
 	return tpm_command_code(buffer);
 }
 
@@ -75,7 +79,8 @@
  * DOING_SELFTEST errors are returned.
  */
 static uint32_t tlcl_send_receive_no_retry(const uint8_t *request,
-					   uint8_t *response, int max_length) {
+					   uint8_t *response, int max_length)
+{
 	uint32_t response_length = max_length;
 	uint32_t result;
 
@@ -104,7 +109,8 @@
 /* Sends a TPM command and gets a response.  Returns 0 if success or the TPM
  * error code if error. Waits for the self test to complete if needed. */
 uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
-			   int max_length) {
+			   int max_length)
+{
 	uint32_t result = tlcl_send_receive_no_retry(request, response,
 						     max_length);
 	/* If the command fails because the self test has not completed, try it
@@ -133,7 +139,8 @@
 }
 
 /* Sends a command and returns the error code. */
-static uint32_t send(const uint8_t *command) {
+static uint32_t send(const uint8_t *command)
+{
 	uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
 	return tlcl_send_receive(command, response, sizeof(response));
 }
@@ -142,7 +149,8 @@
 
 static uint8_t tlcl_init_done CAR_GLOBAL;
 
-uint32_t tlcl_lib_init(void) {
+uint32_t tlcl_lib_init(void)
+{
 	uint8_t done = car_get_var(tlcl_init_done);
 	if (done)
 		return VB2_SUCCESS;
@@ -157,12 +165,14 @@
 	return VB2_SUCCESS;
 }
 
-uint32_t tlcl_startup(void) {
+uint32_t tlcl_startup(void)
+{
 	VBDEBUG("TPM: Startup\n");
 	return send(tpm_startup_cmd.buffer);
 }
 
-uint32_t tlcl_resume(void) {
+uint32_t tlcl_resume(void)
+{
 	VBDEBUG("TPM: Resume\n");
 	return send(tpm_resume_cmd.buffer);
 }
@@ -236,32 +246,38 @@
 }
 
 
-uint32_t tlcl_assert_physical_presence(void) {
+uint32_t tlcl_assert_physical_presence(void)
+{
 	VBDEBUG("TPM: Asserting physical presence\n");
 	return send(tpm_ppassert_cmd.buffer);
 }
 
-uint32_t tlcl_physical_presence_cmd_enable(void) {
+uint32_t tlcl_physical_presence_cmd_enable(void)
+{
 	VBDEBUG("TPM: Enable the physical presence command\n");
 	return send(tpm_ppenable_cmd.buffer);
 }
 
-uint32_t tlcl_finalize_physical_presence(void) {
+uint32_t tlcl_finalize_physical_presence(void)
+{
 	VBDEBUG("TPM: Enable PP cmd, disable HW pp, and set lifetime lock\n");
 	return send(tpm_finalizepp_cmd.buffer);
 }
 
-uint32_t tlcl_set_nv_locked(void) {
+uint32_t tlcl_set_nv_locked(void)
+{
 	VBDEBUG("TPM: Set NV locked\n");
 	return tlcl_define_space(TPM_NV_INDEX_LOCK, 0, 0);
 }
 
-uint32_t tlcl_force_clear(void) {
+uint32_t tlcl_force_clear(void)
+{
 	VBDEBUG("TPM: Force clear\n");
 	return send(tpm_forceclear_cmd.buffer);
 }
 
-uint32_t tlcl_set_enable(void) {
+uint32_t tlcl_set_enable(void)
+{
 	VBDEBUG("TPM: Enabling TPM\n");
 	return send(tpm_physicalenable_cmd.buffer);
 }
diff --git a/src/lib/tlcl_internal.h b/src/lib/tlcl_internal.h
index 8261b0d..3648be6 100644
--- a/src/lib/tlcl_internal.h
+++ b/src/lib/tlcl_internal.h
@@ -23,7 +23,8 @@
  * buffer into a variable.
  */
 __attribute__((unused))
-static inline void to_tpm_uint32(uint8_t *buffer, uint32_t x) {
+static inline void to_tpm_uint32(uint8_t *buffer, uint32_t x)
+{
 	buffer[0] = (uint8_t)(x >> 24);
 	buffer[1] = (uint8_t)((x >> 16) & 0xff);
 	buffer[2] = (uint8_t)((x >> 8) & 0xff);
@@ -34,7 +35,8 @@
  * See comment for above function.
  */
 __attribute__((unused))
-static inline void from_tpm_uint32(const uint8_t *buffer, uint32_t *x) {
+static inline void from_tpm_uint32(const uint8_t *buffer, uint32_t *x)
+{
 	*x = ((buffer[0] << 24) |
 	      (buffer[1] << 16) |
 	      (buffer[2] << 8) |
@@ -45,7 +47,8 @@
  * See comment for above function.
  */
 __attribute__((unused))
-static inline void to_tpm_uint16(uint8_t *buffer, uint16_t x) {
+static inline void to_tpm_uint16(uint8_t *buffer, uint16_t x)
+{
 	buffer[0] = (uint8_t)(x >> 8);
 	buffer[1] = (uint8_t)(x & 0xff);
 }
@@ -54,7 +57,8 @@
  * See comment for above function.
  */
 __attribute__((unused))
-static inline void from_tpm_uint16(const uint8_t *buffer, uint16_t *x) {
+static inline void from_tpm_uint16(const uint8_t *buffer, uint16_t *x)
+{
 	*x = (buffer[0] << 8) | buffer[1];
 }