summaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2021-04-13 01:23:58 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-04-13 15:41:11 +0200
commit4cbaba4e3e4a8a00ed90193ae519c52ba01ea756 (patch)
treeb4d7680c20cb13039e270c0d8d4245b55e52761d /include/acpi
parent020505581119d191ee8da478783e2465d7f5fa8e (diff)
downloadlinux-4cbaba4e3e4a8a00ed90193ae519c52ba01ea756.tar.bz2
ACPI: bus: Introduce acpi_dev_get() and reuse it in ACPI code
Introduce acpi_dev_get() to have a symmetrical API with acpi_dev_put() and reuse both in ACPI code in drivers/acpi/. While at it, use acpi_bus_put_acpi_device() in one place instead of the above. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_bus.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f28b097c658f..c1c9adaed205 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -694,6 +694,11 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
adev; \
adev = acpi_dev_get_next_match_dev(adev, hid, uid, hrv))
+static inline struct acpi_device *acpi_dev_get(struct acpi_device *adev)
+{
+ return adev ? to_acpi_device(get_device(&adev->dev)) : NULL;
+}
+
static inline void acpi_dev_put(struct acpi_device *adev)
{
put_device(&adev->dev);