Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Oct 2012 17:52:54 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Juli Mallett <jmallett@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r242276 - head/sys/mips/cavium
Message-ID:  <20121029173544.Y1261@besplex.bde.org>
In-Reply-To: <201210290210.q9T2AKOd052811@svn.freebsd.org>
References:  <201210290210.q9T2AKOd052811@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 29 Oct 2012, Juli Mallett wrote:

> Log:
>  Wrap some long lines and display board serial numbers at boot.

Any chance of using FreeBSD style instead of gnu style for the wrapping?

> Modified: head/sys/mips/cavium/octeon_machdep.c
> ==============================================================================
> --- head/sys/mips/cavium/octeon_machdep.c	Mon Oct 29 01:51:24 2012	(r242275)
> +++ head/sys/mips/cavium/octeon_machdep.c	Mon Oct 29 02:10:20 2012	(r242276)
> @@ -512,14 +512,19 @@ octeon_process_app_desc_ver_6(void)
> 					octeon_bootinfo->board_rev_major,
> 					octeon_bootinfo->board_rev_minor,
> 					octeon_bootinfo->eclock_hz);

This old wrapping uses gnu style (indent -lp).

The struct member names in it are verbose, but not verbose enough to have
normal style with a struct-dependent prefix.

> -	memcpy(cvmx_sysinfo_get()->mac_addr_base, octeon_bootinfo->mac_addr_base, 6);
> +	memcpy(cvmx_sysinfo_get()->mac_addr_base,
> +	       octeon_bootinfo->mac_addr_base, 6);

This new wrapping is in gnu style.  FreeBSD style is indent -ci4.

> 	cvmx_sysinfo_get()->mac_addr_count = octeon_bootinfo->mac_addr_count;
> 	cvmx_sysinfo_get()->compact_flash_common_base_addr =
> 		octeon_bootinfo->compact_flash_common_base_addr;
> 	cvmx_sysinfo_get()->compact_flash_attribute_base_addr =
> 		octeon_bootinfo->compact_flash_attribute_base_addr;

The last 2 wrappings aren't in either gnu style or FreeBSD style.  FreeBSD
style is indent -ci4 again.  Gnu style is to put the operator on the new
line, and IIRC, line up the operator with the variable, resulting in no
indentation for the operator.  This has the FreeBSD style for the operator,
but a contination indent of 8.

> 	cvmx_sysinfo_get()->core_mask = octeon_bootinfo->core_mask;
> -	cvmx_sysinfo_get()->led_display_base_addr = octeon_bootinfo->led_display_base_addr;
> +	cvmx_sysinfo_get()->led_display_base_addr =
> +		octeon_bootinfo->led_display_base_addr;

This matches the above for neither gnu not FreeBSD style.

> +	memcpy(cvmx_sysinfo_get()->board_serial_number,
> +	       octeon_bootinfo->board_serial_number,
> +	       sizeof cvmx_sysinfo_get()->board_serial_number);

This matches the above for the gnu style of the indentation.

It also doesn't follow FreeBSD style for the explicit "sizeof is not
followed by a space" or the implicit "sizeof is followed by a left
parentheses (without a space)".  The former implies the latter, because
the identifiers would coalesce without the space.  My normal style would
omit the parentheses for `sizeof object' and everywhere else possible,
but here they are needed for another reason for people who like
excessive parentheses: the pointer is returned by a function so it
has parentheses in it, so it is not as clear as usual what the object
is.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121029173544.Y1261>