Lines Matching refs:adev

82 void acpi_initialize_hp_context(struct acpi_device *adev,  in acpi_initialize_hp_context()  argument
90 acpi_set_hp_context(adev, hp); in acpi_initialize_hp_context()
249 struct acpi_device *adev; in acpi_companion_match() local
252 adev = ACPI_COMPANION(dev); in acpi_companion_match()
253 if (!adev) in acpi_companion_match()
256 if (list_empty(&adev->pnp.ids)) in acpi_companion_match()
259 physical_node_lock = &adev->physical_node_lock; in acpi_companion_match()
261 if (list_empty(&adev->physical_node_list)) { in acpi_companion_match()
262 adev = NULL; in acpi_companion_match()
266 node = list_first_entry(&adev->physical_node_list, in acpi_companion_match()
269 adev = NULL; in acpi_companion_match()
273 return adev; in acpi_companion_match()
276 static int __acpi_device_uevent_modalias(struct acpi_device *adev, in __acpi_device_uevent_modalias() argument
281 if (!adev) in __acpi_device_uevent_modalias()
284 if (list_empty(&adev->pnp.ids)) in __acpi_device_uevent_modalias()
290 len = create_pnp_modalias(adev, &env->buf[env->buflen - 1], in __acpi_device_uevent_modalias()
296 if (!adev->data.of_compatible) in __acpi_device_uevent_modalias()
302 len = create_of_modalias(adev, &env->buf[env->buflen - 1], in __acpi_device_uevent_modalias()
324 static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size) in __acpi_device_modalias() argument
328 if (!adev) in __acpi_device_modalias()
331 if (list_empty(&adev->pnp.ids)) in __acpi_device_modalias()
334 len = create_pnp_modalias(adev, buf, size - 1); in __acpi_device_modalias()
341 if (!adev->data.of_compatible) in __acpi_device_modalias()
344 count = create_of_modalias(adev, buf + len, size - 1); in __acpi_device_modalias()
373 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent) in acpi_scan_is_offline() argument
382 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING); in acpi_scan_is_offline()
384 list_for_each_entry(pn, &adev->physical_node_list, node) in acpi_scan_is_offline()
393 mutex_unlock(&adev->physical_node_lock); in acpi_scan_is_offline()
560 static int acpi_scan_device_not_present(struct acpi_device *adev) in acpi_scan_device_not_present() argument
562 if (!acpi_device_enumerated(adev)) { in acpi_scan_device_not_present()
563 dev_warn(&adev->dev, "Still not present\n"); in acpi_scan_device_not_present()
566 acpi_bus_trim(adev); in acpi_scan_device_not_present()
570 static int acpi_scan_device_check(struct acpi_device *adev) in acpi_scan_device_check() argument
574 acpi_bus_get_status(adev); in acpi_scan_device_check()
575 if (adev->status.present || adev->status.functional) { in acpi_scan_device_check()
584 if (adev->handler) { in acpi_scan_device_check()
585 dev_warn(&adev->dev, "Already enumerated\n"); in acpi_scan_device_check()
588 error = acpi_bus_scan(adev->handle); in acpi_scan_device_check()
590 dev_warn(&adev->dev, "Namespace scan failure\n"); in acpi_scan_device_check()
593 if (!adev->handler) { in acpi_scan_device_check()
594 dev_warn(&adev->dev, "Enumeration failure\n"); in acpi_scan_device_check()
598 error = acpi_scan_device_not_present(adev); in acpi_scan_device_check()
603 static int acpi_scan_bus_check(struct acpi_device *adev) in acpi_scan_bus_check() argument
605 struct acpi_scan_handler *handler = adev->handler; in acpi_scan_bus_check()
609 acpi_bus_get_status(adev); in acpi_scan_bus_check()
610 if (!(adev->status.present || adev->status.functional)) { in acpi_scan_bus_check()
611 acpi_scan_device_not_present(adev); in acpi_scan_bus_check()
615 return handler->hotplug.scan_dependent(adev); in acpi_scan_bus_check()
617 error = acpi_bus_scan(adev->handle); in acpi_scan_bus_check()
619 dev_warn(&adev->dev, "Namespace scan failure\n"); in acpi_scan_bus_check()
622 list_for_each_entry(child, &adev->children, node) { in acpi_scan_bus_check()
630 static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type) in acpi_generic_hotplug_event() argument
634 return acpi_scan_bus_check(adev); in acpi_generic_hotplug_event()
636 return acpi_scan_device_check(adev); in acpi_generic_hotplug_event()
639 if (adev->handler && !adev->handler->hotplug.enabled) { in acpi_generic_hotplug_event()
640 dev_info(&adev->dev, "Eject disabled\n"); in acpi_generic_hotplug_event()
643 acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST, in acpi_generic_hotplug_event()
645 return acpi_scan_hot_remove(adev); in acpi_generic_hotplug_event()
650 void acpi_device_hotplug(struct acpi_device *adev, u32 src) in acpi_device_hotplug() argument
663 if (adev->handle == INVALID_ACPI_HANDLE) in acpi_device_hotplug()
666 if (adev->flags.is_dock_station) { in acpi_device_hotplug()
667 error = dock_notify(adev, src); in acpi_device_hotplug()
668 } else if (adev->flags.hotplug_notify) { in acpi_device_hotplug()
669 error = acpi_generic_hotplug_event(adev, src); in acpi_device_hotplug()
678 notify = adev->hp ? adev->hp->notify : NULL; in acpi_device_hotplug()
685 error = notify(adev, src); in acpi_device_hotplug()
693 acpi_evaluate_ost(adev->handle, src, ost_code, NULL); in acpi_device_hotplug()
696 acpi_bus_put_acpi_device(adev); in acpi_device_hotplug()
704 struct acpi_device *adev = to_acpi_device(dev); in real_power_state_show() local
708 ret = acpi_device_get_power(adev, &state); in real_power_state_show()
720 struct acpi_device *adev = to_acpi_device(dev); in power_state_show() local
722 return sprintf(buf, "%s\n", acpi_power_state_string(adev->power.state)); in power_state_show()
987 static bool acpi_of_match_device(struct acpi_device *adev, in acpi_of_match_device() argument
993 if (!adev) in acpi_of_match_device()
996 of_compatible = adev->data.of_compatible; in acpi_of_match_device()
1279 struct acpi_device *adev; in acpi_device_del_work_fn() local
1287 adev = list_first_entry(&acpi_device_del_list, in acpi_device_del_work_fn()
1289 list_del(&adev->del_list); in acpi_device_del_work_fn()
1293 acpi_device_del(adev); in acpi_device_del_work_fn()
1298 acpi_power_transition(adev, ACPI_STATE_D3_COLD); in acpi_device_del_work_fn()
1299 put_device(&adev->dev); in acpi_device_del_work_fn()
1319 struct acpi_device *adev = context; in acpi_scan_drop_device() local
1336 list_add_tail(&adev->del_list, &acpi_device_del_list); in acpi_scan_drop_device()
1338 adev->handle = INVALID_ACPI_HANDLE; in acpi_scan_drop_device()
1375 struct acpi_device *adev = NULL; in acpi_bus_get_acpi_device() local
1377 acpi_get_device_data(handle, &adev, get_acpi_device); in acpi_bus_get_acpi_device()
1378 return adev; in acpi_bus_get_acpi_device()
1381 void acpi_bus_put_acpi_device(struct acpi_device *adev) in acpi_bus_put_acpi_device() argument
1383 put_device(&adev->dev); in acpi_bus_put_acpi_device()
1485 struct acpi_device *adev = ACPI_COMPANION(dev); in acpi_get_next_child() local
1488 if (!adev) in acpi_get_next_child()
1491 head = &adev->children; in acpi_get_next_child()
1921 bool acpi_device_is_battery(struct acpi_device *adev) in acpi_device_is_battery() argument
1925 list_for_each_entry(hwid, &adev->pnp.ids, list) in acpi_device_is_battery()
1932 static bool is_ejectable_bay(struct acpi_device *adev) in is_ejectable_bay() argument
1934 acpi_handle handle = adev->handle; in is_ejectable_bay()
1936 if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev)) in is_ejectable_bay()
2212 bool acpi_device_is_present(struct acpi_device *adev) in acpi_device_is_present() argument
2214 if (adev->status.present || adev->status.functional) in acpi_device_is_present()
2217 adev->flags.initialized = false; in acpi_device_is_present()
2265 static void acpi_scan_init_hotplug(struct acpi_device *adev) in acpi_scan_init_hotplug() argument
2269 if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) { in acpi_scan_init_hotplug()
2270 acpi_dock_add(adev); in acpi_scan_init_hotplug()
2273 list_for_each_entry(hwid, &adev->pnp.ids, list) { in acpi_scan_init_hotplug()
2278 adev->flags.hotplug_notify = true; in acpi_scan_init_hotplug()
2284 static void acpi_device_dep_initialize(struct acpi_device *adev) in acpi_device_dep_initialize() argument
2291 if (!acpi_has_method(adev->handle, "_DEP")) in acpi_device_dep_initialize()
2294 status = acpi_evaluate_reference(adev->handle, "_DEP", NULL, in acpi_device_dep_initialize()
2297 dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n"); in acpi_device_dep_initialize()
2307 dev_dbg(&adev->dev, "Error reading _DEP device info\n"); in acpi_device_dep_initialize()
2328 dep->slave = adev->handle; in acpi_device_dep_initialize()
2329 adev->dep_unmet++; in acpi_device_dep_initialize()
2412 static int acpi_generic_device_attach(struct acpi_device *adev, in acpi_generic_device_attach() argument
2419 if (adev->data.of_compatible) in acpi_generic_device_attach()
2420 acpi_default_enumeration(adev); in acpi_generic_device_attach()
2513 struct acpi_device *adev; in acpi_walk_dep_device_list() local
2518 acpi_bus_get_device(dep->slave, &adev); in acpi_walk_dep_device_list()
2519 if (!adev) in acpi_walk_dep_device_list()
2522 adev->dep_unmet--; in acpi_walk_dep_device_list()
2523 if (!adev->dep_unmet) in acpi_walk_dep_device_list()
2524 acpi_bus_attach(adev); in acpi_walk_dep_device_list()
2569 void acpi_bus_trim(struct acpi_device *adev) in acpi_bus_trim() argument
2571 struct acpi_scan_handler *handler = adev->handler; in acpi_bus_trim()
2574 list_for_each_entry_reverse(child, &adev->children, node) in acpi_bus_trim()
2577 adev->flags.match_driver = false; in acpi_bus_trim()
2580 handler->detach(adev); in acpi_bus_trim()
2582 adev->handler = NULL; in acpi_bus_trim()
2584 device_release_driver(&adev->dev); in acpi_bus_trim()
2590 acpi_device_set_power(adev, ACPI_STATE_D3_COLD); in acpi_bus_trim()
2591 adev->flags.initialized = false; in acpi_bus_trim()
2592 adev->flags.visited = false; in acpi_bus_trim()