diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2021-04-13 02:20:51 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-04-13 15:48:02 +0200 |
commit | 81eeb2f57782d0dff15db97665599121e289b614 (patch) | |
tree | 14f2f2308b8d96135c315062968978e4b9bb2c7c /drivers/acpi/utils.c | |
parent | d434405aaab7d0ebc516b68a8fc4100922d7f5ef (diff) | |
download | linux-81eeb2f57782d0dff15db97665599121e289b614.tar.bz2 |
ACPI: utils: Document for_each_acpi_dev_match() macro
The macro requires to call acpi_dev_put() on each iteration.
Due to this it doesn't tolerate sudden disappearence of the devices.
Document all these nuances to prevent users blindly call it without
understanding the possible issues.
While at it, add the note to the acpi_dev_get_next_match_dev() and
advertise acpi_dev_put() instead of put_device() in the whole family
of the helper functions.
Fixes: bf263f64e804 ("media: ACPI / bus: Add acpi_dev_get_next_match_dev() and helper macro")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 682edd913b3b..35c3b52fb6ad 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -832,7 +832,11 @@ EXPORT_SYMBOL(acpi_dev_present); * Return the next match of ACPI device if another matching device was present * at the moment of invocation, or NULL otherwise. * - * The caller is responsible to call put_device() on the returned device. + * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g. + * in the case of a hotplug event. That said, the caller should ensure that + * this will never happen. + * + * The caller is responsible for invoking acpi_dev_put() on the returned device. * * See additional information in acpi_dev_present() as well. */ @@ -861,7 +865,7 @@ EXPORT_SYMBOL(acpi_dev_get_next_match_dev); * Return the first match of ACPI device if a matching device was present * at the moment of invocation, or NULL otherwise. * - * The caller is responsible to call put_device() on the returned device. + * The caller is responsible for invoking acpi_dev_put() on the returned device. * * See additional information in acpi_dev_present() as well. */ |