clamp min/max values properly.
This commit is contained in:
parent
c04c9a55d0
commit
d1b79165fa
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sony_acpi.c,v 1.2 2007/12/23 18:03:02 jmcneill Exp $ */
|
||||
/* $NetBSD: sony_acpi.c,v 1.3 2008/01/06 19:42:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -36,7 +36,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sony_acpi.c,v 1.2 2007/12/23 18:03:02 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sony_acpi.c,v 1.3 2008/01/06 19:42:03 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -424,9 +424,12 @@ sony_acpi_brightness_up(device_t dv)
|
|||
ACPI_STATUS rv;
|
||||
|
||||
rv = acpi_eval_integer(sc->sc_node->ad_handle, "GBRT", &arg);
|
||||
if (ACPI_FAILURE(rv) || arg > 8)
|
||||
if (ACPI_FAILURE(rv))
|
||||
return;
|
||||
arg++;
|
||||
if (arg >= 8)
|
||||
arg = 8;
|
||||
else
|
||||
arg++;
|
||||
sony_acpi_eval_set_integer(sc->sc_node->ad_handle, "SBRT", arg, NULL);
|
||||
}
|
||||
|
||||
|
@ -438,9 +441,12 @@ sony_acpi_brightness_down(device_t dv)
|
|||
ACPI_STATUS rv;
|
||||
|
||||
rv = acpi_eval_integer(sc->sc_node->ad_handle, "GBRT", &arg);
|
||||
if (ACPI_FAILURE(rv) || arg == 0)
|
||||
if (ACPI_FAILURE(rv))
|
||||
return;
|
||||
arg--;
|
||||
if (arg <= 0)
|
||||
arg = 0;
|
||||
else
|
||||
arg--;
|
||||
sony_acpi_eval_set_integer(sc->sc_node->ad_handle, "SBRT", arg, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue