diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2019-06-14 13:53:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-23 23:22:31 -0400 |
commit | e6374f6b2e9c9f9a7cf5418157ad7f30f3abd70e (patch) | |
tree | 69b5eb00890a11d69471a09d0c4dc862c53df2c1 | |
parent | 29d14b668d2f2e7b692525ee3f69bf12b06be0f0 (diff) |
acpi: utils: Cleanup acpi_dev_match_cb
The prototype of bus_find_device() will be unified with that of
class_find_device() subsequently, but for this purpose the callback
functions passed to it need to take (const void *) as the second
argument. Consequently, they cannot modify the memory pointed to by
that argument which currently is not the case for acpi_dev_match_cb().
However, acpi_dev_match_cb() really need not modify the "match" object
passed to it, because acpi_dev_get_first_match_dev() which uses it via
bus_find_device() can easily convert the result of bus_find_device()
into the pointer to return.
For this reason, update acpi_dev_match_cb() to avoid the redundant
memory updates.
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/acpi/utils.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 7def63ab00c0..1391b63cadfd 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) | |||
725 | EXPORT_SYMBOL(acpi_dev_found); | 725 | EXPORT_SYMBOL(acpi_dev_found); |
726 | 726 | ||
727 | struct acpi_dev_match_info { | 727 | struct acpi_dev_match_info { |
728 | const char *dev_name; | ||
729 | struct acpi_device *adev; | ||
730 | struct acpi_device_id hid[2]; | 728 | struct acpi_device_id hid[2]; |
731 | const char *uid; | 729 | const char *uid; |
732 | s64 hrv; | 730 | s64 hrv; |
@@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) | |||
746 | strcmp(adev->pnp.unique_id, match->uid))) | 744 | strcmp(adev->pnp.unique_id, match->uid))) |
747 | return 0; | 745 | return 0; |
748 | 746 | ||
749 | match->dev_name = acpi_dev_name(adev); | ||
750 | match->adev = adev; | ||
751 | |||
752 | if (match->hrv == -1) | 747 | if (match->hrv == -1) |
753 | return 1; | 748 | return 1; |
754 | 749 | ||
@@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) | |||
818 | match.hrv = hrv; | 813 | match.hrv = hrv; |
819 | 814 | ||
820 | dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); | 815 | dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); |
821 | return dev ? match.adev : NULL; | 816 | return dev ? to_acpi_device(dev) : NULL; |
822 | } | 817 | } |
823 | EXPORT_SYMBOL(acpi_dev_get_first_match_dev); | 818 | EXPORT_SYMBOL(acpi_dev_get_first_match_dev); |
824 | 819 | ||