Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
077f893b
Commit
077f893b
authored
Apr 08, 2013
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'acpi-pm' into linux-next
* acpi-pm: ACPI / PM: Fix potential problem in acpi_device_get_power()
parents
6912897d
75eb2d13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
drivers/acpi/device_pm.c
drivers/acpi/device_pm.c
+24
-15
No files found.
drivers/acpi/device_pm.c
View file @
077f893b
...
...
@@ -145,27 +145,36 @@ int acpi_device_get_power(struct acpi_device *device, int *state)
}
/*
* Get the device's power state
either directly (via _PSC) or
* i
ndirectly (via power resources)
.
* Get the device's power state
from power resources settings and _PSC,
* i
f available
.
*/
if
(
device
->
power
.
flags
.
power_resources
)
{
int
error
=
acpi_power_get_inferred_state
(
device
,
&
result
);
if
(
error
)
return
error
;
}
if
(
device
->
power
.
flags
.
explicit_get
)
{
acpi_handle
handle
=
device
->
handle
;
unsigned
long
long
psc
;
acpi_status
status
=
acpi_evaluate_integer
(
device
->
handle
,
"_PSC"
,
NULL
,
&
psc
);
acpi_status
status
;
status
=
acpi_evaluate_integer
(
handle
,
"_PSC"
,
NULL
,
&
psc
);
if
(
ACPI_FAILURE
(
status
))
return
-
ENODEV
;
result
=
psc
;
}
/* The test below covers ACPI_STATE_UNKNOWN too. */
if
(
result
<=
ACPI_STATE_D2
)
{
;
/* Do nothing. */
}
else
if
(
device
->
power
.
flags
.
power_resources
)
{
int
error
=
acpi_power_get_inferred_state
(
device
,
&
result
);
if
(
error
)
return
error
;
}
else
if
(
result
==
ACPI_STATE_D3_HOT
)
{
result
=
ACPI_STATE_D3
;
/*
* The power resources settings may indicate a power state
* shallower than the actual power state of the device.
*
* Moreover, on systems predating ACPI 4.0, if the device
* doesn't depend on any power resources and _PSC returns 3,
* that means "power off". We need to maintain compatibility
* with those systems.
*/
if
(
psc
>
result
&&
psc
<
ACPI_STATE_D3_COLD
)
result
=
psc
;
else
if
(
result
==
ACPI_STATE_UNKNOWN
)
result
=
psc
>
ACPI_STATE_D2
?
ACPI_STATE_D3_COLD
:
psc
;
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment