Let's not be silly. Use a fancy "if else" to decide behavior of a bool

and hope cosmic radition doesn't create a third state.
This commit is contained in:
joerg 2011-05-22 22:13:33 +00:00
parent 4159594e32
commit 56a181efa4
1 changed files with 4 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $ */ /* $NetBSD: acpi_power.c,v 1.31 2011/05/22 22:13:33 joerg Exp $ */
/*- /*-
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc. * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@ -56,7 +56,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $"); __KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.31 2011/05/22 22:13:33 joerg Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/kmem.h> #include <sys/kmem.h>
@ -480,20 +480,12 @@ acpi_power_res(ACPI_HANDLE hdl, ACPI_HANDLE ref, bool on)
* necessary since a single power resource * necessary since a single power resource
* can be shared by multiple devices. * can be shared by multiple devices.
*/ */
switch (on) { if (on) {
case true:
rv = acpi_power_res_ref(res, ref); rv = acpi_power_res_ref(res, ref);
str = "_ON"; str = "_ON";
break; } else {
case false:
rv = acpi_power_res_deref(res, ref); rv = acpi_power_res_deref(res, ref);
str = "_OFF"; str = "_OFF";
break;
default:
return AE_BAD_PARAMETER;
} }
if (ACPI_FAILURE(rv)) if (ACPI_FAILURE(rv))