Lines Matching defs:adev

81 void acpi_initialize_hp_context(struct acpi_device *adev,
89 acpi_set_hp_context(adev, hp);
116 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
126 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
128 list_for_each_entry(pn, &adev->physical_node_list, node)
137 mutex_unlock(&adev->physical_node_lock);
300 static int acpi_scan_device_not_present(struct acpi_device *adev)
302 if (!acpi_device_enumerated(adev)) {
303 dev_warn(&adev->dev, "Still not present\n");
306 acpi_bus_trim(adev);
310 static int acpi_scan_device_check(struct acpi_device *adev)
314 acpi_bus_get_status(adev);
315 if (adev->status.present || adev->status.functional) {
324 if (adev->handler) {
325 dev_warn(&adev->dev, "Already enumerated\n");
328 error = acpi_bus_scan(adev->handle);
330 dev_warn(&adev->dev, "Namespace scan failure\n");
333 if (!adev->handler) {
334 dev_warn(&adev->dev, "Enumeration failure\n");
338 error = acpi_scan_device_not_present(adev);
343 static int acpi_scan_bus_check(struct acpi_device *adev)
345 struct acpi_scan_handler *handler = adev->handler;
349 acpi_bus_get_status(adev);
350 if (!(adev->status.present || adev->status.functional)) {
351 acpi_scan_device_not_present(adev);
355 return handler->hotplug.scan_dependent(adev);
357 error = acpi_bus_scan(adev->handle);
359 dev_warn(&adev->dev, "Namespace scan failure\n");
362 list_for_each_entry(child, &adev->children, node) {
370 static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
374 return acpi_scan_bus_check(adev);
376 return acpi_scan_device_check(adev);
379 if (adev->handler && !adev->handler->hotplug.enabled) {
380 dev_info(&adev->dev, "Eject disabled\n");
383 acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
385 return acpi_scan_hot_remove(adev);
390 void acpi_device_hotplug(struct acpi_device *adev, u32 src)
403 if (adev->handle == INVALID_ACPI_HANDLE)
406 if (adev->flags.is_dock_station) {
407 error = dock_notify(adev, src);
408 } else if (adev->flags.hotplug_notify) {
409 error = acpi_generic_hotplug_event(adev, src);
414 notify = adev->hp ? adev->hp->notify : NULL;
421 error = notify(adev, src);
441 acpi_evaluate_ost(adev->handle, src, ost_code, NULL);
444 acpi_bus_put_acpi_device(adev);
514 struct acpi_device *adev;
522 adev = list_first_entry(&acpi_device_del_list,
524 list_del(&adev->del_list);
529 ACPI_RECONFIG_DEVICE_REMOVE, adev);
531 acpi_device_del(adev);
536 acpi_power_transition(adev, ACPI_STATE_D3_COLD);
537 put_device(&adev->dev);
557 struct acpi_device *adev = context;
574 list_add_tail(&adev->del_list, &acpi_device_del_list);
576 adev->handle = INVALID_ACPI_HANDLE;
615 struct acpi_device *adev = NULL;
617 acpi_get_device_data(handle, &adev, get_acpi_device);
618 return adev;
621 void acpi_bus_put_acpi_device(struct acpi_device *adev)
623 put_device(&adev->dev);
1120 bool acpi_device_is_battery(struct acpi_device *adev)
1124 list_for_each_entry(hwid, &adev->pnp.ids, list)
1131 static bool is_ejectable_bay(struct acpi_device *adev)
1133 acpi_handle handle = adev->handle;
1135 if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev))
1371 * @adev: The pointer to acpi device
1375 bool acpi_dma_supported(struct acpi_device *adev)
1377 if (!adev)
1380 if (adev->flags.cca_seen)
1396 * @adev: The pointer to acpi device
1400 enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
1402 if (!acpi_dma_supported(adev))
1405 if (adev->flags.coherent_dma)
1424 struct acpi_device *adev;
1437 adev = ACPI_COMPANION(dma_dev);
1438 if (adev && acpi_has_method(adev->handle, METHOD_NAME__DMA))
1447 if (!acpi_has_method(adev->handle, METHOD_NAME__CRS)) {
1448 acpi_handle_warn(adev->handle, "_DMA is valid only if _CRS is present\n");
1452 ret = acpi_dev_get_dma_resources(adev, &list);
1512 static void acpi_init_coherency(struct acpi_device *adev)
1516 struct acpi_device *parent = adev->parent;
1523 adev->flags.cca_seen = 1;
1526 status = acpi_evaluate_integer(adev->handle, "_CCA",
1529 adev->flags.cca_seen = 1;
1538 acpi_handle_debug(adev->handle,
1542 adev->flags.coherent_dma = cca;
1773 bool acpi_device_is_present(const struct acpi_device *adev)
1775 return adev->status.present || adev->status.functional;
1822 static void acpi_scan_init_hotplug(struct acpi_device *adev)
1826 if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) {
1827 acpi_dock_add(adev);
1830 list_for_each_entry(hwid, &adev->pnp.ids, list) {
1835 adev->flags.hotplug_notify = true;
1841 static void acpi_device_dep_initialize(struct acpi_device *adev)
1848 adev->dep_unmet = 0;
1850 if (!acpi_has_method(adev->handle, "_DEP"))
1853 status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
1856 dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n");
1866 dev_dbg(&adev->dev, "Error reading _DEP device info\n");
1887 dep->slave = adev->handle;
1888 adev->dep_unmet++;
1951 static int acpi_generic_device_attach(struct acpi_device *adev,
1958 if (adev->data.of_compatible)
1959 acpi_default_enumeration(adev);
2059 struct acpi_device *adev;
2064 acpi_bus_get_device(dep->slave, &adev);
2065 if (!adev)
2068 adev->dep_unmet--;
2069 if (!adev->dep_unmet)
2070 acpi_bus_attach(adev);
2111 * @adev: Root of the ACPI namespace scope to walk.
2115 void acpi_bus_trim(struct acpi_device *adev)
2117 struct acpi_scan_handler *handler = adev->handler;
2120 list_for_each_entry_reverse(child, &adev->children, node)
2123 adev->flags.match_driver = false;
2126 handler->detach(adev);
2128 adev->handler = NULL;
2130 device_release_driver(&adev->dev);
2136 acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
2137 adev->flags.initialized = false;
2138 acpi_device_clear_enumerated(adev);