Skip to content

Commit

Permalink
Merge branches 'acpi-scan', 'acpi-drivers', 'acpi-pm' and 'acpi-resou…
Browse files Browse the repository at this point in the history
…rces'

* acpi-scan:
  ACPI: bus: Introduce acpi_dev_get() and reuse it in ACPI code
  ACPI: scan: Utilize match_string() API
  ACPI: scan: Call acpi_get_object_info() from acpi_set_pnp_ids()
  ACPI: scan: Drop sta argument from acpi_init_device_object()
  ACPI: scan: Drop sta argument from acpi_add_single_object()
  ACPI: scan: Rearrange checks in acpi_bus_check_add()
  ACPI: scan: Fold acpi_bus_type_and_status() into its caller

* acpi-drivers:
  ACPI: HED: Drop unused ACPI_MODULE_NAME() definition

* acpi-pm:
  ACPI: power: Turn off unused power resources unconditionally
  ACPI: scan: Turn off unused power resources during initialization

* acpi-resources:
  resource: Prevent irqresource_disabled() from erasing flags
  • Loading branch information
Rafael J. Wysocki committed Apr 26, 2021
5 parents ab49750 + 4cbaba4 + a13f779 + 7e4fdea + d08a745 commit 0b22125
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 128 deletions.
4 changes: 2 additions & 2 deletions drivers/acpi/device_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ eject_store(struct device *d, struct device_attribute *attr,
if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable)
return -ENODEV;

get_device(&acpi_device->dev);
acpi_dev_get(acpi_device);
status = acpi_hotplug_schedule(acpi_device, ACPI_OST_EC_OSPM_EJECT);
if (ACPI_SUCCESS(status))
return count;

put_device(&acpi_device->dev);
acpi_dev_put(acpi_device);
acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);
return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
if (!acpi_dev)
return -EINVAL;

get_device(&acpi_dev->dev);
acpi_dev_get(acpi_dev);
get_device(dev);
physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
if (!physical_node) {
Expand All @@ -217,7 +217,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
goto err;

put_device(dev);
put_device(&acpi_dev->dev);
acpi_dev_put(acpi_dev);
return 0;
}
if (pn->node_id == node_id) {
Expand Down Expand Up @@ -257,7 +257,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
err:
ACPI_COMPANION_SET(dev, NULL);
put_device(dev);
put_device(&acpi_dev->dev);
acpi_dev_put(acpi_dev);
return retval;
}
EXPORT_SYMBOL_GPL(acpi_bind_one);
Expand Down Expand Up @@ -285,7 +285,7 @@ int acpi_unbind_one(struct device *dev)
ACPI_COMPANION_SET(dev, NULL);
/* Drop references taken by acpi_bind_one(). */
put_device(dev);
put_device(&acpi_dev->dev);
acpi_dev_put(acpi_dev);
kfree(entry);
break;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/hed.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static struct acpi_driver acpi_hed_driver = {
};
module_acpi_driver(acpi_hed_driver);

ACPI_MODULE_NAME("hed");
MODULE_AUTHOR("Huang Ying");
MODULE_DESCRIPTION("ACPI Hardware Error Device Driver");
MODULE_LICENSE("GPL");
4 changes: 2 additions & 2 deletions drivers/acpi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ struct acpi_device_bus_id {
int acpi_device_add(struct acpi_device *device,
void (*release)(struct device *));
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
int type, unsigned long long sta,
struct acpi_device_info *info);
int type);
int acpi_device_setup_files(struct acpi_device *dev);
void acpi_device_remove_files(struct acpi_device *dev);
void acpi_device_add_finalize(struct acpi_device *device);
Expand Down Expand Up @@ -143,6 +142,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev,
int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
int acpi_power_on_resources(struct acpi_device *device, int state);
int acpi_power_transition(struct acpi_device *device, int state);
void acpi_turn_off_unused_power_resources(void);

/* --------------------------------------------------------------------------
Device Power Management
Expand Down
16 changes: 3 additions & 13 deletions drivers/acpi/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,7 @@ int acpi_add_power_resource(acpi_handle handle)
return -ENOMEM;

device = &resource->device;
acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER,
ACPI_STA_DEFAULT, NULL);
acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER);
mutex_init(&resource->resource_lock);
INIT_LIST_HEAD(&resource->list_node);
INIT_LIST_HEAD(&resource->dependents);
Expand Down Expand Up @@ -996,6 +995,7 @@ void acpi_resume_power_resources(void)

mutex_unlock(&power_resource_list_lock);
}
#endif

void acpi_turn_off_unused_power_resources(void)
{
Expand All @@ -1004,18 +1004,9 @@ void acpi_turn_off_unused_power_resources(void)
mutex_lock(&power_resource_list_lock);

list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
int result, state;

mutex_lock(&resource->resource_lock);

result = acpi_power_get_state(resource->device.handle, &state);
if (result) {
mutex_unlock(&resource->resource_lock);
continue;
}

if (state == ACPI_POWER_RESOURCE_STATE_ON
&& !resource->ref_count) {
if (!resource->ref_count) {
dev_info(&resource->device.dev, "Turning OFF\n");
__acpi_power_off(resource);
}
Expand All @@ -1025,4 +1016,3 @@ void acpi_turn_off_unused_power_resources(void)

mutex_unlock(&power_resource_list_lock);
}
#endif
Loading

0 comments on commit 0b22125

Please sign in to comment.