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
feb41bb1
Commit
feb41bb1
authored
Jul 30, 2014
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back earlier acpi-pnp material.
Conflicts: drivers/pnp/pnpacpi/core.c
parents
b6328a07
e70dba60
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
67 deletions
+28
-67
drivers/acpi/internal.h
drivers/acpi/internal.h
+0
-2
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/core.c
+26
-65
include/acpi/acpi_bus.h
include/acpi/acpi_bus.h
+2
-0
No files found.
drivers/acpi/internal.h
View file @
feb41bb1
...
...
@@ -84,8 +84,6 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
int
type
,
unsigned
long
long
sta
);
void
acpi_device_add_finalize
(
struct
acpi_device
*
device
);
void
acpi_free_pnp_ids
(
struct
acpi_device_pnp
*
pnp
);
int
acpi_bind_one
(
struct
device
*
dev
,
struct
acpi_device
*
adev
);
int
acpi_unbind_one
(
struct
device
*
dev
);
bool
acpi_device_is_present
(
struct
acpi_device
*
adev
);
bool
acpi_device_is_battery
(
struct
acpi_device
*
adev
);
...
...
drivers/pnp/pnpacpi/core.c
View file @
feb41bb1
...
...
@@ -67,8 +67,8 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
pnp_dbg
(
&
dev
->
dev
,
"set resources
\n
"
);
handle
=
ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
acpi_dev
)
)
{
acpi_dev
=
ACPI_COMPANION
(
&
dev
->
dev
);
if
(
!
acpi_dev
)
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
-
ENODEV
;
}
...
...
@@ -76,6 +76,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
if
(
WARN_ON_ONCE
(
acpi_dev
!=
dev
->
data
))
dev
->
data
=
acpi_dev
;
handle
=
acpi_dev
->
handle
;
if
(
acpi_has_method
(
handle
,
METHOD_NAME__SRS
))
{
struct
acpi_buffer
buffer
;
...
...
@@ -93,8 +94,8 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
}
kfree
(
buffer
.
pointer
);
}
if
(
!
ret
&&
acpi_
bus_power_manageable
(
handle
))
ret
=
acpi_
bus_set_power
(
handle
,
ACPI_STATE_D0
);
if
(
!
ret
&&
acpi_
device_power_manageable
(
acpi_dev
))
ret
=
acpi_
device_set_power
(
acpi_dev
,
ACPI_STATE_D0
);
return
ret
;
}
...
...
@@ -102,23 +103,22 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
static
int
pnpacpi_disable_resources
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
acpi_status
status
;
dev_dbg
(
&
dev
->
dev
,
"disable resources
\n
"
);
handle
=
ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
acpi_dev
)
)
{
acpi_dev
=
ACPI_COMPANION
(
&
dev
->
dev
);
if
(
!
acpi_dev
)
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
0
;
}
/* acpi_unregister_gsi(pnp_irq(dev, 0)); */
if
(
acpi_
bus_power_manageable
(
handle
))
acpi_
bus_set_power
(
handle
,
ACPI_STATE_D3_COLD
);
if
(
acpi_
device_power_manageable
(
acpi_dev
))
acpi_
device_set_power
(
acpi_dev
,
ACPI_STATE_D3_COLD
);
/* continue even if acpi_
bus
_set_power() fails */
status
=
acpi_evaluate_object
(
handle
,
"_DIS"
,
NULL
,
NULL
);
/* continue even if acpi_
device
_set_power() fails */
status
=
acpi_evaluate_object
(
acpi_dev
->
handle
,
"_DIS"
,
NULL
,
NULL
);
if
(
ACPI_FAILURE
(
status
)
&&
status
!=
AE_NOT_FOUND
)
return
-
ENODEV
;
...
...
@@ -128,26 +128,22 @@ 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
;
acpi_handle
handle
;
struct
acpi_device
*
acpi_dev
=
ACPI_COMPANION
(
&
dev
->
dev
);
handle
=
ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
acpi_dev
))
{
if
(
!
acpi_dev
)
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
false
;
}
return
acpi_bus_can_wakeup
(
handle
);
return
acpi_bus_can_wakeup
(
acpi_dev
->
handle
);
}
static
int
pnpacpi_suspend
(
struct
pnp_dev
*
dev
,
pm_message_t
state
)
{
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
;
struct
acpi_device
*
acpi_dev
=
ACPI_COMPANION
(
&
dev
->
dev
);
int
error
=
0
;
handle
=
ACPI_HANDLE
(
&
dev
->
dev
);
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
acpi_dev
))
{
if
(
!
acpi_dev
)
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
0
;
}
...
...
@@ -159,7 +155,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
return
error
;
}
if
(
acpi_
bus_power_manageable
(
handle
))
{
if
(
acpi_
device_power_manageable
(
acpi_dev
))
{
int
power_state
=
acpi_pm_device_sleep_state
(
&
dev
->
dev
,
NULL
,
ACPI_STATE_D3_COLD
);
if
(
power_state
<
0
)
...
...
@@ -167,12 +163,12 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
ACPI_STATE_D0
:
ACPI_STATE_D3_COLD
;
/*
* acpi_
bus_set_power() often fails
(keyboard port can't be
* acpi_
device_set_power() can fail
(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
);
error
=
acpi_
device_set_power
(
acpi_dev
,
power_state
);
}
return
error
;
...
...
@@ -180,11 +176,10 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
static
int
pnpacpi_resume
(
struct
pnp_dev
*
dev
)
{
struct
acpi_device
*
acpi_dev
;
acpi_handle
handle
=
ACPI_HANDLE
(
&
dev
->
dev
);
struct
acpi_device
*
acpi_dev
=
ACPI_COMPANION
(
&
dev
->
dev
);
int
error
=
0
;
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
acpi_dev
)
)
{
if
(
!
acpi_dev
)
{
dev_dbg
(
&
dev
->
dev
,
"ACPI device not found in %s!
\n
"
,
__func__
);
return
-
ENODEV
;
}
...
...
@@ -192,8 +187,8 @@ static int pnpacpi_resume(struct pnp_dev *dev)
if
(
device_may_wakeup
(
&
dev
->
dev
))
acpi_pm_device_sleep_wake
(
&
dev
->
dev
,
false
);
if
(
acpi_
bus_power_manageable
(
handle
))
error
=
acpi_
bus_set_power
(
handle
,
ACPI_STATE_D0
);
if
(
acpi_
device_power_manageable
(
acpi_dev
))
error
=
acpi_
device_set_power
(
acpi_dev
,
ACPI_STATE_D0
);
return
error
;
}
...
...
@@ -295,9 +290,11 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
return
error
;
}
error
=
acpi_bind_one
(
&
dev
->
dev
,
device
);
num
++
;
return
0
;
return
error
;
}
static
acpi_status
__init
pnpacpi_add_device_handler
(
acpi_handle
handle
,
...
...
@@ -313,40 +310,6 @@ static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
return
AE_OK
;
}
static
int
__init
acpi_pnp_match
(
struct
device
*
dev
,
void
*
_pnp
)
{
struct
acpi_device
*
acpi
=
to_acpi_device
(
dev
);
struct
pnp_dev
*
pnp
=
_pnp
;
/* true means it matched */
return
pnp
->
data
==
acpi
;
}
static
struct
acpi_device
*
__init
acpi_pnp_find_companion
(
struct
device
*
dev
)
{
dev
=
bus_find_device
(
&
acpi_bus_type
,
NULL
,
to_pnp_dev
(
dev
),
acpi_pnp_match
);
if
(
!
dev
)
return
NULL
;
put_device
(
dev
);
return
to_acpi_device
(
dev
);
}
/* complete initialization of a PNPACPI device includes having
* pnpdev->dev.archdata.acpi_handle point to its ACPI sibling.
*/
static
bool
acpi_pnp_bus_match
(
struct
device
*
dev
)
{
return
dev
->
bus
==
&
pnp_bus_type
;
}
static
struct
acpi_bus_type
__initdata
acpi_pnp_bus
=
{
.
name
=
"PNP"
,
.
match
=
acpi_pnp_bus_match
,
.
find_companion
=
acpi_pnp_find_companion
,
};
int
pnpacpi_disabled
__initdata
;
static
int
__init
pnpacpi_init
(
void
)
{
...
...
@@ -356,10 +319,8 @@ static int __init pnpacpi_init(void)
}
printk
(
KERN_INFO
"pnp: PnP ACPI init
\n
"
);
pnp_register_protocol
(
&
pnpacpi_protocol
);
register_acpi_bus_type
(
&
acpi_pnp_bus
);
acpi_get_devices
(
NULL
,
pnpacpi_add_device_handler
,
NULL
,
NULL
);
printk
(
KERN_INFO
"pnp: PnP ACPI: found %d devices
\n
"
,
num
);
unregister_acpi_bus_type
(
&
acpi_pnp_bus
);
pnp_platform_devices
=
1
;
return
0
;
}
...
...
include/acpi/acpi_bus.h
View file @
feb41bb1
...
...
@@ -487,6 +487,8 @@ struct acpi_bus_type {
};
int
register_acpi_bus_type
(
struct
acpi_bus_type
*
);
int
unregister_acpi_bus_type
(
struct
acpi_bus_type
*
);
int
acpi_bind_one
(
struct
device
*
dev
,
struct
acpi_device
*
adev
);
int
acpi_unbind_one
(
struct
device
*
dev
);
struct
acpi_pci_root
{
struct
acpi_device
*
device
;
...
...
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