[coreboot-gerrit] New patch to review for coreboot: src/lib: Fix brace positions

Lee Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Sat Mar 11 03:28:31 CET 2017


Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18759

-gerrit

commit f13a4a21dbe2ca2f00e6f096410c535fbc4780f9
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Fri Mar 10 15:31:56 2017 -0800

    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 at intel.com>
---
 src/lib/edid.c          |  4 ++--
 src/lib/gcov-io.h       | 15 +++++----------
 src/lib/halt.c          |  3 ++-
 src/lib/libgcov.c       |  3 +--
 src/lib/mocked_tlcl.c   | 27 ++++++++++++++++++---------
 src/lib/reg_script.c    |  6 ++----
 src/lib/tlcl.c          | 48 ++++++++++++++++++++++++++++++++----------------
 src/lib/tlcl_internal.h | 12 ++++++++----
 8 files changed, 70 insertions(+), 48 deletions(-)

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 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	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 @@ typedef HOST_WIDEST_INT gcov_type;
 /* 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 @@ struct gcov_ctr_summary
 };
 
 /* 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 @@ struct gcov_summary
 
 #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 @@ struct gcov_ctr_info
    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 @@ struct gcov_fn_info
 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 @@ void __gcov_merge_add(gcov_type *counters  __attribute__ ((unused)),
 #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_read(uint32_t index, void *data, uint32_t length)
 }
 
 
-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 @@ static uint32_t reg_script_read_res(struct reg_script_context *ctx)
 		};
 		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 @@ static void reg_script_write_res(struct reg_script_context *ctx)
 		};
 		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 @@ static int tpm_send_receive(const uint8_t *request,
 }
 
 /* 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 @@ static inline int tpm_return_code(const uint8_t *buffer) {
  * 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 @@ return result;
 /* 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 @@ uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
 }
 
 /* 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 uint32_t send(const uint8_t *command) {
 
 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 @@ uint32_t tlcl_lib_init(void) {
 	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_read(uint32_t index, void *data, uint32_t length)
 }
 
 
-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 @@ static inline void to_tpm_uint32(uint8_t *buffer, uint32_t x) {
  * 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 @@ static inline void from_tpm_uint32(const uint8_t *buffer, uint32_t *x) {
  * 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 @@ static inline void to_tpm_uint16(uint8_t *buffer, uint16_t x) {
  * 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];
 }
 



More information about the coreboot-gerrit mailing list