Page MenuHomeFreeBSD

D53909.id167097.diff
No OneTemporary

D53909.id167097.diff

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -618,7 +618,7 @@
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
&sc->acpi_lid_switch_stype, 0, acpi_stype_sysctl, "A",
"Lid ACPI sleep state. Set to s2idle or s2mem if you want to suspend "
- "your laptop when close the lid.");
+ "your laptop when you close the lid.");
SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
NULL, 0, acpi_suspend_state_sysctl, "A",
@@ -628,7 +628,7 @@
OID_AUTO, "standby_state",
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
&sc->acpi_standby_sx, 0, acpi_sleep_state_sysctl, "A",
- "ACPI Sx state to use when going standby (S1 or S2).");
+ "ACPI Sx state to use when going standby (usually S1 or S2).");
SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0,
"sleep delay in seconds");
@@ -4584,13 +4584,15 @@
{
int sstate;
+ if (strcasecmp(sname, "NONE") == 0)
+ return (ACPI_STATE_UNKNOWN);
+
if (toupper(sname[0]) == 'S') {
sstate = sname[1] - '0';
if (sstate >= ACPI_STATE_S0 && sstate <= ACPI_STATE_S5 &&
sname[2] == '\0')
return (sstate);
- } else if (strcasecmp(sname, "NONE") == 0)
- return (ACPI_STATE_UNKNOWN);
+ }
return (-1);
}
@@ -4645,8 +4647,10 @@
if (new_sstate < 0)
return (EINVAL);
new_stype = acpi_sstate_to_stype(new_sstate);
- if (acpi_supported_stypes[new_stype] == false)
+ if (new_sstate != ACPI_STATE_UNKNOWN &&
+ acpi_supported_stypes[new_stype] == false)
return (EOPNOTSUPP);
+
if (new_stype != old_stype)
power_suspend_stype = new_stype;
return (err);
@@ -4689,21 +4693,26 @@
if (err != 0 || req->newptr == NULL)
return (err);
- new_stype = power_name_to_stype(name);
- if (new_stype == POWER_STYPE_UNKNOWN) {
- sstate = acpi_sname_to_sstate(name);
- if (sstate < 0)
- return (EINVAL);
- printf("warning: this sysctl expects a sleep type, but an ACPI S-state has "
- "been passed to it. This functionality is deprecated; see acpi(4).\n");
- if (sstate < ACPI_S_STATE_COUNT &&
- !acpi_supported_sstates[sstate])
+ if (strcasecmp(name, "NONE") == 0)
+ new_stype = POWER_STYPE_UNKNOWN;
+ else {
+ new_stype = power_name_to_stype(name);
+ if (new_stype == POWER_STYPE_UNKNOWN) {
+ sstate = acpi_sname_to_sstate(name);
+ if (sstate < 0)
+ return (EINVAL);
+ printf("warning: this sysctl expects a sleep type, but an ACPI "
+ "S-state has been passed to it. This functionality is "
+ "deprecated; see acpi(4).\n");
+ MPASS(sstate < ACPI_S_STATE_COUNT);
+ if (acpi_supported_sstates[sstate] == false)
+ return (EOPNOTSUPP);
+ new_stype = acpi_sstate_to_stype(sstate);
+ }
+ if (acpi_supported_stypes[new_stype] == false)
return (EOPNOTSUPP);
- new_stype = acpi_sstate_to_stype(sstate);
}
- if (acpi_supported_stypes[new_stype] == false)
- return (EOPNOTSUPP);
if (new_stype != old_stype)
*(enum power_stype *)oidp->oid_arg1 = new_stype;
return (0);

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 27, 9:24 AM (6 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35592632
Default Alt Text
D53909.id167097.diff (3 KB)

Event Timeline