Lines Matching refs:adev
83 void acpi_initialize_hp_context(struct acpi_device *adev, in acpi_initialize_hp_context() argument
91 acpi_set_hp_context(adev, hp); in acpi_initialize_hp_context()
118 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent) in acpi_scan_is_offline() argument
127 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING); in acpi_scan_is_offline()
129 list_for_each_entry(pn, &adev->physical_node_list, node) in acpi_scan_is_offline()
138 mutex_unlock(&adev->physical_node_lock); in acpi_scan_is_offline()
305 static int acpi_scan_device_not_present(struct acpi_device *adev) in acpi_scan_device_not_present() argument
307 if (!acpi_device_enumerated(adev)) { in acpi_scan_device_not_present()
308 dev_warn(&adev->dev, "Still not present\n"); in acpi_scan_device_not_present()
311 acpi_bus_trim(adev); in acpi_scan_device_not_present()
315 static int acpi_scan_device_check(struct acpi_device *adev) in acpi_scan_device_check() argument
319 acpi_bus_get_status(adev); in acpi_scan_device_check()
320 if (adev->status.present || adev->status.functional) { in acpi_scan_device_check()
329 if (adev->handler) { in acpi_scan_device_check()
330 dev_warn(&adev->dev, "Already enumerated\n"); in acpi_scan_device_check()
333 error = acpi_bus_scan(adev->handle); in acpi_scan_device_check()
335 dev_warn(&adev->dev, "Namespace scan failure\n"); in acpi_scan_device_check()
338 if (!adev->handler) { in acpi_scan_device_check()
339 dev_warn(&adev->dev, "Enumeration failure\n"); in acpi_scan_device_check()
343 error = acpi_scan_device_not_present(adev); in acpi_scan_device_check()
348 static int acpi_scan_bus_check(struct acpi_device *adev) in acpi_scan_bus_check() argument
350 struct acpi_scan_handler *handler = adev->handler; in acpi_scan_bus_check()
354 acpi_bus_get_status(adev); in acpi_scan_bus_check()
355 if (!(adev->status.present || adev->status.functional)) { in acpi_scan_bus_check()
356 acpi_scan_device_not_present(adev); in acpi_scan_bus_check()
360 return handler->hotplug.scan_dependent(adev); in acpi_scan_bus_check()
362 error = acpi_bus_scan(adev->handle); in acpi_scan_bus_check()
364 dev_warn(&adev->dev, "Namespace scan failure\n"); in acpi_scan_bus_check()
367 list_for_each_entry(child, &adev->children, node) { in acpi_scan_bus_check()
375 static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type) in acpi_generic_hotplug_event() argument
379 return acpi_scan_bus_check(adev); in acpi_generic_hotplug_event()
381 return acpi_scan_device_check(adev); in acpi_generic_hotplug_event()
384 if (adev->handler && !adev->handler->hotplug.enabled) { in acpi_generic_hotplug_event()
385 dev_info(&adev->dev, "Eject disabled\n"); in acpi_generic_hotplug_event()
388 acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST, in acpi_generic_hotplug_event()
390 return acpi_scan_hot_remove(adev); in acpi_generic_hotplug_event()
395 void acpi_device_hotplug(struct acpi_device *adev, u32 src) in acpi_device_hotplug() argument
408 if (adev->handle == INVALID_ACPI_HANDLE) in acpi_device_hotplug()
411 if (adev->flags.is_dock_station) { in acpi_device_hotplug()
412 error = dock_notify(adev, src); in acpi_device_hotplug()
413 } else if (adev->flags.hotplug_notify) { in acpi_device_hotplug()
414 error = acpi_generic_hotplug_event(adev, src); in acpi_device_hotplug()
423 notify = adev->hp ? adev->hp->notify : NULL; in acpi_device_hotplug()
430 error = notify(adev, src); in acpi_device_hotplug()
438 acpi_evaluate_ost(adev->handle, src, ost_code, NULL); in acpi_device_hotplug()
441 acpi_bus_put_acpi_device(adev); in acpi_device_hotplug()
495 struct acpi_device *adev; in acpi_device_del_work_fn() local
503 adev = list_first_entry(&acpi_device_del_list, in acpi_device_del_work_fn()
505 list_del(&adev->del_list); in acpi_device_del_work_fn()
509 acpi_device_del(adev); in acpi_device_del_work_fn()
514 acpi_power_transition(adev, ACPI_STATE_D3_COLD); in acpi_device_del_work_fn()
515 put_device(&adev->dev); in acpi_device_del_work_fn()
535 struct acpi_device *adev = context; in acpi_scan_drop_device() local
552 list_add_tail(&adev->del_list, &acpi_device_del_list); in acpi_scan_drop_device()
554 adev->handle = INVALID_ACPI_HANDLE; in acpi_scan_drop_device()
591 struct acpi_device *adev = NULL; in acpi_bus_get_acpi_device() local
593 acpi_get_device_data(handle, &adev, get_acpi_device); in acpi_bus_get_acpi_device()
594 return adev; in acpi_bus_get_acpi_device()
597 void acpi_bus_put_acpi_device(struct acpi_device *adev) in acpi_bus_put_acpi_device() argument
599 put_device(&adev->dev); in acpi_bus_put_acpi_device()
1062 bool acpi_device_is_battery(struct acpi_device *adev) in acpi_device_is_battery() argument
1066 list_for_each_entry(hwid, &adev->pnp.ids, list) in acpi_device_is_battery()
1073 static bool is_ejectable_bay(struct acpi_device *adev) in is_ejectable_bay() argument
1075 acpi_handle handle = adev->handle; in is_ejectable_bay()
1077 if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev)) in is_ejectable_bay()
1317 bool acpi_dma_supported(struct acpi_device *adev) in acpi_dma_supported() argument
1319 if (!adev) in acpi_dma_supported()
1322 if (adev->flags.cca_seen) in acpi_dma_supported()
1342 enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev) in acpi_get_dma_attr() argument
1344 if (!acpi_dma_supported(adev)) in acpi_get_dma_attr()
1347 if (adev->flags.coherent_dma) in acpi_get_dma_attr()
1353 static void acpi_init_coherency(struct acpi_device *adev) in acpi_init_coherency() argument
1357 struct acpi_device *parent = adev->parent; in acpi_init_coherency()
1364 adev->flags.cca_seen = 1; in acpi_init_coherency()
1367 status = acpi_evaluate_integer(adev->handle, "_CCA", in acpi_init_coherency()
1370 adev->flags.cca_seen = 1; in acpi_init_coherency()
1379 acpi_handle_debug(adev->handle, in acpi_init_coherency()
1383 adev->flags.coherent_dma = cca; in acpi_init_coherency()
1487 bool acpi_device_is_present(struct acpi_device *adev) in acpi_device_is_present() argument
1489 if (adev->status.present || adev->status.functional) in acpi_device_is_present()
1492 adev->flags.initialized = false; in acpi_device_is_present()
1540 static void acpi_scan_init_hotplug(struct acpi_device *adev) in acpi_scan_init_hotplug() argument
1544 if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) { in acpi_scan_init_hotplug()
1545 acpi_dock_add(adev); in acpi_scan_init_hotplug()
1548 list_for_each_entry(hwid, &adev->pnp.ids, list) { in acpi_scan_init_hotplug()
1553 adev->flags.hotplug_notify = true; in acpi_scan_init_hotplug()
1559 static void acpi_device_dep_initialize(struct acpi_device *adev) in acpi_device_dep_initialize() argument
1566 if (!acpi_has_method(adev->handle, "_DEP")) in acpi_device_dep_initialize()
1569 status = acpi_evaluate_reference(adev->handle, "_DEP", NULL, in acpi_device_dep_initialize()
1572 dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n"); in acpi_device_dep_initialize()
1582 dev_dbg(&adev->dev, "Error reading _DEP device info\n"); in acpi_device_dep_initialize()
1603 dep->slave = adev->handle; in acpi_device_dep_initialize()
1604 adev->dep_unmet++; in acpi_device_dep_initialize()
1687 static int acpi_generic_device_attach(struct acpi_device *adev, in acpi_generic_device_attach() argument
1694 if (adev->data.of_compatible) in acpi_generic_device_attach()
1695 acpi_default_enumeration(adev); in acpi_generic_device_attach()
1788 struct acpi_device *adev; in acpi_walk_dep_device_list() local
1793 acpi_bus_get_device(dep->slave, &adev); in acpi_walk_dep_device_list()
1794 if (!adev) in acpi_walk_dep_device_list()
1797 adev->dep_unmet--; in acpi_walk_dep_device_list()
1798 if (!adev->dep_unmet) in acpi_walk_dep_device_list()
1799 acpi_bus_attach(adev); in acpi_walk_dep_device_list()
1844 void acpi_bus_trim(struct acpi_device *adev) in acpi_bus_trim() argument
1846 struct acpi_scan_handler *handler = adev->handler; in acpi_bus_trim()
1849 list_for_each_entry_reverse(child, &adev->children, node) in acpi_bus_trim()
1852 adev->flags.match_driver = false; in acpi_bus_trim()
1855 handler->detach(adev); in acpi_bus_trim()
1857 adev->handler = NULL; in acpi_bus_trim()
1859 device_release_driver(&adev->dev); in acpi_bus_trim()
1865 acpi_device_set_power(adev, ACPI_STATE_D3_COLD); in acpi_bus_trim()
1866 adev->flags.initialized = false; in acpi_bus_trim()
1867 adev->flags.visited = false; in acpi_bus_trim()