Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
treewide: Use C-style comments on some files
On some files, most comments are C-style except for a few outliers.
Change-Id: I74102108ef4b0365a9bf0fea20f012aece201892 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M 82802ab.c M flashrom.c M hwaccess.c M layout.c M os.h M physmap.c M platform.h M rayer_spi.c 8 files changed, 35 insertions(+), 35 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/60/38660/1
diff --git a/82802ab.c b/82802ab.c index 281b66e..a44a66e 100644 --- a/82802ab.c +++ b/82802ab.c @@ -89,7 +89,7 @@ chipaddr bios = flash->virtual_memory;
chip_writeb(flash, 0x70, bios); - if ((chip_readb(flash, bios) & 0x80) == 0) { // it's busy + if ((chip_readb(flash, bios) & 0x80) == 0) { /* it's busy */ while ((chip_readb(flash, bios) & 0x80) == 0) ; }
@@ -107,15 +107,15 @@ chipaddr bios = flash->virtual_memory; uint8_t status;
- // clear status register + /* clear status register */ chip_writeb(flash, 0x50, bios + page);
- // now start it + /* now start it */ chip_writeb(flash, 0x20, bios + page); chip_writeb(flash, 0xd0, bios + page); programmer_delay(10);
- // now let's see what the register is + /* now let's see what the register is */ status = wait_82802ab(flash); print_status_82802ab(status);
@@ -164,7 +164,7 @@
/* Read block lock-bits */ for (i = 0; i < flash->chip->total_size * 1024; i+= (64 * 1024)) { - bcfg = chip_readb(flash, bios + i + 2); // read block lock config + bcfg = chip_readb(flash, bios + i + 2); /* read block lock config */ msg_cdbg("block lock at %06x is %slocked!\n", i, bcfg ? "" : "un"); if (bcfg) { need_unlock = 1; diff --git a/flashrom.c b/flashrom.c index e540027..2bc1d54 100644 --- a/flashrom.c +++ b/flashrom.c @@ -452,7 +452,7 @@ #if CONFIG_NI845X_SPI == 1 { .name = "ni845x_spi", - .type = OTHER, // choose other because NI-845x uses own USB implementation + .type = OTHER, /* choose other because NI-845x uses own USB implementation */ .devs.note = "National Instruments USB-845x\n", .init = ni845x_spi_init, .map_flash_region = fallback_map, @@ -1324,7 +1324,7 @@ msg_gerr("Error: flushing file "%s" failed: %s\n", filename, strerror(errno)); ret = 1; } - // Try to fsync() only regular files and if that function is available at all (e.g. not on MinGW). + /* Try to fsync() only regular files and if that function is available at all (e.g. not on MinGW). */ #if defined(_POSIX_FSYNC) && (_POSIX_FSYNC != -1) struct stat image_stat; if (fstat(fileno(image), &image_stat) != 0) { @@ -1466,7 +1466,7 @@ "eraseblock layout is not defined. "); return 1; } - // TODO: Once erase functions are annotated with allowed buses, check that as well. + /* TODO: Once erase functions are annotated with allowed buses, check that as well. */ return 0; }
diff --git a/hwaccess.c b/hwaccess.c index 48ccb34..0639d55 100644 --- a/hwaccess.c +++ b/hwaccess.c @@ -70,7 +70,7 @@ * * See also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documen... */ -#if IS_PPC // cf. http://lxr.free-electrons.com/source/arch/powerpc/include/asm/barrier.h +#if IS_PPC /* cf. http://lxr.free-electrons.com/source/arch/powerpc/include/asm/barrier.h */ asm("eieio" : : : "memory"); #elif IS_SPARC #if defined(__sparc_v9__) || defined(__sparcv9) diff --git a/layout.c b/layout.c index d80b01f..44ea667 100644 --- a/layout.c +++ b/layout.c @@ -68,7 +68,7 @@ if (2 != fscanf(romlayout, "%255s %255s\n", tempstr, tempname)) continue; #if 0 - // fscanf does not like arbitrary comments like that :( later + /* fscanf does not like arbitrary comments like that :( later */ if (tempstr[0] == '#') { continue; } diff --git a/os.h b/os.h index ddfa46b..1409d96 100644 --- a/os.h +++ b/os.h @@ -19,45 +19,45 @@
#include "platform.h"
-// Solaris +/* Solaris */ #if defined (__sun) && (defined(__i386) || defined(__amd64)) #define __FLASHROM_OS__ "SunOS" -// OS X +/* OS X */ #elif defined(__MACH__) && defined(__APPLE__) #define __FLASHROM_OS__ "Darwin" -// FreeBSD +/* FreeBSD */ #elif defined(__FreeBSD__) #define __FLASHROM_OS__ "FreeBSD" -// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD) +/* FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD) */ #elif defined(__FreeBSD_kernel__) && defined(__GLIBC__) #define __FLASHROM_OS__ "FreeBSD-glibc" -// DragonFlyBSD +/* DragonFlyBSD */ #elif defined(__DragonFly__) #define __FLASHROM_OS__ "DragonFlyBSD" -// NetBSD +/* NetBSD */ #elif defined(__NetBSD__) #define __FLASHROM_OS__ "NetBSD" -// OpenBSD +/* OpenBSD */ #elif defined(__OpenBSD__) #define __FLASHROM_OS__ "OpenBSD" -// DJGPP +/* DJGPP */ #elif defined(__DJGPP__) #define __FLASHROM_OS__ "DOS" -// MinGW (always has _WIN32 available) +/* MinGW (always has _WIN32 available) */ #elif defined(__MINGW32__) #define __FLASHROM_OS__ "MinGW" -// Cygwin (usually without _WIN32) +/* Cygwin (usually without _WIN32) */ #elif defined( __CYGWIN__) #define __FLASHROM_OS__ "Cygwin" -// libpayload +/* libpayload */ #elif defined(__LIBPAYLOAD__) #define __FLASHROM_OS__ "libpayload" -// GNU Hurd +/* GNU Hurd */ #elif defined(__gnu_hurd__) #define __FLASHROM_OS__ "Hurd" -// Linux +/* Linux */ #elif defined(__linux__) - // There are various flags in use on Android apparently. __ANDROID__ seems to be the most trustworthy. + /* There are various flags in use on Android apparently. __ANDROID__ seems to be the most trustworthy. */ #if defined(__ANDROID__) #define __FLASHROM_OS__ "Android" #else diff --git a/physmap.c b/physmap.c index 72d5899..a5cfc0d 100644 --- a/physmap.c +++ b/physmap.c @@ -397,7 +397,7 @@ }
if (errno != EIO) { - // A severe error. + /* A severe error. */ msg_perr("Could not read() MSR: %s\n", strerror(errno)); close(fd_msr); exit(1); @@ -628,13 +628,13 @@ /* rdmsr() and wrmsr() are provided by DirectHW which needs neither setup nor cleanup. */ int setup_cpu_msr(int cpu) { - // Always succeed for now + /* Always succeed for now */ return 0; }
void cleanup_cpu_msr(void) { - // Nothing, yet. + /* Nothing, yet. */ } #elif defined(__LIBPAYLOAD__) msr_t libpayload_rdmsr(int addr) @@ -682,10 +682,10 @@
void cleanup_cpu_msr(void) { - // Nothing, yet. + /* Nothing, yet. */ } -#endif // OS switches for MSR code -#else // x86 +#endif /* OS switches for MSR code */ +#else /* x86 */ /* Does MSR exist on non-x86 architectures? */ -#endif // arch switches for MSR code -#endif // CONFIG_INTERNAL == 1 +#endif /* arch switches for MSR code */ +#endif /* CONFIG_INTERNAL == 1 */ diff --git a/platform.h b/platform.h index 751957c..f3970be 100644 --- a/platform.h +++ b/platform.h @@ -20,7 +20,7 @@ #ifndef __PLATFORM_H__ #define __PLATFORM_H__ 1
-// Helper defines for operating systems +/* Helper defines for operating systems */ #if defined(__gnu_linux__) || defined(__linux__) #define IS_LINUX 1 #else @@ -37,7 +37,7 @@ #define IS_WINDOWS 0 #endif
-// Likewise for target architectures +/* Likewise for target architectures */ #if defined (__i386__) || defined (__x86_64__) || defined(__amd64__) #define __FLASHROM_ARCH__ "x86" #define IS_X86 1 diff --git a/rayer_spi.c b/rayer_spi.c index 8e869e6..27169b6 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -151,7 +151,7 @@ { uint8_t tmp;
- tmp = INB(lpt_iobase + 1) ^ 0x80; // bit.7 inverted + tmp = INB(lpt_iobase + 1) ^ 0x80; /* bit.7 inverted */ tmp = (tmp >> pinout->miso_bit) & 0x1; return tmp; }
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Patch Set 1: Code-Review-1
Thanks for doing this. There are a lot more instances of this, though... I see at least 212 instances using `grep -rH '//[[:space:]]' *.c *.h | wc -l`.
Want to try and fix some more instances while you're at it? Also, maybe we can look into git hooks to prevent more C++ style comments from creeping in?
I don't mind committing this as an incremental step, though. (marking as -1 just so I see it as reviewed in the gerrit dashboard)
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Patch Set 1:
Patch Set 1: Code-Review-1
Thanks for doing this. There are a lot more instances of this, though... I see at least 212 instances using `grep -rH '//[[:space:]]' *.c *.h | wc -l`.
Want to try and fix some more instances while you're at it? Also, maybe we can look into git hooks to prevent more C++ style comments from creeping in?
I don't mind committing this as an incremental step, though. (marking as -1 just so I see it as reviewed in the gerrit dashboard)
I know there are many more instances. I handled the files that had just a few outliers. Is there any rule about using C++ style comments, though? There's some files that make heavy use of them.
Also, I didn't touch FIXME comments on some files. They are FIXMEs, and should probably be fixed someday. (they were also at the end of a line, and using C-style comments might have made the lines a tad bit too long)
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Patch Set 1:
The coding style allows C++ style comments. It was explicitly added, and diverted from the original Linux kernel coding style. I prefer, that it should be consistent in files though.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Patch Set 1:
Patch Set 1: Code-Review-1
Thanks for doing this. There are a lot more instances of this, though... I see at least 212 instances using `grep -rH '//[[:space:]]' *.c *.h | wc -l`.
Want to try and fix some more instances while you're at it? Also, maybe we can look into git hooks to prevent more C++ style comments from creeping in?
I don't mind committing this as an incremental step, though. (marking as -1 just so I see it as reviewed in the gerrit dashboard)
Currently, this change is preventing other changes in the train from being submitted. I don't think I will be able to fix more instances soon (two busy weeks ahead), so I would prefer to do this incrementally.
Patch Set 1:
The coding style allows C++ style comments. It was explicitly added, and diverted from the original Linux kernel coding style. I prefer, that it should be consistent in files though.
Ack. In the files I touched, I replaced every single C++ style comment with a C style comment, so they are consistent.
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Patch Set 1:
Currently, this change is preventing other changes in the train from being submitted. I don't think I will be able to fix more instances soon (two busy weeks ahead), so I would prefer to do this incrementally.
In light of what Carl-Daniel said in CB:38662, perhaps we should shelve this and wait for larger, more comprehensive clean-up (if ever) to reduce noise in `git blame`. Do you have a really strong preference here?
I know this is blocking some other changes... it's always a good idea to put these kind of far-reaching changes at the end of the relation chain for that reason.
Angel Pons has abandoned this change. ( https://review.coreboot.org/c/flashrom/+/38660 )
Change subject: treewide: Use C-style comments on some files ......................................................................
Abandoned