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
c8d9c367
Commit
c8d9c367
authored
Jun 16, 2021
by
Hans de Goede
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'linux-pm/acpi-scan' into review-hans
parents
6c8f2df3
23db673d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
154 additions
and
79 deletions
+154
-79
drivers/acpi/ec.c
drivers/acpi/ec.c
+1
-1
drivers/acpi/pmic/intel_pmic_chtdc_ti.c
drivers/acpi/pmic/intel_pmic_chtdc_ti.c
+1
-1
drivers/acpi/scan.c
drivers/acpi/scan.c
+114
-50
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib-acpi.c
+5
-5
drivers/i2c/i2c-core-acpi.c
drivers/i2c/i2c-core-acpi.c
+4
-4
drivers/platform/surface/aggregator/core.c
drivers/platform/surface/aggregator/core.c
+3
-3
drivers/platform/surface/surface3_power.c
drivers/platform/surface/surface3_power.c
+11
-11
drivers/platform/surface/surface_acpi_notify.c
drivers/platform/surface/surface_acpi_notify.c
+4
-3
include/acpi/acpi_bus.h
include/acpi/acpi_bus.h
+8
-0
include/linux/acpi.h
include/linux/acpi.h
+3
-1
No files found.
drivers/acpi/ec.c
View file @
c8d9c367
...
...
@@ -1627,7 +1627,7 @@ static int acpi_ec_add(struct acpi_device *device)
WARN
(
!
ret
,
"Could not request EC cmd io port 0x%lx"
,
ec
->
command_addr
);
/* Reprobe devices depending on the EC */
acpi_
walk_dep_device_list
(
ec
->
handl
e
);
acpi_
dev_clear_dependencies
(
devic
e
);
acpi_handle_debug
(
ec
->
handle
,
"enumerated.
\n
"
);
return
0
;
...
...
drivers/acpi/pmic/intel_pmic_chtdc_ti.c
View file @
c8d9c367
...
...
@@ -117,7 +117,7 @@ static int chtdc_ti_pmic_opregion_probe(struct platform_device *pdev)
return
err
;
/* Re-enumerate devices depending on PMIC */
acpi_
walk_dep_device_list
(
ACPI_HANDLE
(
pdev
->
dev
.
parent
));
acpi_
dev_clear_dependencies
(
ACPI_COMPANION
(
pdev
->
dev
.
parent
));
return
0
;
}
...
...
drivers/acpi/scan.c
View file @
c8d9c367
...
...
@@ -47,12 +47,6 @@ static DEFINE_MUTEX(acpi_hp_context_lock);
*/
static
u64
spcr_uart_addr
;
struct
acpi_dep_data
{
struct
list_head
node
;
acpi_handle
supplier
;
acpi_handle
consumer
;
};
void
acpi_scan_lock_acquire
(
void
)
{
mutex_lock
(
&
acpi_scan_lock
);
...
...
@@ -1671,8 +1665,20 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
device_initialize
(
&
device
->
dev
);
dev_set_uevent_suppress
(
&
device
->
dev
,
true
);
acpi_init_coherency
(
device
);
/* Assume there are unmet deps to start with. */
device
->
dep_unmet
=
1
;
}
static
void
acpi_scan_dep_init
(
struct
acpi_device
*
adev
)
{
struct
acpi_dep_data
*
dep
;
mutex_lock
(
&
acpi_dep_list_lock
);
list_for_each_entry
(
dep
,
&
acpi_dep_list
,
node
)
{
if
(
dep
->
consumer
==
adev
->
handle
)
adev
->
dep_unmet
++
;
}
mutex_unlock
(
&
acpi_dep_list_lock
);
}
void
acpi_device_add_finalize
(
struct
acpi_device
*
device
)
...
...
@@ -1688,7 +1694,7 @@ static void acpi_scan_init_status(struct acpi_device *adev)
}
static
int
acpi_add_single_object
(
struct
acpi_device
**
child
,
acpi_handle
handle
,
int
type
)
acpi_handle
handle
,
int
type
,
bool
dep_init
)
{
struct
acpi_device
*
device
;
int
result
;
...
...
@@ -1703,8 +1709,12 @@ static int acpi_add_single_object(struct acpi_device **child,
* acpi_bus_get_status() and use its quirk handling. Note that
* this must be done before the get power-/wakeup_dev-flags calls.
*/
if
(
type
==
ACPI_BUS_TYPE_DEVICE
||
type
==
ACPI_BUS_TYPE_PROCESSOR
)
if
(
type
==
ACPI_BUS_TYPE_DEVICE
||
type
==
ACPI_BUS_TYPE_PROCESSOR
)
{
if
(
dep_init
)
acpi_scan_dep_init
(
device
);
acpi_scan_init_status
(
device
);
}
acpi_bus_get_power_flags
(
device
);
acpi_bus_get_wakeup_device_flags
(
device
);
...
...
@@ -1886,22 +1896,6 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep)
return
count
;
}
static
void
acpi_scan_dep_init
(
struct
acpi_device
*
adev
)
{
struct
acpi_dep_data
*
dep
;
adev
->
dep_unmet
=
0
;
mutex_lock
(
&
acpi_dep_list_lock
);
list_for_each_entry
(
dep
,
&
acpi_dep_list
,
node
)
{
if
(
dep
->
consumer
==
adev
->
handle
)
adev
->
dep_unmet
++
;
}
mutex_unlock
(
&
acpi_dep_list_lock
);
}
static
bool
acpi_bus_scan_second_pass
;
static
acpi_status
acpi_bus_check_add
(
acpi_handle
handle
,
bool
check_dep
,
...
...
@@ -1949,19 +1943,15 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
return
AE_OK
;
}
acpi_add_single_object
(
&
device
,
handle
,
type
);
if
(
!
device
)
return
AE_CTRL_DEPTH
;
acpi_scan_init_hotplug
(
device
);
/*
* If check_dep is true at this point, the device has no dependencies,
* or the creation of the device object would have been postponed above.
*/
if
(
check_dep
)
device
->
dep_unmet
=
0
;
else
acpi_scan_dep_init
(
device
);
acpi_add_single_object
(
&
device
,
handle
,
type
,
!
check_dep
);
if
(
!
device
)
return
AE_CTRL_DEPTH
;
acpi_scan_init_hotplug
(
device
);
out:
if
(
!*
adev_p
)
...
...
@@ -2111,14 +2101,24 @@ static void acpi_bus_attach(struct acpi_device *device, bool first_pass)
device
->
handler
->
hotplug
.
notify_online
(
device
);
}
void
acpi_walk_dep_device_list
(
acpi_handle
handle
)
static
int
acpi_dev_get_first_consumer_dev_cb
(
struct
acpi_dep_data
*
dep
,
void
*
data
)
{
struct
acpi_device
*
adev
;
adev
=
acpi_bus_get_acpi_device
(
dep
->
consumer
);
if
(
!
adev
)
/* If we don't find an adev then we want to continue parsing */
return
0
;
*
(
struct
acpi_device
**
)
data
=
adev
;
return
1
;
}
static
int
acpi_scan_clear_dep
(
struct
acpi_dep_data
*
dep
,
void
*
data
)
{
struct
acpi_dep_data
*
dep
,
*
tmp
;
struct
acpi_device
*
adev
;
mutex_lock
(
&
acpi_dep_list_lock
);
list_for_each_entry_safe
(
dep
,
tmp
,
&
acpi_dep_list
,
node
)
{
if
(
dep
->
supplier
==
handle
)
{
acpi_bus_get_device
(
dep
->
consumer
,
&
adev
);
if
(
adev
)
{
...
...
@@ -2129,12 +2129,76 @@ void acpi_walk_dep_device_list(acpi_handle handle)
list_del
(
&
dep
->
node
);
kfree
(
dep
);
return
0
;
}
/**
* acpi_walk_dep_device_list - Apply a callback to every entry in acpi_dep_list
* @handle: The ACPI handle of the supplier device
* @callback: Pointer to the callback function to apply
* @data: Pointer to some data to pass to the callback
*
* The return value of the callback determines this function's behaviour. If 0
* is returned we continue to iterate over acpi_dep_list. If a positive value
* is returned then the loop is broken but this function returns 0. If a
* negative value is returned by the callback then the loop is broken and that
* value is returned as the final error.
*/
int
acpi_walk_dep_device_list
(
acpi_handle
handle
,
int
(
*
callback
)(
struct
acpi_dep_data
*
,
void
*
),
void
*
data
)
{
struct
acpi_dep_data
*
dep
,
*
tmp
;
int
ret
=
0
;
mutex_lock
(
&
acpi_dep_list_lock
);
list_for_each_entry_safe
(
dep
,
tmp
,
&
acpi_dep_list
,
node
)
{
if
(
dep
->
supplier
==
handle
)
{
ret
=
callback
(
dep
,
data
);
if
(
ret
)
break
;
}
}
mutex_unlock
(
&
acpi_dep_list_lock
);
return
ret
>
0
?
0
:
ret
;
}
EXPORT_SYMBOL_GPL
(
acpi_walk_dep_device_list
);
/**
* acpi_dev_clear_dependencies - Inform consumers that the device is now active
* @supplier: Pointer to the supplier &struct acpi_device
*
* Clear dependencies on the given device.
*/
void
acpi_dev_clear_dependencies
(
struct
acpi_device
*
supplier
)
{
acpi_walk_dep_device_list
(
supplier
->
handle
,
acpi_scan_clear_dep
,
NULL
);
}
EXPORT_SYMBOL_GPL
(
acpi_dev_clear_dependencies
);
/**
* acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier
* @supplier: Pointer to the dependee device
*
* Returns the first &struct acpi_device which declares itself dependent on
* @supplier via the _DEP buffer, parsed from the acpi_dep_list.
*
* The caller is responsible for putting the reference to adev when it is no
* longer needed.
*/
struct
acpi_device
*
acpi_dev_get_first_consumer_dev
(
struct
acpi_device
*
supplier
)
{
struct
acpi_device
*
adev
=
NULL
;
acpi_walk_dep_device_list
(
supplier
->
handle
,
acpi_dev_get_first_consumer_dev_cb
,
&
adev
);
return
adev
;
}
EXPORT_SYMBOL_GPL
(
acpi_dev_get_first_consumer_dev
);
/**
* acpi_bus_scan - Add ACPI device node objects in a given namespace scope.
* @handle: Root of the namespace scope to scan.
...
...
@@ -2223,7 +2287,7 @@ int acpi_bus_register_early_device(int type)
struct
acpi_device
*
device
=
NULL
;
int
result
;
result
=
acpi_add_single_object
(
&
device
,
NULL
,
type
);
result
=
acpi_add_single_object
(
&
device
,
NULL
,
type
,
false
);
if
(
result
)
return
result
;
...
...
@@ -2243,7 +2307,7 @@ static int acpi_bus_scan_fixed(void)
struct
acpi_device
*
device
=
NULL
;
result
=
acpi_add_single_object
(
&
device
,
NULL
,
ACPI_BUS_TYPE_POWER_BUTTON
);
ACPI_BUS_TYPE_POWER_BUTTON
,
false
);
if
(
result
)
return
result
;
...
...
@@ -2259,7 +2323,7 @@ static int acpi_bus_scan_fixed(void)
struct
acpi_device
*
device
=
NULL
;
result
=
acpi_add_single_object
(
&
device
,
NULL
,
ACPI_BUS_TYPE_SLEEP_BUTTON
);
ACPI_BUS_TYPE_SLEEP_BUTTON
,
false
);
if
(
result
)
return
result
;
...
...
drivers/gpio/gpiolib-acpi.c
View file @
c8d9c367
...
...
@@ -1284,14 +1284,14 @@ static void acpi_gpiochip_scan_gpios(struct acpi_gpio_chip *achip)
void
acpi_gpiochip_add
(
struct
gpio_chip
*
chip
)
{
struct
acpi_gpio_chip
*
acpi_gpio
;
acpi_handle
handle
;
struct
acpi_device
*
adev
;
acpi_status
status
;
if
(
!
chip
||
!
chip
->
parent
)
return
;
handle
=
ACPI_HANDLE
(
chip
->
parent
);
if
(
!
handle
)
adev
=
ACPI_COMPANION
(
chip
->
parent
);
if
(
!
adev
)
return
;
acpi_gpio
=
kzalloc
(
sizeof
(
*
acpi_gpio
),
GFP_KERNEL
);
...
...
@@ -1305,7 +1305,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
INIT_LIST_HEAD
(
&
acpi_gpio
->
events
);
INIT_LIST_HEAD
(
&
acpi_gpio
->
deferred_req_irqs_list_entry
);
status
=
acpi_attach_data
(
handle
,
acpi_gpio_chip_dh
,
acpi_gpio
);
status
=
acpi_attach_data
(
adev
->
handle
,
acpi_gpio_chip_dh
,
acpi_gpio
);
if
(
ACPI_FAILURE
(
status
))
{
dev_err
(
chip
->
parent
,
"Failed to attach ACPI GPIO chip
\n
"
);
kfree
(
acpi_gpio
);
...
...
@@ -1314,7 +1314,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
acpi_gpiochip_request_regions
(
acpi_gpio
);
acpi_gpiochip_scan_gpios
(
acpi_gpio
);
acpi_
walk_dep_device_list
(
handle
);
acpi_
dev_clear_dependencies
(
adev
);
}
void
acpi_gpiochip_remove
(
struct
gpio_chip
*
chip
)
...
...
drivers/i2c/i2c-core-acpi.c
View file @
c8d9c367
...
...
@@ -259,8 +259,8 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
*/
void
i2c_acpi_register_devices
(
struct
i2c_adapter
*
adap
)
{
struct
acpi_device
*
adev
;
acpi_status
status
;
acpi_handle
handle
;
if
(
!
has_acpi_companion
(
&
adap
->
dev
))
return
;
...
...
@@ -275,11 +275,11 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
if
(
!
adap
->
dev
.
parent
)
return
;
handle
=
ACPI_HANDLE
(
adap
->
dev
.
parent
);
if
(
!
handle
)
adev
=
ACPI_COMPANION
(
adap
->
dev
.
parent
);
if
(
!
adev
)
return
;
acpi_
walk_dep_device_list
(
handle
);
acpi_
dev_clear_dependencies
(
adev
);
}
static
const
struct
acpi_device_id
i2c_acpi_force_400khz_device_ids
[]
=
{
...
...
drivers/platform/surface/aggregator/core.c
View file @
c8d9c367
...
...
@@ -621,8 +621,8 @@ static const struct acpi_gpio_mapping ssam_acpi_gpios[] = {
static
int
ssam_serial_hub_probe
(
struct
serdev_device
*
serdev
)
{
struct
acpi_device
*
ssh
=
ACPI_COMPANION
(
&
serdev
->
dev
);
struct
ssam_controller
*
ctrl
;
acpi_handle
*
ssh
=
ACPI_HANDLE
(
&
serdev
->
dev
);
acpi_status
astatus
;
int
status
;
...
...
@@ -652,7 +652,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
if
(
status
)
goto
err_devopen
;
astatus
=
ssam_serdev_setup_via_acpi
(
ssh
,
serdev
);
astatus
=
ssam_serdev_setup_via_acpi
(
ssh
->
handle
,
serdev
);
if
(
ACPI_FAILURE
(
astatus
))
{
status
=
-
ENXIO
;
goto
err_devinit
;
...
...
@@ -706,7 +706,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
* For now let's thus default power/wakeup to false.
*/
device_set_wakeup_capable
(
&
serdev
->
dev
,
true
);
acpi_
walk_dep_device_list
(
ssh
);
acpi_
dev_clear_dependencies
(
ssh
);
return
0
;
...
...
drivers/platform/surface/surface3_power.c
View file @
c8d9c367
...
...
@@ -446,12 +446,12 @@ mshw0011_space_handler(u32 function, acpi_physical_address command,
static
int
mshw0011_install_space_handler
(
struct
i2c_client
*
client
)
{
acpi_handle
handle
;
struct
acpi_device
*
adev
;
struct
mshw0011_handler_data
*
data
;
acpi_status
status
;
handle
=
ACPI_HANDLE
(
&
client
->
dev
);
if
(
!
handle
)
adev
=
ACPI_COMPANION
(
&
client
->
dev
);
if
(
!
adev
)
return
-
ENODEV
;
data
=
kzalloc
(
sizeof
(
struct
mshw0011_handler_data
),
...
...
@@ -460,25 +460,25 @@ static int mshw0011_install_space_handler(struct i2c_client *client)
return
-
ENOMEM
;
data
->
client
=
client
;
status
=
acpi_bus_attach_private_data
(
handle
,
(
void
*
)
data
);
status
=
acpi_bus_attach_private_data
(
adev
->
handle
,
(
void
*
)
data
);
if
(
ACPI_FAILURE
(
status
))
{
kfree
(
data
);
return
-
ENOMEM
;
}
status
=
acpi_install_address_space_handler
(
handle
,
status
=
acpi_install_address_space_handler
(
adev
->
handle
,
ACPI_ADR_SPACE_GSBUS
,
&
mshw0011_space_handler
,
NULL
,
data
);
if
(
ACPI_FAILURE
(
status
))
{
dev_err
(
&
client
->
dev
,
"Error installing i2c space handler
\n
"
);
acpi_bus_detach_private_data
(
handle
);
acpi_bus_detach_private_data
(
adev
->
handle
);
kfree
(
data
);
return
-
ENOMEM
;
}
acpi_
walk_dep_device_list
(
handle
);
acpi_
dev_clear_dependencies
(
adev
);
return
0
;
}
...
...
drivers/platform/surface/surface_acpi_notify.c
View file @
c8d9c367
...
...
@@ -798,7 +798,7 @@ static int san_consumer_links_setup(struct platform_device *pdev)
static
int
san_probe
(
struct
platform_device
*
pdev
)
{
acpi_handle
san
=
ACPI_HANDLE
(
&
pdev
->
dev
);
struct
acpi_device
*
san
=
ACPI_COMPANION
(
&
pdev
->
dev
);
struct
ssam_controller
*
ctrl
;
struct
san_data
*
data
;
acpi_status
astatus
;
...
...
@@ -821,7 +821,8 @@ static int san_probe(struct platform_device *pdev)
platform_set_drvdata
(
pdev
,
data
);
astatus
=
acpi_install_address_space_handler
(
san
,
ACPI_ADR_SPACE_GSBUS
,
astatus
=
acpi_install_address_space_handler
(
san
->
handle
,
ACPI_ADR_SPACE_GSBUS
,
&
san_opreg_handler
,
NULL
,
&
data
->
info
);
if
(
ACPI_FAILURE
(
astatus
))
...
...
@@ -835,7 +836,7 @@ static int san_probe(struct platform_device *pdev)
if
(
status
)
goto
err_install_dev
;
acpi_
walk_dep_device_list
(
san
);
acpi_
dev_clear_dependencies
(
san
);
return
0
;
err_install_dev:
...
...
include/acpi/acpi_bus.h
View file @
c8d9c367
...
...
@@ -280,6 +280,12 @@ struct acpi_device_power {
struct
acpi_device_power_state
states
[
ACPI_D_STATE_COUNT
];
/* Power states (D0-D3Cold) */
};
struct
acpi_dep_data
{
struct
list_head
node
;
acpi_handle
supplier
;
acpi_handle
consumer
;
};
/* Performance Management */
struct
acpi_device_perf_flags
{
...
...
@@ -685,6 +691,8 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
bool
acpi_dev_hid_uid_match
(
struct
acpi_device
*
adev
,
const
char
*
hid2
,
const
char
*
uid2
);
void
acpi_dev_clear_dependencies
(
struct
acpi_device
*
supplier
);
struct
acpi_device
*
acpi_dev_get_first_consumer_dev
(
struct
acpi_device
*
supplier
);
struct
acpi_device
*
acpi_dev_get_next_match_dev
(
struct
acpi_device
*
adev
,
const
char
*
hid
,
const
char
*
uid
,
s64
hrv
);
struct
acpi_device
*
...
...
include/linux/acpi.h
View file @
c8d9c367
...
...
@@ -666,7 +666,9 @@ extern bool acpi_driver_match_device(struct device *dev,
const
struct
device_driver
*
drv
);
int
acpi_device_uevent_modalias
(
struct
device
*
,
struct
kobj_uevent_env
*
);
int
acpi_device_modalias
(
struct
device
*
,
char
*
,
int
);
void
acpi_walk_dep_device_list
(
acpi_handle
handle
);
int
acpi_walk_dep_device_list
(
acpi_handle
handle
,
int
(
*
callback
)(
struct
acpi_dep_data
*
,
void
*
),
void
*
data
);
struct
platform_device
*
acpi_create_platform_device
(
struct
acpi_device
*
,
struct
property_entry
*
);
...
...
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