forked from Minki/linux
ACPI: scan: Eliminate __acpi_device_add()
Instead of having acpi_device_add() defined as a wrapper around __acpi_device_add(), export acpi_tie_acpi_dev() so it can be called directly by acpi_add_power_resource(), fold acpi_device_add() into the latter and rename __acpi_device_add() to acpi_device_add(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>
This commit is contained in:
parent
5c5e123703
commit
6e1850b2f3
@ -104,6 +104,7 @@ struct acpi_device_bus_id {
|
|||||||
|
|
||||||
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
||||||
int type, void (*release)(struct device *));
|
int type, void (*release)(struct device *));
|
||||||
|
int acpi_tie_acpi_dev(struct acpi_device *adev);
|
||||||
int acpi_device_add(struct acpi_device *device);
|
int acpi_device_add(struct acpi_device *device);
|
||||||
int acpi_device_setup_files(struct acpi_device *dev);
|
int acpi_device_setup_files(struct acpi_device *dev);
|
||||||
void acpi_device_remove_files(struct acpi_device *dev);
|
void acpi_device_remove_files(struct acpi_device *dev);
|
||||||
|
@ -952,6 +952,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
|
|||||||
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
|
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
|
||||||
strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
|
strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
|
||||||
device->power.state = ACPI_STATE_UNKNOWN;
|
device->power.state = ACPI_STATE_UNKNOWN;
|
||||||
|
device->flags.match_driver = true;
|
||||||
|
|
||||||
/* Evaluate the object to get the system level and resource order. */
|
/* Evaluate the object to get the system level and resource order. */
|
||||||
status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
|
status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
|
||||||
@ -968,7 +969,10 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
|
|||||||
|
|
||||||
pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
|
pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
|
||||||
|
|
||||||
device->flags.match_driver = true;
|
result = acpi_tie_acpi_dev(device);
|
||||||
|
if (result)
|
||||||
|
goto err;
|
||||||
|
|
||||||
result = acpi_device_add(device);
|
result = acpi_device_add(device);
|
||||||
if (result)
|
if (result)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -643,7 +643,7 @@ static int acpi_device_set_name(struct acpi_device *device,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_tie_acpi_dev(struct acpi_device *adev)
|
int acpi_tie_acpi_dev(struct acpi_device *adev)
|
||||||
{
|
{
|
||||||
acpi_handle handle = adev->handle;
|
acpi_handle handle = adev->handle;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
@ -673,7 +673,7 @@ static void acpi_store_pld_crc(struct acpi_device *adev)
|
|||||||
ACPI_FREE(pld);
|
ACPI_FREE(pld);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __acpi_device_add(struct acpi_device *device)
|
int acpi_device_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
struct acpi_device_bus_id *acpi_device_bus_id;
|
struct acpi_device_bus_id *acpi_device_bus_id;
|
||||||
int result;
|
int result;
|
||||||
@ -755,17 +755,6 @@ err_unlock:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_device_add(struct acpi_device *adev)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = acpi_tie_acpi_dev(adev);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return __acpi_device_add(adev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Device Enumeration
|
Device Enumeration
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
@ -1867,7 +1856,7 @@ static int acpi_add_single_object(struct acpi_device **child,
|
|||||||
mutex_unlock(&acpi_dep_list_lock);
|
mutex_unlock(&acpi_dep_list_lock);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
result = __acpi_device_add(device);
|
result = acpi_device_add(device);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
acpi_device_release(&device->dev);
|
acpi_device_release(&device->dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user