Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: core: Use acpi_find_child_device() for child devices lookup

Use acpi_find_child_device() for child devices lookup in mfd_acpi_add_device()
instead of open coded approach. No functional change intended.

While at it, amend a note comment, since usage of _ADR is found on other
platforms and tables than Intel Galileo Gen 2, in particular USB wired devices
are using it, according to Microsoft specifications for embedded platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Andy Shevchenko and committed by
Lee Jones
40cb71f3 6dac44c6

+5 -17
+5 -17
drivers/mfd/mfd-core.c
··· 65 65 { 66 66 const struct mfd_cell_acpi_match *match = cell->acpi_match; 67 67 struct acpi_device *parent, *child; 68 - struct acpi_device *adev; 68 + struct acpi_device *adev = NULL; 69 69 70 70 parent = ACPI_COMPANION(pdev->dev.parent); 71 71 if (!parent) ··· 77 77 * _ADR or it will use the parent handle if is no ID is given. 78 78 * 79 79 * Note that use of _ADR is a grey area in the ACPI specification, 80 - * though Intel Galileo Gen2 is using it to distinguish the children 81 - * devices. 80 + * though at least Intel Galileo Gen 2 is using it to distinguish 81 + * the children devices. 82 82 */ 83 - adev = parent; 84 83 if (match) { 85 84 if (match->pnpid) { 86 85 struct acpi_device_id ids[2] = {}; ··· 92 93 } 93 94 } 94 95 } else { 95 - unsigned long long adr; 96 - acpi_status status; 97 - 98 - list_for_each_entry(child, &parent->children, node) { 99 - status = acpi_evaluate_integer(child->handle, 100 - "_ADR", NULL, 101 - &adr); 102 - if (ACPI_SUCCESS(status) && match->adr == adr) { 103 - adev = child; 104 - break; 105 - } 106 - } 96 + adev = acpi_find_child_device(parent, match->adr, false); 107 97 } 108 98 } 109 99 110 - ACPI_COMPANION_SET(&pdev->dev, adev); 100 + ACPI_COMPANION_SET(&pdev->dev, adev ?: parent); 111 101 } 112 102 #else 113 103 static inline void mfd_acpi_add_device(const struct mfd_cell *cell,