svn commit: r344292 - head/sys/dev/acpica

Bruce Evans brde at
Wed Feb 20 01:56:55 UTC 2019

On Tue, 19 Feb 2019, Tom Jones wrote:

> Log:
>  Fix style after r340832
>  Reported by:	jhb
>  Reviewed by:	jhb, jtl
>  Approved by:	jtl (mentor)

Unfortunately, acpi (even the FreeBSD dev/acpica part) has a very
non-KNF style.  It is unclear even what this style is, so it is hard to
write changes consistent with it.  But it is clear that this style isn't
the one one used in the line after the one touched by this commit.

> Modified: head/sys/dev/acpica/acpi_battery.c
> ==============================================================================
> --- head/sys/dev/acpica/acpi_battery.c	Tue Feb 19 18:50:20 2019	(r344291)
> +++ head/sys/dev/acpica/acpi_battery.c	Tue Feb 19 19:04:52 2019	(r344292)
> @@ -172,7 +172,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
> 	 * Be sure we can get various info from the battery.
> 	 */
> 	if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
> -		ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
> +	    ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
> 		continue;
> 	/* If a battery is not installed, we sometimes get strange values. */

acpica uses 4-column indents, especially in this file, so the 'continue' line
is clearly misindented here.

acpica's indentation for continued lines is unclear.  The KNF 4-column
continuation indent works very badly when the main indent is also 4-column.
But it is used in similar code (including a 'continue' just 5 lines after
here).  So it is consistently bad here.

Elsewhere, acpica seems to use gnu style (-lp).  Here and 5 lines later,
that accidentally gives the 4-column indent by lining up with the
parentheses of 'if (',

A quick look at some other files shows many examples of gnu style (-lp)
for long function parameter lists, and many similar regressions towards
KNF style.


More information about the svn-src-all mailing list