Lines Matching defs:adev

74 void acpi_initialize_hp_context(struct acpi_device *adev,
82 acpi_set_hp_context(adev, hp);
109 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
119 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
121 list_for_each_entry(pn, &adev->physical_node_list, node)
130 mutex_unlock(&adev->physical_node_lock);
292 static int acpi_scan_device_not_present(struct acpi_device *adev)
294 if (!acpi_device_enumerated(adev)) {
295 dev_warn(&adev->dev, "Still not present\n");
298 acpi_bus_trim(adev);
302 static int acpi_scan_device_check(struct acpi_device *adev)
306 acpi_bus_get_status(adev);
307 if (adev->status.present || adev->status.functional) {
316 if (adev->handler) {
317 dev_dbg(&adev->dev, "Already enumerated\n");
320 error = acpi_bus_scan(adev->handle);
322 dev_warn(&adev->dev, "Namespace scan failure\n");
326 error = acpi_scan_device_not_present(adev);
331 static int acpi_scan_bus_check(struct acpi_device *adev, void *not_used)
333 struct acpi_scan_handler *handler = adev->handler;
336 acpi_bus_get_status(adev);
337 if (!(adev->status.present || adev->status.functional)) {
338 acpi_scan_device_not_present(adev);
342 return handler->hotplug.scan_dependent(adev);
344 error = acpi_bus_scan(adev->handle);
346 dev_warn(&adev->dev, "Namespace scan failure\n");
349 return acpi_dev_for_each_child(adev, acpi_scan_bus_check, NULL);
352 static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
356 return acpi_scan_bus_check(adev, NULL);
358 return acpi_scan_device_check(adev);
361 if (adev->handler && !adev->handler->hotplug.enabled) {
362 dev_info(&adev->dev, "Eject disabled\n");
365 acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
367 return acpi_scan_hot_remove(adev);
372 void acpi_device_hotplug(struct acpi_device *adev, u32 src)
385 if (adev->handle == INVALID_ACPI_HANDLE)
388 if (adev->flags.is_dock_station) {
389 error = dock_notify(adev, src);
390 } else if (adev->flags.hotplug_notify) {
391 error = acpi_generic_hotplug_event(adev, src);
396 notify = adev->hp ? adev->hp->notify : NULL;
403 error = notify(adev, src);
423 acpi_evaluate_ost(adev->handle, src, ost_code, NULL);
426 acpi_put_acpi_dev(adev);
496 struct acpi_device *adev;
504 adev = list_first_entry(&acpi_device_del_list,
506 list_del(&adev->del_list);
511 ACPI_RECONFIG_DEVICE_REMOVE, adev);
513 acpi_device_del(adev);
518 acpi_power_transition(adev, ACPI_STATE_D3_COLD);
519 acpi_dev_put(adev);
539 struct acpi_device *adev = context;
556 list_add_tail(&adev->del_list, &acpi_device_del_list);
558 adev->handle = INVALID_ACPI_HANDLE;
566 struct acpi_device *adev = NULL;
570 (void **)&adev, callback);
571 if (ACPI_FAILURE(status) || !adev) {
575 return adev;
640 int acpi_tie_acpi_dev(struct acpi_device *adev)
642 acpi_handle handle = adev->handle;
648 status = acpi_attach_data(handle, acpi_scan_drop_device, adev);
657 static void acpi_store_pld_crc(struct acpi_device *adev)
662 status = acpi_get_physical_device_location(adev->handle, &pld);
666 adev->pld_crc = crc32(~0, pld, sizeof(*pld));
802 struct acpi_device *adev;
822 adev = acpi_fetch_acpi_dev(handle);
823 } while (!adev);
824 return adev;
1177 bool acpi_device_is_battery(struct acpi_device *adev)
1181 list_for_each_entry(hwid, &adev->pnp.ids, list)
1188 static bool is_ejectable_bay(struct acpi_device *adev)
1190 acpi_handle handle = adev->handle;
1192 if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev))
1428 * @adev: The pointer to acpi device
1432 bool acpi_dma_supported(const struct acpi_device *adev)
1434 if (!adev)
1437 if (adev->flags.cca_seen)
1453 * @adev: The pointer to acpi device
1457 enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
1459 if (!acpi_dma_supported(adev))
1462 if (adev->flags.coherent_dma)
1481 struct acpi_device *adev;
1494 adev = ACPI_COMPANION(dma_dev);
1495 if (adev && acpi_has_method(adev->handle, METHOD_NAME__DMA))
1504 if (!acpi_has_method(adev->handle, METHOD_NAME__CRS)) {
1505 acpi_handle_warn(adev->handle, "_DMA is valid only if _CRS is present\n");
1509 ret = acpi_dev_get_dma_resources(adev, &list);
1647 static void acpi_init_coherency(struct acpi_device *adev)
1651 struct acpi_device *parent = acpi_dev_parent(adev);
1658 adev->flags.cca_seen = 1;
1661 status = acpi_evaluate_integer(adev->handle, "_CCA",
1664 adev->flags.cca_seen = 1;
1673 acpi_handle_debug(adev->handle,
1677 adev->flags.coherent_dma = cca;
1792 static void acpi_scan_dep_init(struct acpi_device *adev)
1797 if (dep->consumer == adev->handle) {
1799 adev->flags.honor_deps = 1;
1801 adev->dep_unmet++;
1812 static void acpi_scan_init_status(struct acpi_device *adev)
1814 if (acpi_bus_get_status(adev))
1815 acpi_set_device_status(adev, 0);
1912 bool acpi_device_is_present(const struct acpi_device *adev)
1914 return adev->status.present || adev->status.functional;
1961 static void acpi_scan_init_hotplug(struct acpi_device *adev)
1965 if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) {
1966 acpi_dock_add(adev);
1969 list_for_each_entry(hwid, &adev->pnp.ids, list) {
1974 adev->flags.hotplug_notify = true;
2130 static int acpi_generic_device_attach(struct acpi_device *adev,
2137 if (adev->data.of_compatible)
2138 acpi_default_enumeration(adev);
2242 struct acpi_device *adev = *adev_p;
2249 if (adev) {
2250 if (dep->consumer == adev->handle)
2256 adev = acpi_get_acpi_dev(dep->consumer);
2257 if (adev) {
2258 *(struct acpi_device **)data = adev;
2267 struct acpi_device *adev;
2277 acpi_bus_attach(cdw->adev, (void *)true);
2280 acpi_dev_put(cdw->adev);
2284 static bool acpi_scan_clear_dep_queue(struct acpi_device *adev)
2288 if (adev->dep_unmet)
2295 cdw->adev = adev;
2315 struct acpi_device *adev = acpi_get_acpi_dev(dep->consumer);
2317 if (adev) {
2318 adev->dep_unmet--;
2319 if (!acpi_scan_clear_dep_queue(adev))
2320 acpi_dev_put(adev);
2393 * acpi_dev_get_next_consumer_dev - Return the next adev dependent on @supplier
2400 * If the returned adev is not passed as @start to this function, the caller is
2401 * responsible for putting the reference to adev when it is no longer needed.
2406 struct acpi_device *adev = start;
2409 acpi_dev_get_next_consumer_dev_cb, &adev);
2413 if (adev == start)
2416 return adev;
2422 struct acpi_device *adev = NULL;
2424 if (ACPI_FAILURE(acpi_bus_check_add(handle, false, &adev)))
2428 acpi_bus_check_add_2, NULL, NULL, (void **)&adev);
2429 acpi_bus_attach(adev, NULL);
2507 static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used)
2509 struct acpi_scan_handler *handler = adev->handler;
2511 acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL);
2513 adev->flags.match_driver = false;
2516 handler->detach(adev);
2518 adev->handler = NULL;
2520 device_release_driver(&adev->dev);
2526 acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
2527 adev->flags.initialized = false;
2528 acpi_device_clear_enumerated(adev);
2535 * @adev: Root of the ACPI namespace scope to walk.
2539 void acpi_bus_trim(struct acpi_device *adev)
2541 acpi_bus_trim_one(adev, NULL);
2562 struct acpi_device *adev = NULL;
2564 acpi_add_single_object(&adev, NULL, ACPI_BUS_TYPE_POWER_BUTTON,
2566 if (adev) {
2567 adev->flags.match_driver = true;
2568 if (device_attach(&adev->dev) >= 0)
2569 device_init_wakeup(&adev->dev, true);
2571 dev_dbg(&adev->dev, "No driver\n");
2576 struct acpi_device *adev = NULL;
2578 acpi_add_single_object(&adev, NULL, ACPI_BUS_TYPE_SLEEP_BUTTON,
2580 if (adev) {
2581 adev->flags.match_driver = true;
2582 if (device_attach(&adev->dev) < 0)
2583 dev_dbg(&adev->dev, "No driver\n");