summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-04-07 16:31:54 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-04-08 19:55:40 +0200
commitf926e94338158a5f84cbe4b0c7a9438c303762f8 (patch)
tree3ee677e10b0d6cbe6058c09a22701a030ae4dcfb /drivers/acpi
parent02056a4f9209b7e9f65fab193069cbff36ec92b5 (diff)
ACPI: scan: Drop sta argument from acpi_add_single_object()
Move the initial status check for ACPI_BUS_TYPE_PROCESSOR objects into acpi_add_single_object() so it is not necessary to pass the "sta" argument to it, get rid of that argument from there and update the callers of that function accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/scan.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b5fa77cec0e..787ba8aac9b5 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1681,15 +1681,18 @@ void acpi_device_add_finalize(struct acpi_device *device)
}
static int acpi_add_single_object(struct acpi_device **child,
- acpi_handle handle, int type,
- unsigned long long sta)
+ acpi_handle handle, int type)
{
struct acpi_device_info *info = NULL;
+ unsigned long long sta = ACPI_STA_DEFAULT;
struct acpi_device *device;
int result;
- if (handle != ACPI_ROOT_OBJECT && type == ACPI_BUS_TYPE_DEVICE)
+ if (type == ACPI_BUS_TYPE_DEVICE && handle != ACPI_ROOT_OBJECT)
acpi_get_object_info(handle, &info);
+ else if (type == ACPI_BUS_TYPE_PROCESSOR &&
+ ACPI_FAILURE(acpi_bus_get_status_handle(handle, &sta)))
+ return -ENODEV;
device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
if (!device) {
@@ -1910,7 +1913,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
struct acpi_device **adev_p)
{
struct acpi_device *device = NULL;
- unsigned long long sta = ACPI_STA_DEFAULT;
acpi_object_type acpi_type;
int type;
@@ -1938,9 +1940,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
break;
case ACPI_TYPE_PROCESSOR:
- if (ACPI_FAILURE(acpi_bus_get_status_handle(handle, &sta)))
- return AE_OK;
-
type = ACPI_BUS_TYPE_PROCESSOR;
break;
@@ -1955,7 +1954,7 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
return AE_OK;
}
- acpi_add_single_object(&device, handle, type, sta);
+ acpi_add_single_object(&device, handle, type);
if (!device)
return AE_CTRL_DEPTH;
@@ -2229,8 +2228,7 @@ int acpi_bus_register_early_device(int type)
struct acpi_device *device = NULL;
int result;
- result = acpi_add_single_object(&device, NULL,
- type, ACPI_STA_DEFAULT);
+ result = acpi_add_single_object(&device, NULL, type);
if (result)
return result;
@@ -2250,8 +2248,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_STA_DEFAULT);
+ ACPI_BUS_TYPE_POWER_BUTTON);
if (result)
return result;
@@ -2267,8 +2264,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_STA_DEFAULT);
+ ACPI_BUS_TYPE_SLEEP_BUTTON);
if (result)
return result;