diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-06-06 05:37:36 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-06-21 20:55:34 -0400 |
commit | cde1f95f407a593ad6baf1b7b01daa2c6cbd34fd (patch) | |
tree | 2797687bbdb77a7a23b39b3d55dd955bf42bdfcc | |
parent | 2b8153421de8c29864cb147f241804858440bfa1 (diff) |
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>
-rw-r--r-- | drivers/acpi/device_pm.c | 4 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 2 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 9 |
3 files changed, 7 insertions, 8 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 993fd31394c8..e565ed329f11 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -261,8 +261,10 @@ int acpi_bus_init_power(struct acpi_device *device) | |||
261 | return -EINVAL; | 261 | return -EINVAL; |
262 | 262 | ||
263 | device->power.state = ACPI_STATE_UNKNOWN; | 263 | 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; | ||
265 | return -ENXIO; | 266 | return -ENXIO; |
267 | } | ||
266 | 268 | ||
267 | result = acpi_device_get_power(device, &state); | 269 | result = acpi_device_get_power(device, &state); |
268 | if (result) | 270 | if (result) |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 66229ffa909b..73002402c461 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -111,7 +111,7 @@ int acpi_device_setup_files(struct acpi_device *dev); | |||
111 | void acpi_device_remove_files(struct acpi_device *dev); | 111 | void acpi_device_remove_files(struct acpi_device *dev); |
112 | void acpi_device_add_finalize(struct acpi_device *device); | 112 | void acpi_device_add_finalize(struct acpi_device *device); |
113 | void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); | 113 | 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); |
115 | bool acpi_device_is_battery(struct acpi_device *adev); | 115 | bool acpi_device_is_battery(struct acpi_device *adev); |
116 | bool acpi_device_is_first_physical_node(struct acpi_device *adev, | 116 | bool acpi_device_is_first_physical_node(struct acpi_device *adev, |
117 | const struct device *dev); | 117 | const struct device *dev); |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3a10d7573477..c98f88b28948 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1567,13 +1567,9 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | |||
1567 | return 0; | 1567 | return 0; |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | bool acpi_device_is_present(struct acpi_device *adev) | 1570 | bool acpi_device_is_present(const struct acpi_device *adev) |
1571 | { | 1571 | { |
1572 | if (adev->status.present || adev->status.functional) | 1572 | return adev->status.present || adev->status.functional; |
1573 | return true; | ||
1574 | |||
1575 | adev->flags.initialized = false; | ||
1576 | return false; | ||
1577 | } | 1573 | } |
1578 | 1574 | ||
1579 | static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, | 1575 | static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, |
@@ -1831,6 +1827,7 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
1831 | acpi_bus_get_status(device); | 1827 | acpi_bus_get_status(device); |
1832 | /* Skip devices that are not present. */ | 1828 | /* Skip devices that are not present. */ |
1833 | if (!acpi_device_is_present(device)) { | 1829 | if (!acpi_device_is_present(device)) { |
1830 | device->flags.initialized = false; | ||
1834 | acpi_device_clear_enumerated(device); | 1831 | acpi_device_clear_enumerated(device); |
1835 | device->flags.power_manageable = 0; | 1832 | device->flags.power_manageable = 0; |
1836 | return; | 1833 | return; |