Skip to content

Commit cde1f95

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: Constify argument to acpi_device_is_present()
This will be needed in constifying the fwnode API. The side effects the function had have been moved to the callers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 2b81534 commit cde1f95

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

drivers/acpi/device_pm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,10 @@ int acpi_bus_init_power(struct acpi_device *device)
261261
return -EINVAL;
262262

263263
device->power.state = ACPI_STATE_UNKNOWN;
264-
if (!acpi_device_is_present(device))
264+
if (!acpi_device_is_present(device)) {
265+
device->flags.initialized = false;
265266
return -ENXIO;
267+
}
266268

267269
result = acpi_device_get_power(device, &state);
268270
if (result)

drivers/acpi/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ int acpi_device_setup_files(struct acpi_device *dev);
111111
void acpi_device_remove_files(struct acpi_device *dev);
112112
void acpi_device_add_finalize(struct acpi_device *device);
113113
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
114-
bool acpi_device_is_present(struct acpi_device *adev);
114+
bool acpi_device_is_present(const struct acpi_device *adev);
115115
bool acpi_device_is_battery(struct acpi_device *adev);
116116
bool acpi_device_is_first_physical_node(struct acpi_device *adev,
117117
const struct device *dev);

drivers/acpi/scan.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,13 +1567,9 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
15671567
return 0;
15681568
}
15691569

1570-
bool acpi_device_is_present(struct acpi_device *adev)
1570+
bool acpi_device_is_present(const struct acpi_device *adev)
15711571
{
1572-
if (adev->status.present || adev->status.functional)
1573-
return true;
1574-
1575-
adev->flags.initialized = false;
1576-
return false;
1572+
return adev->status.present || adev->status.functional;
15771573
}
15781574

15791575
static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
@@ -1831,6 +1827,7 @@ static void acpi_bus_attach(struct acpi_device *device)
18311827
acpi_bus_get_status(device);
18321828
/* Skip devices that are not present. */
18331829
if (!acpi_device_is_present(device)) {
1830+
device->flags.initialized = false;
18341831
acpi_device_clear_enumerated(device);
18351832
device->flags.power_manageable = 0;
18361833
return;

0 commit comments

Comments
 (0)