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
633379a0
Commit
633379a0
authored
Jan 12, 2011
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugzilla-15100' into release
parents
d16675e1
cc8e7a35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
28 deletions
+72
-28
drivers/pnp/driver.c
drivers/pnp/driver.c
+5
-2
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/core.c
+67
-26
No files found.
drivers/pnp/driver.c
View file @
633379a0
...
...
@@ -189,8 +189,11 @@ static int pnp_bus_resume(struct device *dev)
if
(
!
pnp_drv
)
return
0
;
if
(
pnp_dev
->
protocol
->
resume
)
pnp_dev
->
protocol
->
resume
(
pnp_dev
);
if
(
pnp_dev
->
protocol
->
resume
)
{
error
=
pnp_dev
->
protocol
->
resume
(
pnp_dev
);
if
(
error
)
return
error
;
}
if
(
pnp_can_write
(
pnp_dev
))
{
error
=
pnp_start_dev
(
pnp_dev
);
...
...
drivers/pnp/pnpacpi/core.c
View file @
633379a0
...
...
@@ -81,12 +81,19 @@ static int pnpacpi_get_resources(struct pnp_dev *dev)
static
int
pnpacpi_set_resources
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
=
dev
->
data
;
acpi_handle
handle
=
acpi_dev
->
handle
;
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
struct
acpi_buffer
buffer
;
int
ret
;
pnp_dbg
(
&
dev
->
dev
,
"set resources
\n
"
);
handle
=
DEVICE_ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
ACPI_FAILURE
(
acpi_bus_get_device
(
handle
,
&
acpi_dev
)))
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
-
ENODEV
;
}
ret
=
pnpacpi_build_resource_template
(
dev
,
&
buffer
);
if
(
ret
)
return
ret
;
...
...
@@ -105,12 +112,18 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
static
int
pnpacpi_disable_resources
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
=
dev
->
data
;
acpi_handle
handle
=
acpi_dev
->
handle
;
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
int
ret
;
dev_dbg
(
&
dev
->
dev
,
"disable resources
\n
"
);
handle
=
DEVICE_ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
ACPI_FAILURE
(
acpi_bus_get_device
(
handle
,
&
acpi_dev
)))
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
0
;
}
/* acpi_unregister_gsi(pnp_irq(dev, 0)); */
ret
=
0
;
if
(
acpi_bus_power_manageable
(
handle
))
...
...
@@ -124,46 +137,74 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
#ifdef CONFIG_ACPI_SLEEP
static
bool
pnpacpi_can_wakeup
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
=
dev
->
data
;
acpi_handle
handle
=
acpi_dev
->
handle
;
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
handle
=
DEVICE_ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
ACPI_FAILURE
(
acpi_bus_get_device
(
handle
,
&
acpi_dev
)))
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
false
;
}
return
acpi_bus_can_wakeup
(
handle
);
}
static
int
pnpacpi_suspend
(
struct
pnp_dev
*
dev
,
pm_message_t
state
)
{
struct
acpi_device
*
acpi_dev
=
dev
->
data
;
acpi_handle
handle
=
acpi_dev
->
handle
;
int
power_state
;
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
int
error
=
0
;
handle
=
DEVICE_ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
ACPI_FAILURE
(
acpi_bus_get_device
(
handle
,
&
acpi_dev
)))
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
0
;
}
if
(
device_can_wakeup
(
&
dev
->
dev
))
{
int
rc
=
acpi_pm_device_sleep_wake
(
&
dev
->
dev
,
error
=
acpi_pm_device_sleep_wake
(
&
dev
->
dev
,
device_may_wakeup
(
&
dev
->
dev
));
if
(
error
)
return
error
;
}
if
(
acpi_bus_power_manageable
(
handle
))
{
int
power_state
=
acpi_pm_device_sleep_state
(
&
dev
->
dev
,
NULL
);
if
(
power_state
<
0
)
power_state
=
(
state
.
event
==
PM_EVENT_ON
)
?
ACPI_STATE_D0
:
ACPI_STATE_D3
;
if
(
rc
)
return
rc
;
/*
* acpi_bus_set_power() often fails (keyboard port can't be
* powered-down?), and in any case, our return value is ignored
* by pnp_bus_suspend(). Hence we don't revert the wakeup
* setting if the set_power fails.
*/
error
=
acpi_bus_set_power
(
handle
,
power_state
);
}
power_state
=
acpi_pm_device_sleep_state
(
&
dev
->
dev
,
NULL
);
if
(
power_state
<
0
)
power_state
=
(
state
.
event
==
PM_EVENT_ON
)
?
ACPI_STATE_D0
:
ACPI_STATE_D3
;
/* acpi_bus_set_power() often fails (keyboard port can't be
* powered-down?), and in any case, our return value is ignored
* by pnp_bus_suspend(). Hence we don't revert the wakeup
* setting if the set_power fails.
*/
return
acpi_bus_set_power
(
handle
,
power_state
);
return
error
;
}
static
int
pnpacpi_resume
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
=
dev
->
data
;
acpi_handle
handle
=
acpi_dev
->
handle
;
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
=
DEVICE_ACPI_HANDLE
(
&
dev
->
dev
);
int
error
=
0
;
if
(
!
handle
||
ACPI_FAILURE
(
acpi_bus_get_device
(
handle
,
&
acpi_dev
)))
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
-
ENODEV
;
}
if
(
device_may_wakeup
(
&
dev
->
dev
))
acpi_pm_device_sleep_wake
(
&
dev
->
dev
,
false
);
return
acpi_bus_set_power
(
handle
,
ACPI_STATE_D0
);
if
(
acpi_bus_power_manageable
(
handle
))
error
=
acpi_bus_set_power
(
handle
,
ACPI_STATE_D0
);
return
error
;
}
#endif
...
...
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