Alexander Goncharov has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83281?usp=email )
Change subject: util/ifdtool: fix spacing issues ......................................................................
util/ifdtool: fix spacing issues
Ensure consistent spacing around colons in bit fields, operators, statements and function calls.
Found by the linter (check-style).
Change-Id: I817b1dcf106cc360a7db56e5b4b0716d5419e2cd Signed-off-by: Alexander Goncharov chat@joursoir.net --- M util/ifdtool/ifdtool.c 1 file changed, 30 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/83281/1
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 1c3e810..033ccf4 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -51,20 +51,20 @@ * protected region start address, where bit 0-11 of * the start address are assumed to be zero. */ - uint32_t start:15; + uint32_t start : 15;
/* Specifies read protection is enabled */ - uint32_t read_protect_en:1; + uint32_t read_protect_en : 1;
/* * End Address: bit 16-30 of the GPRD represents the * protected region end address, where bit 0-11 of * the end address are assumed to be 0xfff. */ - uint32_t end:15; + uint32_t end : 15;
/* Specifies write protection is enabled */ - uint32_t write_protect_en:1; + uint32_t write_protect_en : 1; } __packed data;
uint32_t value; @@ -133,9 +133,9 @@
/* Scan for FD signature */ for (i = 0; i < (size - 4); i += 4) { - if (*(uint32_t *) (image + i) == 0x0FF0A55A) { + if (*(uint32_t *)(image + i) == 0x0FF0A55A) { found = 1; - break; // signature found. + break; // signature found. } }
@@ -144,7 +144,7 @@ return NULL; }
- struct fdbar *fdb = (struct fdbar *) (image + i); + struct fdbar *fdb = (struct fdbar *)(image + i); return PTR_IN_RANGE(fdb, image, size) ? fdb : NULL; }
@@ -168,9 +168,8 @@ struct fdbar *fdb = find_fd(image, size); if (!fdb) return NULL; - struct fcba *fcba = (struct fcba *) (image + ((fdb->flmap0 & 0xff) << 4)); + struct fcba *fcba = (struct fcba *)(image + ((fdb->flmap0 & 0xff) << 4)); return PTR_IN_RANGE(fcba, image, size) ? fcba : NULL; - }
static struct fmba *find_fmba(char *image, int size) @@ -178,7 +177,7 @@ struct fdbar *fdb = find_fd(image, size); if (!fdb) return NULL; - struct fmba *fmba = (struct fmba *) (image + ((fdb->flmap1 & 0xff) << 4)); + struct fmba *fmba = (struct fmba *)(image + ((fdb->flmap1 & 0xff) << 4)); return PTR_IN_RANGE(fmba, image, size) ? fmba : NULL; }
@@ -211,7 +210,7 @@ struct fdbar *fdb = find_fd(image, size); if (!fdb) return NULL; - struct fmsba *fmsba = (struct fmsba *) (image + ((fdb->flmap2 & 0xff) << 4)); + struct fmsba *fmsba = (struct fmsba *)(image + ((fdb->flmap2 & 0xff) << 4)); return PTR_IN_RANGE(fmsba, image, size) ? fmsba : NULL; }
@@ -355,7 +354,7 @@
if (region_type >= max_regions) { fprintf(stderr, "Invalid region type %d.\n", region_type); - exit (EXIT_FAILURE); + exit(EXIT_FAILURE); }
flreg = frba->flreg[region_type]; @@ -387,7 +386,7 @@ { if (region_type >= max_regions) { fprintf(stderr, "Invalid region type.\n"); - exit (EXIT_FAILURE); + exit(EXIT_FAILURE); }
return region_names[region_type].pretty; @@ -452,7 +451,7 @@ * 4 bytes of space. */ if (sorted[i] == frba) - return MIN((sorted[i+1] - sorted[i])/4, MAX_REGIONS); + return MIN((sorted[i + 1] - sorted[i]) / 4, MAX_REGIONS); } /* Never reaches this point */ return 0; @@ -717,7 +716,7 @@ printf("\nFound Component Section\n"); printf("FLCOMP 0x%08x\n", fcba->flcomp); printf(" Dual Output Fast Read Support: %ssupported\n", - (fcba->flcomp & (1 << 30))?"":"not "); + (fcba->flcomp & (1 << 30)) ? "" : "not "); printf(" Read ID/Read Status Clock Frequency: "); decode_spi_frequency((fcba->flcomp >> 27) & 7); printf("\n Write/Erase Clock Frequency: "); @@ -725,7 +724,7 @@ printf("\n Fast Read Clock Frequency: "); decode_spi_frequency((fcba->flcomp >> 21) & 7); printf("\n Fast Read Support: %ssupported", - (fcba->flcomp & (1 << 20))?"":"not "); + (fcba->flcomp & (1 << 20)) ? "" : "not "); if (is_platform_with_100x_series_pch() && chipset != CHIPSET_100_200_SERIES_SUNRISE_POINT) { printf("\n Read eSPI/EC Bus Frequency: "); @@ -977,7 +976,7 @@ static void dump_vtba(const struct vtba *vtba, int vtl) { int i; - int max_len = sizeof(struct vtba)/sizeof(struct vscc); + int max_len = sizeof(struct vtba) / sizeof(struct vscc); int num = (vtl >> 1) < max_len ? (vtl >> 1) : max_len;
printf("ME VSCC table:\n"); @@ -997,10 +996,10 @@ for (i = 0; i < 4; i++) { printf("%02x:", i << 4); for (j = 0; j < 16; j++) - printf(" %02x", oem[(i<<4)+j]); - printf ("\n"); + printf(" %02x", oem[(i << 4) + j]); + printf("\n"); } - printf ("\n"); + printf("\n"); }
static void dump_fd(char *image, int size) @@ -1124,11 +1123,11 @@
sorted_regions[count_regions] = region; // basically insertion sort - for (int i = count_regions-1; i >= 0 ; i--) { - if (sorted_regions[i].base > sorted_regions[i+1].base) { + for (int i = count_regions - 1; i >= 0; i--) { + if (sorted_regions[i].base > sorted_regions[i + 1].base) { struct region tmp = sorted_regions[i]; - sorted_regions[i] = sorted_regions[i+1]; - sorted_regions[i+1] = tmp; + sorted_regions[i] = sorted_regions[i + 1]; + sorted_regions[i + 1] = tmp; } } count_regions++; @@ -1858,8 +1857,8 @@ { if (ifd_version >= IFD_VERSION_2) { printf("%sting the HAP bit to %s Intel ME...\n", - altmedisable?"Set":"Unset", - altmedisable?"disable":"enable"); + altmedisable ? "Set" : "Unset", + altmedisable ? "disable" : "enable"); if (altmedisable) fpsba->pchstrp[0] |= (1 << 16); else @@ -1868,8 +1867,8 @@ if (chipset >= CHIPSET_ICH8 && chipset <= CHIPSET_ICH10) { printf("%sting the ICH_MeDisable, MCH_MeDisable, " "and MCH_AltMeDisable to %s Intel ME...\n", - altmedisable?"Set":"Unset", - altmedisable?"disable":"enable"); + altmedisable ? "Set" : "Unset", + altmedisable ? "disable" : "enable"); if (altmedisable) { /* MCH_MeDisable */ fmsba->data[0] |= 1; @@ -1884,8 +1883,8 @@ } } else { printf("%sting the AltMeDisable to %s Intel ME...\n", - altmedisable?"Set":"Unset", - altmedisable?"disable":"enable"); + altmedisable ? "Set" : "Unset", + altmedisable ? "disable" : "enable"); if (altmedisable) fpsba->pchstrp[10] |= (1 << 7); else @@ -2570,7 +2569,7 @@
// generate new filename if (new_filename == NULL) { - new_filename = (char *) malloc((strlen(filename) + 5) * sizeof(char)); + new_filename = (char *)malloc((strlen(filename) + 5) * sizeof(char)); if (!new_filename) { printf("Out of memory.\n"); exit(EXIT_FAILURE);